T-020: Publish a run and open it in the browser
Goal
Evan opens a link on his phone or laptop and is inside a world that has already lived through many generations on the Mac mini.
Scope
scripts/publish-run.sh runs/NAME: uploads a thinned run to the site and prints its link.- The web viewer opens a published run by link, loads the latest checkpoint, and keeps simulating locally.
- A page listing published runs with date, age in generations and a thumbnail.
- Works within Cloudflare Pages limits, or uses R2 if files are too large. Free tier only. Ask the orchestrator before anything that costs money.
Done when
- ☐ A run of at least 100,000 steps made by
runneris published and opens from its link in headless Chrome. Screenshot indocs/media/T-020/.
Added 2026-12-02: what already exists (from T-012 and T-014)
runner pack DIR --checkpoints lastwrites one file holding a thinned run, andrunner info DIRsummarises a run. Seedocs/RUNS.md. Build on these.- The web viewer already opens a checkpoint by link (
?checkpoint=URL), by dropping a file and by its Open button, shows load errors on the page, and keeps simulating. Seedocs/VIEWER.md, "The live world (T-014)". - Worlds with real bodies do not exist yet. Until they do, test with soup runs
(
runner run --soup ...), and make nothing depend on the soup. - "Age in generations" needs the lineage log (T-019), which is not written. Show what a run folder can tell you today, and leave an obvious place for generations.
- On the web the world steps on the page's only thread: 100,000 cells run a little under real time on a desktop, and a phone manages far fewer (T-059). Say on the page when a world is too big for the device rather than letting it crawl.
- Check every page in both browser engines:
node scripts/webfps.mjsandscripts/webkit-probe.sh.
Result
Done on branch t-020-publish-runs. Checked on previews only; nothing is on the production
sites yet.
What works
scripts/publish-run.sh runs/NAMEexports the newest checkpoint (or--checkpoints N), renders a thumbnail with the native viewer, keeps a copy of the web viewer that reads the checkpoint's format, rebuilds the runs site and deploys it, then prints the linkhttps://alife-kz9.pages.dev/?run=NAME. Also--remove NAME,--list,--preview,--branch B,--no-thumbnail,--no-deploy,--forget NAME.- The runs site is a second Pages project,
alife-runs(alife-runs.pages.dev). It holds the list page (picture, step reached, simulated time, cells, organisms, how the run started, download size, organisms over the run, a hint above 20,000 cells, links to earlier published states) plusindex.json, the runs and the kept viewer builds. Plain Pages, free plan. No R2, no Functions. runner exportwrites the web form of a run. It loads every checkpoint first and splits files over 20 MiB into parts.runner formatprints the checkpoint format of a file or of the build.build-web.shwrites that format intobuild.json.- The viewer's
?run=NAMEreadsrun.json, checks the format against its own build, downloads the parts in parallel with progress, opens the world and keeps stepping. If it cannot read the format, it sends the browser to the kept build. Missing runs and failed downloads show an error with a link to the list. There is a Runs button beside Log. - Too big for the device: the page measures it and says so once, and the notice stays until tapped. Automatic quality no longer lowers the picture when the cost is the sim, not the drawing.
- How a run stays openable next week: the decision is written up in
docs/RUNS.md, "Decision: how a published run stays openable next week", with a pointer indocs/ARCHITECTURE.mdsection 9.
Verified (previews t-020.alife-kz9.pages.dev and t-020.alife-runs.pages.dev)
| Check | Chrome | WebKit (iPhone 14 profile) | Phone stand-in (390×844 at 3×) |
|---|---|---|---|
soup-20k: 20,000 cells, 100,000 steps by runner | step 100,442 after 15 s, 60 fps, 30 steps/s | drawing, 60 fps, 30 steps/s | 60 fps, 29 steps/s |
soup-1m: 65 MB in 4 parts | opens, 5–7 steps/s, notice shown, quality kept | opens, 6 steps/s, notice shown, quality kept | — |
soup-100k with 4× CPU throttle | — | — | notice: "12 steps a second, about 1/3" |
| Run saved in another format (test fixture) | redirected to /v/<id>/ and runs there | same | — |
?run=no-such-run | error and link | same | same |
| Runs list | loads | loads, no errors | loads |
Slow-GPU stand-in (--software), no run | auto quality still steps down to level 6 | — | — |
cargo fmt, cargo clippy -p runner -p viewer --all-targets -- -D warnings and
cargo test -p runner -p viewer pass. That includes a new test
exported_parts_join_into_the_checkpoint, which checks that the parts join byte for byte
and that run.json has no local paths. The publish guard was tried: with a live run missing
from the store, the deploy was refused, and --forget let it through. Screenshots are in
docs/media/T-020/.
Found and fixed along the way
- The live viewer's wasm named this machine's home folder about 800 times (cargo registry
paths in panic messages).
build-web.shnow remaps those paths and refuses to finish if any remain. The production viewer still has them until the next production deploy. - Pages answers missing paths with 200 and the home page unless the site has a
404.html. The runs site now has one, so a missing run is a real 404. - Automatic quality took a million-cell world down to a 65×111 canvas, because slow stepping looked like slow drawing. It now holds its level when the main thread is the bottleneck and stepping takes most of it.
Not done, or worse than hoped
- Nothing is published to production. The orchestrator's steps after merge are in the report. Until the first production publish, alife-runs.pages.dev answers 522 and the viewer's new Runs button leads there.
- The store (
~/.alife/runs-site) is the only full copy of the published runs. Losing it stops publishing until the runs are restored or forgotten on purpose. The guard prevents silent loss; it does not back anything up. - Kept viewer builds are frozen: they keep that day's page and renderer, including later- fixed bugs, and about 35 MB each (9 files). There is one per format ever published.
- Generations show "not recorded yet" until T-019.
- The size hints on the list (20,000 and 100,000 cells) come from desktop measurements and a guess for phones. The viewer's own measurement is the real check. No real phone was tried.