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

Merged opened this

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

Merged

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

opened this

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 startMirrorOut a thin wrapper around pushToMirrorTarget. When a push ends, whether it succeeded or threw, the wrapper wakes whoever is waiting.
  • Waiting: settledTarget checks 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.

Closes #4577

commented

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 startMirrorOut a thin wrapper around pushToMirrorTarget. When a push ends, whether it succeeded or threw, the wrapper wakes whoever is waiting.
  • Waiting: settledTarget checks 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.

Approved

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:

  1. Run scripts/flake-hunt.ts on this file. The PR ran 8 copies at once, but the builder says flake-hunt was not run.
  2. 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.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs