How we ship
Checks before a deploy, switches to turn things off, and rollback.
Updates ship often, some days several times. Running games are never cut off for one.
Before a deploy
- A deploy from GitHub runs the type checks and a quick set of smoke tests first, and is tagged with its commit, so the status page shows exactly what's live.
- A big batch comes with a test list for the owner: where to go, what to do, what you should see.
- Changes to how the game feels run the lag, smoothness and benchmark tests from How we test.
The deploy
The safe deploy checks who is playing, warns players ahead (15 minutes by default), deploys, then checks the site answers on the new build. Games already running finish on the old code; new games start on the new code. More: Data and saving.
The deploy chain
On busy days patches come from several workers at once, each cut in its own worktree against the main of the moment. Each deploy:
- Stages a fresh worktree at the newest main and applies its patches with
git apply --3way. A conflict stops the stage and names the patch and its files; the patch goes back to its worker to cut again. - Runs both type checks side by side, warm from the last good check, then every test the patches name and the default tests the change can reach. A default test runs when a changed file is among its inputs (its imports, the processes it starts, the files it reads), and always when those can't be read. Up to 3 tests run at once. A failure gets one retry, and a pass on the retry is reported as flaky.
- Runs the feel gate (
scripts/feel-gate.mjs): a quick feel audit against the saved full report. After a deploy that changes the simulation, the full report is made again on the deployed commit. - Runs the browser tests, each on a fresh API server and database. A script names the environment it needs in a
// e2e-env: first line; tests that open the database take its file as an argument in their own order; a lock keeps two chains off the same ports, and each waits for the last server to free its port. Tests wait for what they check, not for the network to go idle (the idle prefetch keeps it busy). - Deploys only the Workers the change is built into (helpers, game and forum side by side, then the site) and pushes, only if every step above passed. A failing browser test refuses the ship. A deploy of docs alone skips the type checks, the deploy and the smoke. The smoke opens five pages as soon as the live site serves the new build.
- Rolls each Dedicated server to the same commit (
npm run deploy:rooms): the new process starts at a low CPU share beside the old one, which keeps rooms with people until their game ends.
Deploys pause while players are on: each one restarts the Worker and hands rooms off at their next calm moment. More: Forty deploys in a day and Deploys: only tests a change can reach.
Switches
64 features have an on and off switch in the code. A new feature goes live by turning its switch on, and goes back by turning it off. The WebAssembly physics went live this way.
Rollback
Going back to an earlier version takes about 5 to 10 seconds, then the site is checked. The code and the site's files go back together. Any of the last 100 versions can come back.