Public: anyone can read this; the crew can change it.
test/migrate-after.test.ts's mirror cases pass every time on a loaded check machine #4622
Check · Review · Land · Live done — Landed and live in production.
The three mirror cases in `test/migrate-after.test.ts` now wait for the mirror push to end instead of running a 90 s `Date.now()` poll with 25 ms naps. Only the test file changed. I ran `bun test` on that file plus a check-only run, and haven't run `scripts/flake-hunt.ts` or the forge's full check.
shipped production is serving it deploy 1f09d72
The three mirror cases in test/migrate-after.test.ts now wait for the mirror push to end instead of running a 90 s Date.now() poll with 25 ms naps. Only the test file changed. I ran bun test on that file plus a check-only run, and haven't run scripts/flake-hunt.ts or the forge's full check.
- Event: the test hands
startMirrorOuta thin wrapper aroundpushToMirrorTarget. When a push ends, whether it succeeded or threw, the wrapper wakes whoever is waiting. - Waiting:
settledTargetchecks the mirror target row and, if the condition isn't met yet, sleeps until the next push ends and checks again. There is no fixed sleep and no raw deadline. The test's own timeout is the only bound, so I didn't need the #4431 budget helper. - Not changed:
src/is untouched, and the assertions are the same.
I couldn't reproduce the original failures, so I haven't proved the root cause. I think they came from the poll loop's 90 s deadline running out on a loaded machine.
How it was run: bun test test/migrate-after.test.ts passed on its own (9 pass, 0 fail). I then ran 8 copies at once with --randomize, three rounds in a row, with no failures. That's 24 runs, which meets the "8 copies at once" option in the issue, not the flake-hunt.ts option.
bun x tsc --noEmit couldn't check the types because the bun type definitions weren't found in this sandbox, so the forge's check will be the first type check of this change.
Test-only change. It uses the existing push seam on startMirrorOut, and the wake-up sits in a finally, so a push that throws still wakes the waiters. The look-then-register step has no await between check and registration, so a wake-up cannot be missed. src/ is untouched and the assertions are the same. No user-facing surface changes, so there is no preview or tty or README impact.
Two things I would do next:
- Run scripts/flake-hunt.ts on this file. The PR ran 8 copies at once, but the builder says flake-hunt was not run.
- If no push ever happens, the wait now ends as a bare test timeout with no message. Wrap it in the #4431 budget helper, or add a short comment, so a failure names the mirror push as the thing that never came. Also confirm the forge check type-checks, since tsc could not run in the sandbox.
The three mirror cases in
test/migrate-after.test.tsnow wait for the mirror push to end instead of running a 90 sDate.now()poll with 25 ms naps. Only the test file changed. I ranbun teston that file plus a check-only run, and haven't runscripts/flake-hunt.tsor the forge's full check.startMirrorOuta thin wrapper aroundpushToMirrorTarget. When a push ends, whether it succeeded or threw, the wrapper wakes whoever is waiting.settledTargetchecks the mirror target row and, if the condition isn't met yet, sleeps until the next push ends and checks again. There is no fixed sleep and no raw deadline. The test's own timeout is the only bound, so I didn't need the #4431 budget helper.src/is untouched, and the assertions are the same.I couldn't reproduce the original failures, so I haven't proved the root cause. I think they came from the poll loop's 90 s deadline running out on a loaded machine.
How it was run:
bun test test/migrate-after.test.tspassed on its own (9 pass, 0 fail). I then ran 8 copies at once with--randomize, three rounds in a row, with no failures. That's 24 runs, which meets the "8 copies at once" option in the issue, not theflake-hunt.tsoption.bun x tsc --noEmitcouldn't check the types because thebuntype definitions weren't found in this sandbox, so the forge's check will be the first type check of this change.Closes #4577