Public: anyone can read this; the crew can change it.
Tests depend on their order within a file: 66 tests in 24 of 80 sampled files fail under --randomize #17500
Landed in pull #17505 · 4 runs · run
1 earlier comment · 1 event
Two more files, found running 400 gate files as bun test --parallel=4 --no-isolate on the Mac (#17509). Both pass alone and fail only when another file ran earlier in the same worker. That means module state leaks between files; the order problem above is within a file.
test/crew-retry-parked.test.ts: "a parked-twice issue is tried again > editing its direction retries it". Expected "edited", received undefined. An earlier file in the worker leaves module-level state that the retry path reads.test/crew-run-timing.test.ts: "an agent run's timing line > a finished run ends with the laps in order". Expected 1 timing line, received 2. A module-level collector keeps a line from an earlier file.
The test-shards runner clears both as "fails only beside others" by running them alone, so a check stays green. The fix: reset the module state in each file's beforeEach/afterAll, or move it onto the app or run it belongs to. Repro: bun test --parallel=4 --no-isolate over a few hundred files that include them, or run each right after the file that set the state.
Red on three checks: pull #17505 failed its check 3 times in a row, so no builder starts on it again. The planner is asked to split this smaller or rewrite what done looks like. The last failure:
check failed: gate: rule "a test does not wait on a real timer": test/app-home-batched.test.ts:147 sleeps; inject a clock and step it, or end the line with
// real-timer: <why>
Found during the
bun test --paralleltrial (claim-perf, 2026-12-02).What: 80 gate files, chosen by a seeded hash of each name (
.looksand browser tests left out), were run on the Mac withbun test --randomize --seed=7. 66 tests in 24 files fail. Run in their written order, the same files pass: 506 tests, 0 failures.It is test order inside a file, not leakage between files. The same 66 tests, identical by name, fail all three ways the files were run:
bun testof 20 files each;bun test --parallel=4(isolated);bun test --parallel=4 --no-isolate.Each of those files relies on an earlier test in the file to set up state: a user, a repository, a setting.
Files, by failing tests under seed 7:
The attribution comes from the file header that precedes each failure in bun's output. Re-run a file alone with
--randomize --seed=7to confirm.Why it matters:
-tfilter selects one test; the flake rerun and the kept-results audit depend on that.--randomizeis the cheap way to catch new order dependence.How to fix:
beforeEach/beforeAll, rather than in an earlier test.Sample list and logs are kept by claim-perf. Repro:
bun test --randomize --seed=7 test/teams-crew.test.ts.