village-builder

VB-193: Late-game fixtures, kept on the fixtures branch

Status: 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:

Implementation notes (5 November 2026):

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).