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

test/origins-reconnect.test.ts's frozen-mirror suite passes every time on a loaded check machine #4621

Merged opened this

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

Merged

The frozen-mirror suite in `test/origins-reconnect.test.ts` no longer races its own hook timeout or uses fixed deadlines. It passed 24 of 24 runs in the 8-copies-at-once check, but I did not run `scripts/flake-hunt.ts`.

shipped production is serving it deploy 5f89d5b

opened this

The frozen-mirror suite in test/origins-reconnect.test.ts no longer races its own hook timeout or uses fixed deadlines. It passed 24 of 24 runs in the 8-copies-at-once check, but I did not run scripts/flake-hunt.ts.

  • Setup: the afterAll hook now waits for syncs to settle with no 30 s race. A slow sync can no longer eat the hook's 120 s timeout, which is what failed the file "under no name".
  • Waiting: mirrorReaches and the "fork follows its parent" wait now share one refReaches helper. It has no wall-clock deadline of its own. It waits for the sync to settle or 50 ms, then re-reads the ref. The test's own 60 s timeout is the only bound, so a loaded machine slows the wait and does not fail it.
  • Budget helper: none of these waits is a speed assertion, so I did not use the load-proof helper from #4431.

How it was run: three rounds of 8 simultaneous bun test test/origins-reconnect.test.ts processes, 24 runs in all. Every run exited 0 (12 tests each), and the file also passes alone in about 2 s.

Type check: bun x tsc --noEmit could not run here. It errors with "Cannot find type definition file for 'bun'" because node_modules isn't installed, and I didn't run bun install. The edit only touches test code.

Left out: I did not change src/origins/sync.ts. A sync that hangs forever would now run until the test timeout, which names the test, instead of being skipped after 30 s.

Closes #4578

commented

The frozen-mirror suite in test/origins-reconnect.test.ts no longer races its own hook timeout or uses fixed deadlines. It passed 24 of 24 runs in the 8-copies-at-once check, but I did not run scripts/flake-hunt.ts.

  • Setup: the afterAll hook now waits for syncs to settle with no 30 s race. A slow sync can no longer eat the hook's 120 s timeout, which is what failed the file "under no name".
  • Waiting: mirrorReaches and the "fork follows its parent" wait now share one refReaches helper. It has no wall-clock deadline of its own. It waits for the sync to settle or 50 ms, then re-reads the ref. The test's own 60 s timeout is the only bound, so a loaded machine slows the wait and does not fail it.
  • Budget helper: none of these waits is a speed assertion, so I did not use the load-proof helper from #4431.

How it was run: three rounds of 8 simultaneous bun test test/origins-reconnect.test.ts processes, 24 runs in all. Every run exited 0 (12 tests each), and the file also passes alone in about 2 s.

Type check: bun x tsc --noEmit could not run here. It errors with "Cannot find type definition file for 'bun'" because node_modules isn't installed, and I didn't run bun install. The edit only touches test code.

Left out: I did not change src/origins/sync.ts. A sync that hangs forever would now run until the test timeout, which names the test, instead of being skipped after 30 s.

Approved

Test-only change. It replaces the two wall-clock deadlines with one refReaches helper, and the test timeout becomes the only bound. The helper re-reads the ref after syncsSettled() or 50 ms, and syncsSettled() loops over in-flight syncs, so a chained reconnect sync is still awaited. The afterAll no longer races a 30 s sleep, so a loaded machine slows the suite and does not fail it. No source, security surface or dependency changes. I read the diff and src/origins/sync.ts but did not run the tests or load the preview. Two things to do next: (1) run scripts/flake-hunt.ts on this file, since only the 8-at-once runs are reported; (2) setDefaultTimeout(60_000) is the only bound now, so if a sync ever hangs, the failure is the test timeout and the sync is not named. Consider a descriptive error from the test body in that case.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs