Deploys: only tests a change can reach
19 to 20 Nov 2026
- A default test now runs only when a changed file is among its inputs. Replayed on 60 past deploys, the chain would have run 91 of the 146 default tests they ran.
- Staging a one-line change to a page took 18.2 minutes on the old chain and 27 s on the new one, on a busy machine.
- Tests run up to 3 at a time. 11 engine tests took 3.7 minutes two at a time at load 47, against 12.4 minutes one at a time on the old chain at load 42 to 61.
- The smoke after a ship went from about 41 s to about 15 s, and a docs-only deploy skips the type checks, the build and the deploy, about 1 minute each.
- A change to the Rust engine still stages in about 22 minutes, because the two browser modules take 13.6 minutes to build.
A deploy now waits only for the tests its change can affect. A page fix reaches the live site in about 1.5 minutes plus any wait for a stage slot, and a test the change cannot reach no longer fails it on a busy machine.
Timings here come from one shared 16-core Mac at a 1-minute load of 33 to 61, so they are rough comparisons. This follows Forty deploys in a day; the current chain is in How we ship.
What was slow
Over the last 60 shipped deploys, queue to live took 7.1 minutes at the median and 16.2 at p90:
| Step | Deploys | p50 | p90 | Total |
|---|
| Browser tests (gate) | 26 | 3.4 min | 8.1 min | 116.4 min |
| Named tests (stage) | 60 | 44 s | 3.3 min | 94.2 min |
| Queue and stage slot | 60 | 6 s | 5.1 min | 92.1 min |
| Smoke: fixed wait, then pages | 60 | 16 s + 25 s | 18 s + 32 s | 44.0 min |
Deploys 934 to 1010. Load 33 to 45.
Every patch ran the same 15 default tests. Deploy 1000 changed three lines of the Play page and took 14.9 minutes, 12.7 of them in those tests run one after another, though 14 could not be affected by it.
Choosing tests by what a change can reach
A default test now runs only when a changed file is among its inputs, read from the staged tree: the files esbuild bundles from it (its metafile), the processes it starts and their imports, and the files it names at run time. A WebAssembly module’s inputs are the Rust sources its build script hashes.
When the reader cannot be sure (code it cannot follow, imports that do not bundle, a failure or timeout), the test runs. Package files, tsconfig, the chain or any .wasm run every default, and named tests always run.
Replayed on 60 past deploys, it would have run 91 of the 146 default tests they ran. Their only 3 default test failures were load flakes that passed on the retry. The selection still runs two of them, because their patches reach them, and skips deploy 1000’s replay-skip-test, which failed at load 40.7 on a change it does not import, start or read.
| One patch, stage only | Old chain | New chain |
|---|
| One line in the Play page | 18.2 min, 15 tests | 27 s, 1 test |
| One CSS rule | about 18 min, 15 tests | 12 s, 1 test |
Scratch queue, load 35 to 61. The 1 test is no-self-spawn-test, which always runs.
Tests side by side
Up to 3 tests run at once, 2 while the load is over 30 and 1 over 60. A test that starts processes or opens ports runs alone after the others. A failed test gets one retry, alone, after every first try, and a pass on the retry is recorded as flaky.
Eleven tests that start nothing took 3.7 minutes two at a time at load 47, against 12.4 minutes one at a time at load 42 to 61 on the old chain.
The fixed costs
- The two type checks run side by side, warm from the last good check’s incremental files. They took 16.8 s and 4.7 s cold and 4.7 s and 0.4 s warm, against 27 s and 5 s one after the other.
- The smoke waited a fixed 15 s and opened five pages in turn. It now starts when the live site serves the new build and opens the pages in five tabs. Its median fell from about 41 s to about 15 s.
- The helpers, game and forum Workers deploy side by side before the site, saving about 10 to 20 s when two or more are built.
- A docs-only deploy skips the type checks, the Rust modules, the deploy and the smoke, which saves about 1 minute.
- Rust check builds use a fast profile that plays byte-identically to the release build. A one-line change rebuilds in 3.8 s instead of 209 s.
What is still slow, and why
Staging one comment in server-rs took 22.0 minutes. 13.6 of them built the two browser modules (bot brain 4.9, room 8.7), because their sources changed, and 8.3 ran the 14 default tests the change reached. A module whose sources did not change comes from a cache in 0.1 s.
What went wrong on the way
- replay-skip-test played six 20 s games on the real clock and took about 100 s. It failed one deploy three times at load 65 to 70, because a turn of its frame loop took up to a second. It now runs on the feel audit’s virtual clock in 8 to 11 s.
- Only the deploy built the browser’s Rust modules, so the Rust room tests failed in a fresh tree. The stage now builds them before the tests, and the gate builds them again when its rebase moves the tree.
- Five deploys blocked on browser tests that could not be pointed at the deploy’s own servers. Those scripts now take a base URL, and the chain refuses one it cannot run when it is queued.
- One smoke right after a ship got script chunks back as HTML and paused ships. The wait for the new build replaced the fixed 15 s.
- chain-test checked parallel runs with a stopwatch. Now the runs wait to meet each other, so load only slows the test.
- Fourteen engine packages each replayed their recorded games identically in both rooms, then failed as one batch, because one drew a random number that another already drew. A verifier that only checks replayed every set and caught it before any server rolled. Batches are now proven as a whole.