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

The spawn, boot, rehearsal and drill test files run under the test budget, by shape not deletion #12386

Merged opened this

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

Merged

This pull makes four of the seven slow files in #12381 run in less than half the time, mostly by cutting real waiting. No assertion is deleted. The three spawn-cell files are not changed: they need bwrap/socat and unix sockets, which my sandbox skips, so I couldn't time or check any change to them.

shipped production is serving it deploy 97489a2

opened this

This pull makes four of the seven slow files in #12381 run in less than half the time, mostly by cutting real waiting. No assertion is deleted. The three spawn-cell files are not changed: they need bwrap/socat and unix sockets, which my sandbox skips, so I couldn't time or check any change to them.

FileBefore → after (local, whole file)What changed
test/drill-400mb.test.ts52 s → 12.6 srunDrill gets an optional ticks clock (defaults to performance.now; added in src/snapshot/drill.ts). The throttled store now moves that clock forward by the wire time instead of sleeping through it. The phases still record the full wire time, so the "download takes at least the wire time" assertion still holds.
test/rehearsal-real.test.ts73 s → 29 sRehearsalArgs gets an optional settleMs: the requests stop that long after the old forge exits, with seconds as the upper limit. The test passes 1000 ms. Running scripts/rehearse-roll.ts by hand still behaves as before. Most of what is left is the time each real forge takes to boot (about 4.5 s).
test/boot-beside-peer.test.ts36 s → 16 sThe peer holds the lock for 10 s instead of 20 s, and the healthz probes stop a second after the peer exits rather than a fixed 20 s after the forge is up. A new assertion checks that at least one probe ran while the peer still held the lock, so a slow boot can't make the test pass without testing anything.
test/release-handover.test.ts36 s → 15 sThe in-flight push is sent over 8 s instead of 30 s. That still covers the new forge starting, the old one's drain starting and more than 100 health requests.

In scripts/gate.ts, only these four SLOW entries changed. Each reason now says what shrank it, the old gate-box time and an estimated new time per test. I worked out the new times from the local before/after ratio because I can't measure on the gate box. All four are still over the 2 s per-test budget, because they boot real processes or pack 400 MB, so they stay in the list. scripts/test-times.json has no entry for any of these files, so it is unchanged.

Not done:

  • The three spawn-cell files (spawn-small-cell, spawn-cell-e2e, spawn-cell) — #12381 stays open for them. One finding for whoever takes them: the run behind spawn-cell-e2e (test/helpers/real-spawn-e2e.ts) does exactly the first half of the recover run in spawn-small-cell. Moving e2e's four checks into the small-cell test would save a whole child spawn, but it needs a host that can run cells.
  • The issue plan and estimate tools (keep_plan, estimate) weren't available in this session, so the issue's plan wasn't updated and no estimate was recorded.

Checks run: bun scripts/gate.ts passes, bun x tsc --noEmit passes, and the four changed files plus test/gate*, test/drill* and test/rehearsal* all pass (142 tests). To try it: bun test test/drill-400mb.test.ts test/rehearsal-real.test.ts test/boot-beside-peer.test.ts test/release-handover.test.ts.

🤖 Generated with Claude Code

Closes #12381

1 earlier comment · 1 event
commented

This pull makes four of the seven slow files in #12381 run in less than half the time, mostly by cutting real waiting. No assertion is deleted. The three spawn-cell files are not changed: they need bwrap/socat and unix sockets, which my sandbox skips, so I couldn't time or check any change to them.

FileBefore → after (local, whole file)What changed
test/drill-400mb.test.ts52 s → 12.6 srunDrill gets an optional ticks clock (defaults to performance.now; added in src/snapshot/drill.ts). The throttled store now moves that clock forward by the wire time instead of sleeping through it. The phases still record the full wire time, so the "download takes at least the wire time" assertion still holds.
test/rehearsal-real.test.ts73 s → 29 sRehearsalArgs gets an optional settleMs: the requests stop that long after the old forge exits, with seconds as the upper limit. The test passes 1000 ms. Running scripts/rehearse-roll.ts by hand still behaves as before. Most of what is left is the time each real forge takes to boot (about 4.5 s).
test/boot-beside-peer.test.ts36 s → 16 sThe peer holds the lock for 10 s instead of 20 s, and the healthz probes stop a second after the peer exits rather than a fixed 20 s after the forge is up. A new assertion checks that at least one probe ran while the peer still held the lock, so a slow boot can't make the test pass without testing anything.
test/release-handover.test.ts36 s → 15 sThe in-flight push is sent over 8 s instead of 30 s. That still covers the new forge starting, the old one's drain starting and more than 100 health requests.

In scripts/gate.ts, only these four SLOW entries changed. Each reason now says what shrank it, the old gate-box time and an estimated new time per test. I worked out the new times from the local before/after ratio because I can't measure on the gate box. All four are still over the 2 s per-test budget, because they boot real processes or pack 400 MB, so they stay in the list. scripts/test-times.json has no entry for any of these files, so it is unchanged.

Not done:

  • The three spawn-cell files (spawn-small-cell, spawn-cell-e2e, spawn-cell) — #12381 stays open for them. One finding for whoever takes them: the run behind spawn-cell-e2e (test/helpers/real-spawn-e2e.ts) does exactly the first half of the recover run in spawn-small-cell. Moving e2e's four checks into the small-cell test would save a whole child spawn, but it needs a host that can run cells.
  • The issue plan and estimate tools (keep_plan, estimate) weren't available in this session, so the issue's plan wasn't updated and no estimate was recorded.

Checks run: bun scripts/gate.ts passes, bun x tsc --noEmit passes, and the four changed files plus test/gate*, test/drill* and test/rehearsal* all pass (142 tests). To try it: bun test test/drill-400mb.test.ts test/rehearsal-real.test.ts test/boot-beside-peer.test.ts test/release-handover.test.ts.

🤖 Generated with Claude Code

Approved

Approved. The four changes shorten real waiting without deleting assertions, and the new held > 0 probe in boot-beside-peer keeps that test honest. The ticks and settleMs seams are optional and default to the old behaviour. No user-facing surface changed. The work is only partly done: all seven boxes stay open. Next, two things. (1) Do the three spawn-cell files on a host that can run cells; scout found that spawn-cell-e2e repeats the first half of the recover run in spawn-small-cell, so merging them saves a child spawn. (2) Measure the four files on the gate box and put real numbers in the SLOW reasons in scripts/gate.ts. Those numbers are currently estimated from a local ratio. The four files are still over the per-test budget and stay on the SLOW list, so none of the boxes is met. Also, the comment at test/drill-400mb.test.ts:32 sits after the imports with no code it belongs to. Move it next to the ticks definition, which already says the same.

commented

Left #12381 open: 7 unticked items remain (test/spawn-small-cell.test.ts (33 s); test/spawn-cell-e2e.test.ts (25 s); test/spawn-cell.test.ts (22 s); …).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs