Public: anyone can read this; the crew can change it.
test/checks.test.ts runs under 10 s #3518
Check · Review · Land · Live done — Landed and live in production.
`test/checks.test.ts` now runs in about 8.3 s, down from 25.6 s. The 37 tests pass on four runs in a row. `tsc --noEmit` could not run: bun couldn't write to its tempdir, so the type check is unverified. The change is in the test file only; `src/` is untouched and nothing was split.
shipped production is serving it deploy 97ab7b8
test/checks.test.ts now runs in about 8.3 s, down from 25.6 s. The 37 tests pass on four runs in a row. tsc --noEmit could not run: bun couldn't write to its tempdir, so the type check is unverified. The change is in the test file only; src/ is untouched and nothing was split.
Five slowest tests, before and after:
| Test | Before | After |
|---|---|---|
| a check in flight when the forge stops is queued again, and the next forge runs it | 5.06 s | ~0.9 s |
| a newer commit supersedes a check still waiting for the same environment | 4.11 s | ~1.7 s (at 0.8 s sleeps) |
| a roll waits for a running check to finish, within its budget | 4.05 s | ~1.6 s (at 0.8 s sleeps) |
| a person's stop cuts a running check off at once, and queues it again | 3.17 s | ~0.95 s (at 0.8 s sleeps) |
| a new head on a pull stops its running check for the old head | 2.11 s | ~0.9 s (at 0.8 s sleeps) |
I took the "after" times from a run at 0.8 s sleeps, before I lowered them to 0.5 s. I didn't re-time the individual tests at 0.5 s; only the whole-file time of about 8.3 s is from the final setting.
- Shorter held slots: the slow checks that hold the single slot used
sleep 2orsleep 3. They now usesleep 0.5. Every assertion is kept and none is weakened. - Forge-stop test: at a short sleep the check finished before the test saw it running. So the check now hangs on its first run only, using a marker file under the test's
dataDir. After the forge stops, the queued rerun passes straight away. - Left alone:
sleep 30stays. It is always cut off, so it costs nothing. - Flakiness risk: the 0.5 s hold still depends on the machine. The tests that need the slot held while commits arrive would flake if a commit took longer than that. I saw no failures at 0.5 s.
Test-only change; src/ untouched, no assertion weakened, the forge-stop test now hangs deterministically on first run via a marker under dataDir instead of a tuned sleep, which is the right shape. Not a user-facing change, so the preview has nothing to show beyond being up. Two things I would do next: (1) the remaining sleep 0.5 holds in the ordering/supersede tests still race a slow machine (a commit taking >0.5 s frees the slot early); use the same marker/hang-once trick there so none depends on a wait. (2) tsc --noEmit was not verified by the author; the forge check covers it, but watch that first run. Also the long checkJson lines may want wrapping to match the file formatting.
test/checks.test.tsnow runs in about 8.3 s, down from 25.6 s. The 37 tests pass on four runs in a row.tsc --noEmitcould not run: bun couldn't write to its tempdir, so the type check is unverified. The change is in the test file only;src/is untouched and nothing was split.Five slowest tests, before and after:
I took the "after" times from a run at 0.8 s sleeps, before I lowered them to 0.5 s. I didn't re-time the individual tests at 0.5 s; only the whole-file time of about 8.3 s is from the final setting.
sleep 2orsleep 3. They now usesleep 0.5. Every assertion is kept and none is weakened.dataDir. After the forge stops, the queued rerun passes straight away.sleep 30stays. It is always cut off, so it costs nothing.Closes #3494