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

The test runner stops killing healthy shards, and each test file is isolated #7817

opened this

Merged 31d 0h ago, live in production

I merged main into this branch and pushed it. The conflict was only in scripts/test-shards.ts. The tests I ran pass, and bun x tsc --noEmit and bun scripts/gate.ts are clean.

Notes

opened this

I merged main into this branch and pushed it. The conflict was only in scripts/test-shards.ts. The tests I ran pass, and bun x tsc --noEmit and bun scripts/gate.ts are clean. I did not run the full suite: scripts/fast.ts could not name tests because forge.json changed, so I ran the six shard-related test files, and the forge's check runs everything on this push.

  • First conflict: main added a lone re-run of a red file under --keep-going; this branch added the one-time re-run of a shard that crashed outside any test. Both stay. If the crash re-run happens, its quoted note is kept at the top of the output.
  • Second conflict: main stops the remaining shards when one goes red on non-budget tests, or when it is not a verification after landing. That is the behaviour #7788 removes, so I dropped it and every shard runs to the end.
  • One test changed: test/shards-keep-going.test.ts expected "fail-fast" in the output when --keep-going is not passed. I rewrote it to match the new behaviour. Without --keep-going, all three shards still run and the exit code is still 1. There is no "fail-fast" line and no lone re-run, and no .impact.json map is written.

Continues #7817

2 earlier comments
commented

I merged main into this branch and pushed it. The conflict was only in scripts/test-shards.ts. The tests I ran pass, and bun x tsc --noEmit and bun scripts/gate.ts are clean. I did not run the full suite: scripts/fast.ts could not name tests because forge.json changed, so I ran the six shard-related test files, and the forge's check runs everything on this push.

  • First conflict: main added a lone re-run of a red file under --keep-going; this branch added the one-time re-run of a shard that crashed outside any test. Both stay. If the crash re-run happens, its quoted note is kept at the top of the output.
  • Second conflict: main stops the remaining shards when one goes red on non-budget tests, or when it is not a verification after landing. That is the behaviour #7788 removes, so I dropped it and every shard runs to the end.
  • One test changed: test/shards-keep-going.test.ts expected "fail-fast" in the output when --keep-going is not passed. I rewrote it to match the new behaviour. Without --keep-going, all three shards still run and the exit code is still 1. There is no "fail-fast" line and no lone re-run, and no .impact.json map is written.
commented

Both review points are fixed and pushed. The shard tests, the keep-going, flake and budget-retry tests, tsc and the gate all pass locally. The forge's full check hasn't run on this push yet.

1. Serial runs now quote the crashed run.

  • Buffering the whole first run broke an existing test (one shard at a time: a line is written when the test says it), so I did something narrower. A width-1 first run streams until its first sign of a red: (fail), # Unhandled error or error:. From there it holds the output until the run ends.
  • If the run crashed outside any test, the held output is quoted behind │ and the shard re-runs. Otherwise the held output is flushed unchanged. A green run streams in full.
  • The new single-worker test (FORGE_CHECK_SHARDS=1) checks that no line outside the quote contains # Unhandled error or "Cannot use a closed database", and that the exit code is 0.

2. The CRASH_RERUNS cap is tested. Four shards that crash at load give exactly three "re-running it once" lines and exit code 1. Writing it showed a real bug in my first fix for point 1: the cap was checked before the first run, so all four shards re-ran. It is now checked after the run, and the test fails without that. I also reflowed the shard-crash-once.test.ts header.

Cost of removing fail-fast. I haven't measured it, so I won't quote a number. A red shard no longer cuts the run short, so a red gate now takes the full suite's wall time instead of stopping at the first red. I think that is acceptable for two reasons:

  • A red gate is the rare case. The gain is that a healthy shard is no longer killed, and its result is no longer lost to a re-run of the whole check.
  • The gate-on-impact work cuts the files that run at all, which shrinks the cost of a full run.

I'd rather you set that wall-time figure from the forge's check timings than from a guess of mine.

commented

I merged main into the branch, resolved the six conflicts and pushed. The gate and tsc are clean. test/shards.test.ts, test/shards-keep-going.test.ts and test/gate-summary.test.ts pass, 98 tests. I did not run the full suite; the forge's check does that on push.

  • Budget-retry files: main deleted src/checks/budget_retry.ts, test/budget-retry.test.ts and docs/features/gate-budget-retry.md in #7822. I kept them deleted, so the budget-retry changes this branch had made to those files are gone.
  • Fail-fast: main brought back a fail-fast stop (stopsTheRest, halted, and killing in-flight children), which is what #7788 removes. I dropped it. Every shard still runs to the end, and a crash outside any test is re-run once, up to CRASH_RERUNS.
  • Budget files: I kept main's budgetLast and callsBudget. Files that call expectBudget run last, one at a time.
  • Test changed: the test "a red shard skips the budget files" asserted the fail-fast behaviour. It now asserts the opposite: a red shard does not skip them, and the log has no fail-fast line.
  • Bug fix: the second pool (the budget files) left holes in the results array, so tally threw "undefined is not an object" once fail-fast no longer cut the run short. Each pool now returns a compact list.

The #7788 spike (--isolate, --parallel, --changed) is not part of this merge.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs