fixtures branchStatus: done
Priority: 1
Size: M
Arch: yardstick
Phase: implement
Design ref: none (measurement). docs/roadmap.md, sections 5.2 (the late reference, Decided, Kim, 3 November) and 6 (late fixtures).
Goal: The late game’s costs do not show at year 2, where tests/perf.js looks. Measured for the plan on 3 November (populous small at seed 7, this repository’s container): the moving round takes 485 ms in one call at year 40 and 897 ms in its place in year 41, against 37 ms at year 5; 13 of 30 midnights take over 50 ms at year 40, against 2 at year 5; and the save is 29 MB of JSON. Reaching year 40 takes 270 s, and year 60 on a medium map perhaps 90 minutes (estimated from 190 ms a game day at year 2). Saves made once and loaded in under a second give every check a late state. In the session that ran VB-181 (3 November) it was chosen to keep them on an orphan branch, fixtures, so main’s history stays small though they are remade after most behaviour changes.
Acceptance criteria:
tools/fixtures.js knows four fixtures, all populous at seed 7: small-y5, small-y40, medium-y5 and medium-y60 (the late reference, about 1,000 living). Each is a gzipped save (Sim.save) in tests/fixtures/ (gitignored), with a stamp <name>.json beside it: the commit it was made at, the save’s format, the SHA-256 of tests/golden.json, its year, living pawns, pawn records and events in st.record, and the minutes it took to make.make [name...] builds the named fixtures (all by default), one per core in parallel;status prints each fixture as missing, fresh, or stale (its golden hash or format differs from the working tree’s);fetch gets them from origin/fixtures (git fetch origin fixtures, then git show per file), and does nothing, with a notice, without a network;publish replaces the branch with one orphan commit holding the four saves and their stamps, and pushes it with --force-with-lease. This is the only force-push the project makes: the branch keeps no history by design, and BACKLOG.md’s header says so.tests/lib/fixtures.js exports loadFixture(name) → {st, stamp, stale} or null when there is none, fetching first if it is missing. It generates the world from the save’s seed and size and loads the state, so later checks need no copy of this code.tests/fixtures.js in npm run verify: each fixture present loads, advances one game day and passes checkState (tests/lib/invariants.js); a missing fixture without a network is skipped with a notice, not a failure; a fixture whose format differs from the build’s fails with “remake the fixtures”.npm run nightly (tools/nightly.js) fetches the fixtures, remakes the stale and missing ones in the background, publishes them, and prints what it did. Later tasks add their steps to it (VB-194’s bench, VB-163’s full bands). BACKLOG.md’s header says the nightly run starts with it. If medium-y60 takes over 2 hours to make, the PR says so and proposes how often to remake it.HEAD in this file: per fixture, the minutes to make, MB of JSON and gzipped, living, pawn records and events in the record.AGENTS.md, Commands: the fixture commands, and that a check or a task needing a late state uses loadFixture.ready, and VB-088 if VB-192 is done too.
Cost: about 6 MB of disk per small fixture and an estimated 15 to 20 MB for medium-y60, gzipped; making all four takes an estimated 90 to 100 minutes on one core per fixture, nightly and only when stale.
Notes:Implementation notes (5 November 2026):
VB.gen, Sim.seed/advance/save/load, sim/saves.FORMAT,
tests/golden.json and Git provenance; writes ignored fixture files and their stamps. No simulation or page state fields,
owners, commands, rules, counters or runtime dependencies are added. Simulation goldens and work-counter baselines stay unchanged.tests/lib/fixtures.js owns the four definitions, freshness, checksums, fetch and load. tools/fixtures.js supplies bounded worker
processes and publication through Git objects, with no checkout or index operations. Publication targets only refs/heads/fixtures,
uses no parent for its commit, and leases the exact remote head (including an absent branch).tests/fixture-tools.js uses an isolated local bare remote for freshness, missing/offline handling, damaged saves,
incompatible formats, replacement orphan commits, a competing publisher, and preservation of an uncommitted worktree and index.make refuses uncommitted simulation source/golden changes so the stamp’s commit identifies the simulation actually used.Measurement context: Node 24.22.1, Linux, two-CPU quota. The elapsed make times include concurrent verification and browser
work, plus a short pause while isolating the browser failure; they are wall times for this batch, not dedicated performance benchmarks.
Sizes below are decimal MB; the simulation state and baselines are unchanged from 4df5766.
Measured at simulation commit 4df5766 (the pulled HEAD; this task changes no simulation source):
| Fixture | Minutes to make | JSON MB | Gzip MB | Living | Pawn records | Events |
|---|---|---|---|---|---|---|
| small-y5 | 1.15 | 7.22 | 1.39 | 388 | 430 | 13652 |
| small-y40 | 15.74 | 30.48 | 5.46 | 725 | 1274 | 110278 |
| medium-y5 | 3.77 | 18.21 | 3.63 | 880 | 975 | 32698 |
| medium-y60 | 59.24 | 133.62 | 23.94 | 2492 | 4814 | 505530 |
The medium fixture took 59.24 minutes in this shared run, below the two-hour review threshold. It contains 2,492 living pawns, not the roadmap’s rough 1,000-pawn reference; the population is reported as generated, with no cap or tuning. Its 23.94 MB gzip exceeds the roadmap’s 10 MB save budget. These are measurements for the later budget and bounded-history tasks, not a change to their targets. The stamp keeps the exact counts and sizes.
Verification: npm test passed all 64 scripts (285.8 s). The final full suite, with the real browsers run individually, passed
all 75 scripts (615.6 s), including unchanged golden states, counters, save/load continuity and five invariant runs. Chromium
was installed in ignored work/ms-playwright; the command was PLAYWRIGHT_BROWSERS_PATH=$PWD/work/ms-playwright npm run verify.
After the fourth fixture completed, node tests/fixtures.js loaded all four, advanced each one day and passed checkState (4/4,
none missing). Build and whitespace checks pass.
Published by the successful npm run nightly fresh-cache path: all fixtures were fresh, no simulation was repeated, and the
branch was created as orphan commit 4ee11e9b70d03450a7aea740e3eee1291cffa388. The default fixture directory was then moved aside
and node tools/fixtures.js fetch repopulated it from the remote branch. All eight files are byte-identical to the generated
originals; all four fetched states again loaded, advanced one day and passed invariants. The fetched commit has no parents and
its tree contains only the four saves and four stamps. No generated save is tracked on the source branch.
Done 5 November 2026. VB-088, VB-194, VB-196 and VB-198 are ready (VB-192 is already done).