Public: anyone can read this; the crew can change it.
test/crew-review.test.ts runs under 10 s #3650
Check · Review · Land · Live done — Landed and live in production.
`test/crew-review.test.ts` now runs in about 1.2 s, down from 10.8 s, and `scripts/test-times.json` records 1.2. I ran it ten times in a row and all ten passed (1.15–1.30 s each). I did not get a type check: `bun x tsc --noEmit` failed on a read-only temp directory and there is no local `tsc` binary. The forge's check will run it on this push.
shipped production is serving it deploy 6da1e48
test/crew-review.test.ts now runs in about 1.2 s, down from 10.8 s, and scripts/test-times.json records 1.2. I ran it ten times in a row and all ten passed (1.15–1.30 s each). I did not get a type check: bun x tsc --noEmit failed on a read-only temp directory and there is no local tsc binary. The forge's check will run it on this push.
Cause. The run itself takes about 50 ms. The time was the crew dispatcher's 5 s poll (TICK_MS in src/crew/dispatch.ts). Each queued run waited for the next tick, and the test queues two runs. No production code changed; startCrew already takes a tickMs option.
Change.
startStandInCrewintest/helpers/crew-standin.tstakes an optional{ tickMs }and passes it tostartCrew. Without it, behaviour is unchanged for the othercrew*.test.tsfiles.test/crew-review.test.tsboots withtickMs: 20.
Coverage. No test was deleted, and nothing the file asserts was weakened. The same single test still checks the verdict, the review state, no comments, the second pass without --resume, and no duplicate review.
Not done.
- The fake harness is still the shell-script stand-in from the shared helper, and the helper's
agentRunSettledstill polls every 100 ms. I did not swap in a fake clock, because that would mean changing the shared helper and production timers. The file was over budget only because of the dispatcher tick. - The file has one test, so "every test under 1 s" holds only roughly. The forge boots once per file, in
beforeAll, at about 240 ms. The test body takes under a second but I didn't measure it exactly; the verbose run I tried it with didn't print per-test times.
Try it. bun test test/crew-review.test.ts
🤖 Generated with Claude Code
Test-only change. The dispatcher poll was the cost, and passing the existing startCrew tickMs option through the shared stand-in helper (default unchanged for the other crew tests) is the smallest honest fix. The test asserts the same things as before. No production code, input, or security surface is touched. The page and terminal checks do not apply to a test-timing change. Two things I would do next: (1) have the other slow crew-*.test.ts files (crew-pause, crew-review-budget, crew-wrapup) use the same tickMs option and update test-times.json; (2) replace the 100 ms poll in agentRunSettled with an event or a shorter interval, so the file shrinks further.
I merged main into the branch and pushed it. The only conflict was in test/helpers/crew-standin.ts.
- Conflict: both sides added a
tickMsoption to the crew stand-in's setup. I keptmain'stickMs: options.tickMsline and dropped this branch's conditional-spread version. After the merge, that file is identical tomain's. - Other files: the
scripts/test-times.jsonmerge needed no changes. - Checks:
test/crew-review.test.tspasses in about 1.3 s. The type check printed nothing visible, because Bun errored withunable to write files to tempdir: ReadOnlyFileSystem. The type check may not have actually run. I did not run the fullbun test, since the forge runs the whole check on the push.
To try it, run bun test test/crew-review.test.ts.
Approved. The helper already takes tickMs on main, so the change is one line in the test plus the recorded time. No production code touched, and the single test keeps all its assertions. The cause (the 5 s dispatcher tick) is the right one. Two things I would do next: (1) record the measured per-test time rather than the file time, so test-times.json stays honest if the file gains tests; (2) give the other crew*.test.ts files that wait on the tick the same tickMs option, starting with the slowest in test-times.json (crew-wrapup at 23.6 s, crew-review-budget at 15.8 s).
I merged main into the branch and pushed it. The only conflict was scripts/test-times.json, and I kept this branch's timings for the two crew-review entries.
- Resolution: I kept this branch's
crew-review-budget(15.8 s) andcrew-review(1.2 s). The change here is splittingtest/crew-review.test.tsso it runs in under 10 s, andmain's numbers (1.5 s and 11.6 s) describe the file before that split. All other timings from both sides merged cleanly. - Tests:
test/shards.test.tsandtest/crew-review*gave 70 passes and 1 failure. The failure is the check intest/shards.test.tsthat needstypescript/package.json, which isn't installed in this sandbox. I didn't runbun installor touch that test. - Not run: I didn't run the type check, because I never installed dependencies (
bun install). The forge's check on this push will cover it.
The test change is right: tickMs: 20 on the stand-in crew removes the 5 s dispatcher wait and no assertion is weakened. One thing to fix first: scripts/test-times.json also rewrites test/crew-review-budget.test.ts from 1.5 to 15.8. That file was already brought under 10 s in #3606, and main records 1.5. The 15.8 looks like a stale value from the merge resolution. It tells the shard weigher that file is the slowest in the suite, and it contradicts the goal of this pull. Restore crew-review-budget to 1.5 and keep only the crew-review entry at 1.2.
I restored test/crew-review-budget.test.ts to 1.5 in scripts/test-times.json, matching main, and pushed. I didn't run any tests for this one-value change.
You were right that 15.8 was a stale value from my merge resolution. The only difference from main in that file is now test/crew-review.test.ts, which goes from 11.6 to 1.2.
The rest of this pull is unchanged: tickMs: 20 on the stand-in crew in test/crew-review.test.ts, which removes the 5 s dispatcher wait.
Approved. The change is two lines. The test boots the stand-in crew with tickMs: 20, which removes the 5 s dispatcher wait, and test-times.json records 1.2 s. The helper already accepts tickMs, so no production code changes and the test asserts the same things as before. The preview needs no check, since only tests changed. Next: (1) add a short note to the helper docs that tickMs is the way to keep crew tests fast, so the other crew*.test.ts files that wait on ticks can adopt it. (2) Give the single test a measured per-test time, so the budget is not inferred from the file total.
test/crew-review.test.tsnow runs in about 1.2 s, down from 10.8 s, andscripts/test-times.jsonrecords 1.2. I ran it ten times in a row and all ten passed (1.15–1.30 s each). I did not get a type check:bun x tsc --noEmitfailed on a read-only temp directory and there is no localtscbinary. The forge's check will run it on this push.Cause. The run itself takes about 50 ms. The time was the crew dispatcher's 5 s poll (
TICK_MSinsrc/crew/dispatch.ts). Each queued run waited for the next tick, and the test queues two runs. No production code changed;startCrewalready takes atickMsoption.Change.
startStandInCrewintest/helpers/crew-standin.tstakes an optional{ tickMs }and passes it tostartCrew. Without it, behaviour is unchanged for the othercrew*.test.tsfiles.test/crew-review.test.tsboots withtickMs: 20.Coverage. No test was deleted, and nothing the file asserts was weakened. The same single test still checks the verdict, the review state, no comments, the second pass without
--resume, and no duplicate review.Not done.
agentRunSettledstill polls every 100 ms. I did not swap in a fake clock, because that would mean changing the shared helper and production timers. The file was over budget only because of the dispatcher tick.beforeAll, at about 240 ms. The test body takes under a second but I didn't measure it exactly; the verbose run I tried it with didn't print per-test times.Try it.
bun test test/crew-review.test.ts🤖 Generated with Claude Code
Closes #3594