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

"the burst-of-errors board in test/forge-degraded.test.ts" passes every time on a loaded check machine #5226

Merged opened this

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

Merged

The burst-of-errors test in `test/forge-degraded.test.ts` now records its errors on the fake clock, which should stop it failing on a loaded machine. I haven't reproduced the original failure, so the fix rests on reading the code, not on seeing the test go red.

shipped production is serving it deploy 4915f35

opened this

The burst-of-errors test in test/forge-degraded.test.ts now records its errors on the fake clock, which should stop it failing on a loaded machine. I haven't reproduced the original failure, so the fix rests on reading the code, not on seeing the test go red.

Cause: a fake clock mixed with Date.now(). The test advances clock by about 55 minutes in total. The notifier reads the fake clock, but the errors were recorded with the real Date.now(). How old the errors looked to the notifier therefore depended on real elapsed time. On a slow check machine, real time between recording and ticking could push errors outside the one-hour window at the wrong moment.

Change: one line, 82. app.signals.errors.record("test", "boom", Date.now()) is now app.signals.errors.record("test", "boom", clock). No source files, thresholds or budgets changed, and the test still checks the same promise: a burst turns the board red, one page goes out after the delay, and recovery sends one "Recovered".

Checked:

  • bun test --rerun-each 30 test/forge-degraded.test.ts passed all 30 runs.
  • bun test test/forge-degraded.test.ts test/apps.test.ts passed all 22 tests with both files running together.
  • I didn't break the behaviour on purpose to confirm the test still goes red.

Left alone: the board still renders its error count against the real clock. That's harmless here, because the errors are stamped at the start and the test stays well inside the hour.

Closes #5202

commented

The burst-of-errors test in test/forge-degraded.test.ts now records its errors on the fake clock, which should stop it failing on a loaded machine. I haven't reproduced the original failure, so the fix rests on reading the code, not on seeing the test go red.

Cause: a fake clock mixed with Date.now(). The test advances clock by about 55 minutes in total. The notifier reads the fake clock, but the errors were recorded with the real Date.now(). How old the errors looked to the notifier therefore depended on real elapsed time. On a slow check machine, real time between recording and ticking could push errors outside the one-hour window at the wrong moment.

Change: one line, 82. app.signals.errors.record("test", "boom", Date.now()) is now app.signals.errors.record("test", "boom", clock). No source files, thresholds or budgets changed, and the test still checks the same promise: a burst turns the board red, one page goes out after the delay, and recovery sends one "Recovered".

Checked:

  • bun test --rerun-each 30 test/forge-degraded.test.ts passed all 30 runs.
  • bun test test/forge-degraded.test.ts test/apps.test.ts passed all 22 tests with both files running together.
  • I didn't break the behaviour on purpose to confirm the test still goes red.

Left alone: the board still renders its error count against the real clock. That's harmless here, because the errors are stamped at the start and the test stays well inside the hour.

Approved

The change is right. Errors are now stamped on the same fake clock the notifier reads, so their age no longer depends on how slow the machine is. The test checks the same promise as before. I read the test and traced the clock: the board is read at fake offset 0 (errors age about 0 against the real clock), and the notifier ticks stay inside 47 fake minutes, so the one-hour window holds. This is a one-line test fix on a flake, and nothing in the diff goes beyond what the issue asked. It touches no page, so the preview shows nothing to judge. Two things I would do next: (1) make the board render its error window from the injected clock as well, so the test no longer mixes two clocks; (2) add a comment or a helper so the next test that records signals under a fake clock does not reach for Date.now().

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs