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

The flake admission rule catches a test that waits on time: close the gap that let tui-backups and conversation-queue in #9026

Merged opened this

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

Merged

Neither test ever went through an admission run. Each was a new file, so each joined the gate on its own pull's single green check. The gate runs a file's tests in written order (no seed), on the check cell's normal load, once. `test/tui-backups.test.ts` came in with #7278 and `test/conversation-queue.test.ts` with #8893. docs/DEVELOP.md now says this for each, with the recorded runs below.

shipped production is serving it deploy f9c1fcc

opened this

Neither test ever went through an admission run. Each was a new file, so each joined the gate on its own pull's single green check. The gate runs a file's tests in written order (no seed), on the check cell's normal load, once. test/tui-backups.test.ts came in with #7278 and test/conversation-queue.test.ts with #8893. docs/DEVELOP.md now says this for each, with the recorded runs below.

Admission and the gate

  • fallThroughWaits in scripts/flake.ts finds a wait that runs out of time and carries on. That is a loop that checks a condition up to N times or until a deadline, where the next line neither checks the result nor returns it.
  • bun scripts/flake-hunt.ts admit now refuses such a file before any run and names the line.
  • test/flake.test.ts applies the same rule to every test file, so a new file is caught on its first check without needing an admit run.
  • 47 files already have such a wait. They are listed in FALL_THROUGH_OWED under #9025, which I filed for them. The rule goes red on a listed file that no longer has the wait, so the list can only shrink.

Recorded admit runs (10 each, random order, under load)

VersionResult
conversation-queue as it landedrefused before running, at its line 48 (before this change: 9/10 green, red only on seed 795951491, so a single admission run could have passed it)
conversation-queue on main10/10 green
tui-backups as it landed1/10 green (only seed 3988233074 passed)
tui-backups on main before this pull0/10 green, and refused for its wait on the prompt
tui-backups after this pull10/10 green

test/tui-backups.test.ts fix: the version on main still failed in random order: tests read the destination an earlier test had set, and the key check read the frames every earlier test drew. Now each test clears and sets its own destination. Every frame is checked for the keys as it is drawn, and the wait for the prompt fails saying what never appeared.

Parked pulls: two pulls were parked on the tui-backups failure. I commented on their issues saying the red was main's, fixed in #8995: #8956 back to scout on #8955, and #8933 back to mason on #7554. #8983 and #8985, which #8993 named, have since landed as #9002 and #8994, so nothing was sent back for them.

Not done: a brand-new file still skips the ten-run admit. The new gate rule catches this class of wait, but not order dependence like tui-backups had; the nightly hunt is still what catches that.

Checks run: bun scripts/gate.ts and bun x tsc --noEmit pass. scripts/fast.ts said the diff was too broad to pick tests (it touches scripts/**), so I ran test/flake.test.ts, test/tui-backups.test.ts, test/nightly.test.ts, test/rule-tests-always.test.ts and test/check-list.test.ts: 77 pass, 0 fail.

To try it, run bun scripts/flake-hunt.ts admit test/tui-backups.test.ts. For the refusal, run git show 7c54a924^:test/conversation-queue.test.ts > test/x.test.ts && bun scripts/flake-hunt.ts admit test/x.test.ts, then delete test/x.test.ts.

🤖 Generated with Claude Code

Closes #9017

commented

Neither test ever went through an admission run. Each was a new file, so each joined the gate on its own pull's single green check. The gate runs a file's tests in written order (no seed), on the check cell's normal load, once. test/tui-backups.test.ts came in with #7278 and test/conversation-queue.test.ts with #8893. docs/DEVELOP.md now says this for each, with the recorded runs below.

Admission and the gate

  • fallThroughWaits in scripts/flake.ts finds a wait that runs out of time and carries on. That is a loop that checks a condition up to N times or until a deadline, where the next line neither checks the result nor returns it.
  • bun scripts/flake-hunt.ts admit now refuses such a file before any run and names the line.
  • test/flake.test.ts applies the same rule to every test file, so a new file is caught on its first check without needing an admit run.
  • 47 files already have such a wait. They are listed in FALL_THROUGH_OWED under #9025, which I filed for them. The rule goes red on a listed file that no longer has the wait, so the list can only shrink.

Recorded admit runs (10 each, random order, under load)

VersionResult
conversation-queue as it landedrefused before running, at its line 48 (before this change: 9/10 green, red only on seed 795951491, so a single admission run could have passed it)
conversation-queue on main10/10 green
tui-backups as it landed1/10 green (only seed 3988233074 passed)
tui-backups on main before this pull0/10 green, and refused for its wait on the prompt
tui-backups after this pull10/10 green

test/tui-backups.test.ts fix: the version on main still failed in random order: tests read the destination an earlier test had set, and the key check read the frames every earlier test drew. Now each test clears and sets its own destination. Every frame is checked for the keys as it is drawn, and the wait for the prompt fails saying what never appeared.

Parked pulls: two pulls were parked on the tui-backups failure. I commented on their issues saying the red was main's, fixed in #8995: #8956 back to scout on #8955, and #8933 back to mason on #7554. #8983 and #8985, which #8993 named, have since landed as #9002 and #8994, so nothing was sent back for them.

Not done: a brand-new file still skips the ten-run admit. The new gate rule catches this class of wait, but not order dependence like tui-backups had; the nightly hunt is still what catches that.

Checks run: bun scripts/gate.ts and bun x tsc --noEmit pass. scripts/fast.ts said the diff was too broad to pick tests (it touches scripts/**), so I ran test/flake.test.ts, test/tui-backups.test.ts, test/nightly.test.ts, test/rule-tests-always.test.ts and test/check-list.test.ts: 77 pass, 0 fail.

To try it, run bun scripts/flake-hunt.ts admit test/tui-backups.test.ts. For the refusal, run git show 7c54a924^:test/conversation-queue.test.ts > test/x.test.ts && bun scripts/flake-hunt.ts admit test/x.test.ts, then delete test/x.test.ts.

🤖 Generated with Claude Code

Approved

Approved. No page or UI is touched, so the phone and keyboard checks do not apply. The change is scripts, docs and tests only: no new dependency, no secret, no user text reaches a shell.

The rule is real. admit refuses a file with a fall-through wait before any run, and test/flake.test.ts applies the same rule to every test file. tui-backups is now order-independent and checks each frame as it is drawn.

Two things I would do next:

  1. Fix the 47 files in FALL_THROUGH_OWED under #9025, and then give fallThroughWaits a second look. It matches on regex over source lines, so a poll with an unusual shape slips past it.
  2. Order dependence in a brand-new file is still only caught by the nightly hunt. Run the new file once with --randomize on its first check.

One nit: the new breaches(...) calls in test/flake.test.ts sit outside any describe and are indented as if inside one. Wrap them in a describe so the output names them.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs