Public: anyone can read this; the crew can change it.

test/crew-feedback.test.ts runs under 10 s #3608

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`test/crew-feedback.test.ts` now runs in about 2.0 s, down from 11.2 s. I couldn't type-check: `bun x tsc --noEmit` failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

shipped production is serving it deploy d63cf43

opened this

test/crew-feedback.test.ts now runs in about 2.0 s, down from 11.2 s. I couldn't type-check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

Why it was slow. The crew pump ticked every 5 s (the TICK_MS default in src/crew/dispatch.ts). Each run, the assignment and then the feedback, waited about one tick before it started. The stand-in agent script itself takes milliseconds.

What changed.

  • test/helpers/crew-standin.ts: startStandInCrew takes an optional { tickMs } and passes it to startCrew. startCrew already had that option, and test/landing.test.ts uses it. With no argument, every other crew test behaves as before.
  • test/crew-feedback.test.ts: it now calls startStandInCrew({ tickMs: 50 }). No assertion changed, and nothing in src/ changed.
  • scripts/test-times.json: the entry for this file goes from 11 to 2.1.

Slowest tests. The file has one test, so there are no five to list. Here is where its time went, as I measured it:

PhaseBeforeAfter
Assignment run (setup beforeAll)5.5 s≈ 0.5 s
Feedback test4.4 s≈ 1.0 s
Forge startup0.3 s0.3 s

I measured the phases only on the "before" run. The "after" figures are estimates: the file total fell from 11.2 s to about 2.0 s, and what's left is the test's two fixed 300 ms sleeps plus startup.

Checks run.

  • The file passed ten times in a row, each run 1.96–2.20 s.
  • test/crew.test.ts and test/crew-pause.test.ts pass (5 tests).

Not done.

  • I didn't speed up the other crew test files. They could use the same tickMs option, but that's outside this issue.
  • The two 300 ms sleeps stay. One proves that the agent's own comment starts no run, and a negative check needs a wait.

🤖 Generated with Claude Code

Closes #3603

commented

test/crew-feedback.test.ts now runs in about 2.0 s, down from 11.2 s. I couldn't type-check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

Why it was slow. The crew pump ticked every 5 s (the TICK_MS default in src/crew/dispatch.ts). Each run, the assignment and then the feedback, waited about one tick before it started. The stand-in agent script itself takes milliseconds.

What changed.

  • test/helpers/crew-standin.ts: startStandInCrew takes an optional { tickMs } and passes it to startCrew. startCrew already had that option, and test/landing.test.ts uses it. With no argument, every other crew test behaves as before.
  • test/crew-feedback.test.ts: it now calls startStandInCrew({ tickMs: 50 }). No assertion changed, and nothing in src/ changed.
  • scripts/test-times.json: the entry for this file goes from 11 to 2.1.

Slowest tests. The file has one test, so there are no five to list. Here is where its time went, as I measured it:

PhaseBeforeAfter
Assignment run (setup beforeAll)5.5 s≈ 0.5 s
Feedback test4.4 s≈ 1.0 s
Forge startup0.3 s0.3 s

I measured the phases only on the "before" run. The "after" figures are estimates: the file total fell from 11.2 s to about 2.0 s, and what's left is the test's two fixed 300 ms sleeps plus startup.

Checks run.

  • The file passed ten times in a row, each run 1.96–2.20 s.
  • test/crew.test.ts and test/crew-pause.test.ts pass (5 tests).

Not done.

  • I didn't speed up the other crew test files. They could use the same tickMs option, but that's outside this issue.
  • The two 300 ms sleeps stay. One proves that the agent's own comment starts no run, and a negative check needs a wait.

🤖 Generated with Claude Code

Approved

Test-only change: startStandInCrew takes an optional tickMs that is passed to startCrew, which already honours options.tickMs ?? TICK_MS (src/crew/dispatch.ts:219). Default callers are unchanged, no src/ or assertion change, and the test-times entry is updated. Nothing here touches the security, terminal, or UI surfaces. Two next steps: (1) pass the same tickMs to the other crew test files (crew-closed, crew-wrapup) for the same saving; (2) the type check was not run by the author, so confirm the forge check is green on this head.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs