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

sweepSoon starts its sweep on the next turn of the loop, so "sweeping a check… #17327

opened this in answer to

Merged 32h 28m ago, live in production

sweepSoon now starts its sweep on the next turn of the loop. Nothing of it runs in the caller's turn any more, not even the directory listing, so the test's check on the home can no longer race the thread pool.

Notes

opened this

sweepSoon now starts its sweep on the next turn of the loop. Nothing of it runs in the caller's turn any more, not even the directory listing, so the test's check on the home can no longer race the thread pool.

  • Fix: src/checks/sweep.ts gains a small nextTurn helper, a setImmediate promise, and sweepSoon waits on it before calling sweepCheckouts. sweepCheckouts and reclaimIfFull are unchanged. This is the code from the issue, so I reused it as given rather than checking scripts/similar.ts.
  • Test: "sweeping a checkout hands the loop back before it finishes (#7688)" in test/checks-home-sweep.test.ts now makes the home after the sweepSoon call. It would fail on main every time, and passes with the fix.
  • Checked here: bun x tsc --noEmit is clean. checks-home-sweep, checks-restart and checks-disk-red pass (32 tests, 0 failures). The "abandoned-checks timer" test, which has the same race, is in checks-home-sweep and passes.
  • Not checked here: I did not run the three consecutive pull checks the issue asks for.
  • Gate: gate.ts --fix left nothing to commit. It notes one comment line over 100 columns in the test file, which the nightly rewrap handles on main.
  • Left out: no limit, timeout or retry changes. There is no terminal-side or docs/features/ change, since no page, action, route or tool changed. The commit line says No door: internal timing of a background sweep, no page, action, route or tool changes.

Nothing to review on a page.

Closes #17281

commented

sweepSoon now starts its sweep on the next turn of the loop. Nothing of it runs in the caller's turn any more, not even the directory listing, so the test's check on the home can no longer race the thread pool.

  • Fix: src/checks/sweep.ts gains a small nextTurn helper, a setImmediate promise, and sweepSoon waits on it before calling sweepCheckouts. sweepCheckouts and reclaimIfFull are unchanged. This is the code from the issue, so I reused it as given rather than checking scripts/similar.ts.
  • Test: "sweeping a checkout hands the loop back before it finishes (#7688)" in test/checks-home-sweep.test.ts now makes the home after the sweepSoon call. It would fail on main every time, and passes with the fix.
  • Checked here: bun x tsc --noEmit is clean. checks-home-sweep, checks-restart and checks-disk-red pass (32 tests, 0 failures). The "abandoned-checks timer" test, which has the same race, is in checks-home-sweep and passes.
  • Not checked here: I did not run the three consecutive pull checks the issue asks for.
  • Gate: gate.ts --fix left nothing to commit. It notes one comment line over 100 columns in the test file, which the nightly rewrap handles on main.
  • Left out: no limit, timeout or retry changes. There is no terminal-side or docs/features/ change, since no page, action, route or tool changed. The commit line says No door: internal timing of a background sweep, no page, action, route or tool changes.

Nothing to review on a page.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs