Part of AI_CHEATSHEET.md. Covers tests/ stub tests, devtools/simulation/headless/ and the after-game-update checklist. Split from dev_workflow.md.
Offline unittest suite for the production modules (production.py + production_*.py, storage.py, smelter.py, fabricator.py, supply_dock.py, site_supply.py, site_plan.py), no game needed. Run from repo root: python -m unittest discover -s tests (stdlib only).
tests/game_stubs.py: the one shared fake world (World): outposts (OutpostRef,.is_homebool,buildings(type_id)), home Inventory, Warehouses, Lead Casks, Smelters, Fabricators (recipes, input/output buffers,runningflag), Supply Docks and Earth Orders (ordersservice; nothing ships), Tanks and fluid ports, Batteries, Steam Turbines, power grids (power_control),run_control,fleet,computer(deploy/undeploy),comms, Drones, Pioneers, Drone Depots, Habitats, shop, journal, construction blueprints, notebook (transaction()), clock, console;add_building()places any other spec type. Port locality per docs:"inventory"connects at home only, a remote port reaches only its own outpost's storage ("not_local"otherwise). Nothing crafts by itself; a test sets buffers/stock/runningand calls a controller method.- Defaults (slot counts, capacities,
powerDraw, recipes,defaultData) come fromtests/game_spec.json, the committed extract of the decompiled game (devtools/game_update/extract_game_spec.py).tests/test_stub_contract.pychecks every fake's method names, parameter names and literalResultstatuses against that spec. - Extend
game_stubs, never add a private fake. A test needing more adds the method/state there (with contract-test coverage), or keeps a small local subclass for odd behaviour (class _Drone(Drone)).tests/test_no_private_fakes.pyfails on any test class named like agame_stubsclass (with or without leading_) that does not subclass it. tests/test_service_coverage.pyfails when code inscripts/orautoplay/requests a service (get_component("<literal>"), machine/outpost ids excluded) thatWorlddoes not fake; itsKNOWN_GAPSlists the accepted ones (transmitter, nocturna, research, ...) and must shrink when a fake lands.- After a game update (full list: §10c): rerun
python devtools/game_update/extract_game_spec.py(needs the decompiled simworker from the privateinternals/submodule), review thetests/game_spec.jsondiff for renamed methods, new statuses and changed defaults, then run the suite.
- Defaults (slot counts, capacities,
tests/harness.py: installsget_component/sleepbuiltins, puts every tier'slib/onsys.pathlike the sync resolver'slib_chain():TEST_TIER = 4down to 0 first, then higher tiers ascending, resets module state per test (archive.archive.notebook,storage._recent_busy,swallowdedupe, moduleTreeConsoles).StubTestCasefails any test during whichswallowed()reported a bug-class exception.- CPython is more permissive than the game's interpreter: a test passing does not prove an import or builtin exists in game. The game has no standard library; its module registry (decompiled simworker) holds exactly:
random,functools,re,dataclasses,enum,json,heapq,traceback,math,itertools,operator,string,collections(Counter,defaultdict,OrderedDict,deque,namedtuple); type-only (erased)typing,collections.abc,types,user_stubs; plusbuiltins/__builtins__and__future__. Notime,copy,os,sys.tests/test_game_imports.pyfails on any other import inscripts/outside our own lib modules (imports underif TYPE_CHECKING:are skipped); keep itsGAME_MODULESin step with this list. The same file also fails on a module-level import cycle between lib modules, built from the highest tier's copy of each (the stub tests loadTEST_TIER = 4copies and miss tier-5 cycles): in game a module re-entered mid-load is half-initialized, sofrom X import NAMEraisesImportErrorwhen NAME sits below X's imports.script_parkingtherefore importspowerinside_power_module(). Check builtins against the "Built-in Functions" section ofdocs/guide/builtins_and_commands.mdanddocs/guide/language_reference.md. tests/sample_world.py: seeded synthetic save for tests and profiling.build_sample_world(size)(SIZES:small/medium/large) gives home + remote outposts, Warehouses and Large Warehouses holding at most one item per slot (5 / 15), a tiered recipe tree (ore → ingot → alloy → part → component → kit, 20 smelter + 60 fabricator recipes), stocked Inventory, Smelters, Fabricators, home and remote Supply Docks, active orders, gas/liquid Tanks, Batteries, one power grid per outpost over its buildings, Drone Depots with docked Drones, Pioneers, Habitats ("large" counts of these follow a late-game live save).route_scenario(size)gives the dest/source dicts of the drone hauler and Pioneer route planners. Extend it (not a private copy) when a new test or profile needs more of the world;test_sample_world.pysmoke-tests every size.devtools/perf/step_profile.py: counts CPython opcodes of one lib code path on the sample world, total and per function (inclusive), with a steps/ticks estimate (OPCODES_PER_STEP = 2.5, scheduler share at--scripts, default 112). Stub andcopyframes are not counted. Work insiderun_atomic()is reported apart (calls, opcodes, largest single call) and counted as at most one tick per call;--direct-onlylists functions by the opcodes left outside atomic calls.--listshows the targets (fabricator,smelter,dock_plan,demands,haul,pull,wildlife_ration,wildlife_plan); add one per hot path worth tracking. Use it to compare code versions and to sizelib/atomic.pychunks by their worst case; the numbers are estimates, not game measurements (§1d-1,docs/BENCHMARK.md).devtools/perf/tick_profile.py: times lib functions in game ticks inside a headless run of a real save (§10b). It patches asave_scripts.pycopy: every top-level function of--modulesand every plain method of--classesis wrapped, and the timers run only inside the--gatecall (defaultdemand_publisher:Refresh.run_next, one sample per demand task). Each gated call logsPROF <label> total=<T> :: ...(debug), and the tool prints the median ticks and calls per function per label (--min-totaldrops warm-cache samples;--summarize CONSOLE_LOGre-reads a run). Read the numbers as shares: the wrappers add ~40%, and roughly double the total when hot helpers such aspriorityare wrapped. Never leave timers on outside the gate: their overhead pushed otherrun_atomic()callbacks over the 10,000-step cap. Use it wherestep_profile.pymisleads: the synthetic worlds understated the demand refresh tasks 10-300x.devtools/simulation/scan_stop_eval.py: how often the pairing method for sonar scan stops (contacts < 2 × range apart pair up, grow to maximal groups, stop in the middle) leaves a member out of range, on every seed's real contacts (node devtools/simulation/headless/sources.mjs --pois RANGE, the game'spoints_of_interest()list function exported bysimhost.mjsas__ctPoiList). Reports failed groups (fixable by a better middle vs no single stop possible), missed contacts, and stop counts against a greedy cover overlib/scan_groups.py's crossing candidates.--middle centroid|bbox|mec,--ranges basic,wide,deep,--no-biomass.devtools/perf/log_block_timing.py: reads the newest save's per-script logs (logs/<script>.logand rotations) and times every TreeConsole block (┏━/┗━) per script kind: count, median/max, median in ticks, self time without timed children, total and share of the observed window. Debug blocks are timed by theirHH:MM:SSgame clock, info blocks by tick, joined by a game-seconds-per-tick ratio calibrated from the logs. Times are wall game time and include sleeps/waits;--excludedrops travel/wait blocks,--since <ISO>measures only code deployed after that time (checkgit logfor earlier perf commits on a block before reworking it). The census lines (§1d-1) give N over time:med_Nis the median N at the blocks' start,med_stthe median cost in steps (ticks ×floor(50000 / N)), comparable across windows with different N;--sort stepsranks by total steps. Without census lines both columns show-.--headless <run dir or console.log>reads arun.mjsrun instead of a save;--sincethen takes a tick, and--sec-per-tickoverrides the calibration for runs with few debug flushes.devtools/code_scan/clean_code_scan.py: one entry point for the clean-code scans,clones,featuresandsizebelow. All usedevtools/code_scan/scan_common.pyscanned_files()and keep reviewed "leave as is" verdicts in their own ignore file, so a rerun lists only new candidates. Rerun after large refactors.devtools/code_scan/size_scan.py(clean_code_scan.py size): files over--max-lines(default 1000) and functions over Ruff's C901 complexity, PLR0912 branches or PLR0915 statements limits (Ruff defaults 10/12/50,--max-complexity/--max-branches/--max-statements). Size is a smell, not a defect, soruff.tomlkeeps these rules off and this scan lists candidates worst first (highest value/limit ratio). Needs the repo.venvRuff. Hit ids are<file>::<qualname>(<module>for a file hit); reviewed keeps go indevtools/code_scan/size_scan_ignore.txt.devtools/code_scan/feature_scan.py(clean_code_scan.py features): code a supported interpreter feature would simplify:value_class(@dataclass),ordering(total_ordering),property_pair,delegation(__getattr__),registry(__init_subclass__),tuple_return/tuple_index(named fields),elif_chain(match),dict_shapeandipc_key(TypedDict+StrEnum; archive and comms keys resolved to their strings,(?)when not). Hit ids are<file>::<pattern>::<subject>(no line numbers); reviewed keeps go indevtools/code_scan/feature_scan_ignore.txt.--summaryfor counts,-pto pick patterns,--allto show ignored ids. Text-only resolution: check feature support in game (§10 game module list) and read the code before converting.devtools/code_scan/clone_scan.py(clean_code_scan.py clones): near-duplicate function scan over the same files plusscripts/contract/andscripts/onboarding/. Bodies are normalized (names and args to_, constants to their type), compared with difflib (--min-ratio, default 0.85), and grouped into clusters;--pairslists pairs.nolibmarks a side in a tier that cannot importlib/. Reviewed pairs that stay apart go indevtools/code_scan/clone_scan_ignore.txt(file::qualname ~ file::qualname # reason, no line numbers). A high ratio means the same shape only: diff both functions before merging. Takes ~40 s.devtools/perf/repeat_read_scan.py: static scan of the highest-tier copy of every file underscripts/for game reads (stacks(),buildings(),get_component(), ...) and calls into functions that do them, made inside a loop or comprehension. Score = read weight ×LOOP_N(8) per enclosing loop, callees summed by bare-name resolution; flagsinvariant(direct read without loop-bound names, hoistable) andatomic(reached fromlib/atomic.pyrunners, ×0.1). Joined withlog_block_timing.py(same--since/--exclude), hits are grouped under the slowest timed block whoselog.start()function reaches them;[waits]marks blocks whose code cansleep()/mine(). Heuristic: verify each hit in code and checkgit logfor earlier perf work first.--no-logsgives the static ranking.- Test files per module (
test_production.py,test_smelter.py,test_fabricator.py,test_site_supply.py,test_factory_sites.pyfor per-site targets, the site plan, consumer hauling, stranded ore eviction and remote docks), home and remote-outpost cases. - Pyright:
pyrightconfig.jsonhas atestsenvironment resolving lib imports via.pyright-resolved/lib, falling back toscripts/4_controlpanel/lib. - Typed
selfin scripts: every non-lib/script that uses the game-injectedselfdeclares its type withfrom typing import TYPE_CHECKING/if TYPE_CHECKING:/from user_stubs import <name> as self.TYPE_CHECKINGis false in game, so the import never runs.<name>is the slot prefix (o2gen,heater,drone, ...), the contract id for a contract script, or an entry inSTEM_ALIASES/SELF_TYPE_OVERRIDES(devtools/self_typing.py). Each name is bound as<name>: T = ...: the game language server exports only namesuser_stubs.pybinds, so a bare<name>: Tgives "Module 'user_stubs' has no export" (hover still showsT). The names live in a marked block at the end of the save'suser_stubs.py(player-owned: the game creates it once and never overwrites it; the in-game editor, the VS Code extension and Pyright all read it). Every sync rewrites that block in the save (sync_user_stubs(), text outside the block kept, backup indevtools/.sync-backups/), andresolve-previewwrites the merged copy to.pyright-resolved/stubs/user_stubs.py. The block is generated from the game's language server (external-ide/server/server.cjs,scriptPrefix+machines.<type_id>.name) and the save's__builtins__.pyi(class = PascalCase oftype_id, else matched by display name). A prefix shared by several types (drone) is a union; each contract gets aContractScriptsubclass typed with its own<Id>Contract. New script:python devtools/self_typing.py apply;tests/test_self_typed.pyfails on a script that usesselfwithout the declaration.SELF_TYPE_OVERRIDESalso holdspanel(the injectedpanelglobal, imported under its own name).COMPONENT_EXPORTSin the same file lists component classes re-exported fromuser_stubsfor the typed accessors inlib/components.py.
Runs the decompiled simworker in Node at full CPU speed: real systems, Python interpreter and step budget, no UI, no wall clock. Needs Node ≥ 20 and the internals/ submodule. Findings, speed table and the plan for later phases: docs/plans/headless_sim.md.
simhost.mjs:Sim.create()loads the simworker with a run-time export shim (cached asdevtools/simulation/headless/.cache/sim-<hash>.mjs, gitignored; the decompiled code is never committed).load(saveJsonText)(running scripts resume),newGame(seed),setScript(id, source),tick(n),serialize(),terraformIndex()(researchRates.terraform.lastValue),onConsole(fn)(script lines and crashes),systemMs()(wall time per system).create({skipSystems, keepDebug, logLevels}): skipsDEFAULT_SKIP_SYSTEMS(AchievementSystem) and clears every script/librarydebugflag on load unless told otherwise (a flagged source makes the scheduler snapshot debug state at every step).newGame()/load()also write theconsole.log_levelsarchive dict (cheatsheet §0a Log levels) asDEFAULT_LOG_LEVELS({"*": "debug"}) withlogLevelsentries merged over it;logLevels: nullkeeps the save's dict.load()also confirms the running build in thesystem.good_versionarchive entry (the build hash comes from the simworker'sget_game_versionliteral), so an older save's controllers don't halt atlib/version_guard.py;create({keepVersionGuard: true})/run.mjs --keep-version-guardkeeps the save's entry. Free debug (patchFreeDebug(), on unlesscreate({paidDebug: true})): a debug-level console call returns without the flush yield, so it no longer pauses the script until the next tick (in game every console call costs that 0.1 s). Scripts log the full debug/trace trail intoconsole.logbut pay game time only for info/warn/error lines; string building andTreeConsolebuffering still cost interpreter steps. Measured: 40console.debug()calls take 41 ticks paid, 1 tick free.load(save, {libs})replaces the save'slibraryScriptssources (source,deployedSource, active variant) with{module: source}, so an old save runs currentlib/code; a module the save lacks is added as a new library entry (the game's load gives it an incarnation id), listed insim.libraries.added. Control Room panels draw into a no-opOffscreenCanvasstub. OneSimper process (module-level state). After a game update: the shim finds the minified names it needs (core, SimHost, state load/serialize, command registry) in the worker bootstrap by stable strings (BOOTSTRAP_PATTERNS), so a rebuild usually needs no change; a pattern that no longer matches stops the load with its key. The optional patches (per-system timing /--skip-systems,--sticky-fluids, free debug) and the scheduler console taps only warn ([headless] simworker changed: ...) and switch off;sim.featuressays which are on.run.mjs: CLI, options in its header.--save(by default its slots andlib/get the repo's current scripts:run.mjscallssave_scripts.pyinto<out>/latest_scriptsand passes it as--scripts/--libs;--as-savedkeeps the save's own code, and--scripts,--libs,--deploy-templatesor--policyalso turn this off),--hours,--until-tp,--deploy-templates <dir>(in-process stand-in for the earlygame runner's deploy loop,EARLY_DEPLOY_MAP),--out <dir>(console.log,metrics.jsonl,final_save.json),--profile,--skip-systems,--keep-debug,--log-levels <json|file|save>(e.g.'{"power": "trace"}'),--lib-tier <dir>(with--deploy-templates: once<dir>/.criteriais met, adds<dir>/libthroughlibrary.create, switches templates to<dir>first, redeploys every changed machine script and runsorchestrator_automation.pyandbuilder_automation.py(fleet commission, so queued Pioneers get built) in new Automations viaautomation.create, as the player sets them up in game),--paid-debug,--libs <dir>(e.g.scripts/4_controlpanel/lib),--scripts <dir>(<slotId>.pyinto each slot; new slots run, running ones restart, stopped ones stay stopped),--fail-on-error,--field-seed N(with--save: the Harvester field of seed N, fresh; the rest of the world stays the save's). A new game (no--save) has no generator and its first purchases are the player's, so without--policythe Terraform Index stays 0;run.mjswarns. Focused runs:--scenario FILE(docs/headless/scenarios.md) sets each subsystem's mode (real,off; terraformingpark,standin,scale; powertrim,topup; logisticsmover; plantsproduce,cash; constructioninstant: mechanisms and boundaries in docs/headless/standins.md, fidelity per mode in docs/headless/ab_results.md), feeds and drains items (flows), seeds archive keys and holds the step allowance at the full base's value (virtual script count);--standin SUB=MODE[,k=v]overrides one subsystem (e.g.--standin plants=produce,forage_h=4000;sweep=falseon a stopping mode leaves that group's archive left-overs);--script-set PATH|nonepicks the script-set profile (stubs, budget record, orchestrator markers, request protocol; defaultprofiles/code_terraform.json, docs/headless/standins.md "Profile").--include-autoplaystagesautoplay/too (its lib modules throughsave_scripts.py --include-autoplay, the planner Automationinfra_planner_automation.pycreated after load); without it, a save holding autoplay libs or slots runs their stale copies, and every--saverun but--as-savedwarns, naming them (the default staging throughsave_scripts.py; a run staging its own scripts throughsave_scripts.py --check, which skips what its--scripts/--libsreplace). Below the lib tier the warning stays quiet (scripts_sync.build_index()'s gate);--include-autoplayand--strip-autoplayact at every tier.--strip-autoplay(excludes--include-autoplay) loads none of it: autoplay slots get an empty script, autoplay lib modules are dropped from the loaded copy (strip_autoplay.jsonin the stagedlib/, passed asSim.load(save, {dropLibs}); the save file and the caller's save object stay unchanged), and a slot or lib still importing one is reported.--auto-approve Nanswers the planners every N ticks (OK on every outpost suggestion marker,approvedon every open BUILD-card proposal;[approve]lines inconsole.log; founding itself never executes headless, docs/headless/standins.md). The older flags are sugar for the same:--only-scripts harvester_1(every other groupoff, the ids kept),--stock ITEM=N(flowkeep),--drain ITEM:TICKS(flowafter),--park(terraformingpark);summary.jsonreportsstandins(modes,allowance,flows,stubs,profile,leftovers,sweepLive,revived, and per modewakes,standin,scale,mover,trim,topup,produce,cash,instant; field list in docs/headless/scenarios.md) plus the oldstocked/drained.field.mjs: port of the game's Harvester field generator (a pure function of the world seed).--seeds A-Bvalue statistics,--show SEED,--check SAVE(port vs a save's grid; run after a game update). Seed scoring:docs/plans/scoring_map_seeds.md.harvest_model.mjs: offline model of the early Harvester on a field (µs per field; route-exact against headless runs).harvest_policies.mjs: route policies for it (hybrid= the current0_cold_bootharvester.py),--eval/--gridover a random field sample,--checkagainst headless runs,reachPossible()(admissible bound for scans).seedscan.mjs: scans all world seeds by recipes and Harvester score (--score reach).seedconfirm.mjs: runs a scan's top seeds in fresh headless games and compares credits with the model (--rank scan|cr|20k). Same plan doc.devtools/simulation/seed_quality.py recipes: port of the game's seed recipe generator (a pure function of the world seed) scored against the fixed biosite supply.--seeds A-B,--show SEED,--check SAVE(port vs a save'srecipeMap; run after a game update). Same plan doc.sources.mjs: the seed's vents, exotic deposits and fluid wells from the game's own generators (exported by the shim,__ctWorldGen);--seed N,--seeds A-B,--in FILE.jsonl [--out], scores indocs/plans/scoring_map_seeds.mdPart 3. The game's UI thread (main-*.js), not the worker, runs them: vents and deposits on a new game, then wells and anomalies on every load (each skipped when its kind exists).Sim.newGame()calls all four in that order (simhost.mjsgenerateWorld()), andswap_seed.pywrites them into the swapped save viasources.mjs --emit.devtools/play/swap_seed.py --save FILE --seed N [--apply](a save tool, not part of headless runs): swaps a young save's world seed and regenerates the seed-decided state (seed,planet.plants.recipeMap,harvesting.grid,planet.sources,planet.geologicalAnomalies) in the save and its.h*.jsonsnapshots, from the Python ports (seed_quality.recipes(), its ownfield(), a copy offield.mjs).--saveis explicit, never auto-detected; close the game first; refuses a save with progress unless--force; backups indevtools/.sync-backups/seed-swap/. Dry run without--apply. Best all-round seed: scoring_map_seeds.md.- Save inputs (
run.mjs --save,field.mjs --check,save_scripts.py --save,seed_quality.py recipes --check) take plain.jsonor gzipped.json.gz, detected by magic bytes (devtools/simulation/headless/savefile.mjs,devtools/savefile.py). Sample saves ininternals/sample_saves/are gzipped. devtools/play/decision_recorder.py(a save tool, outside the game): watches a manual run's save file, logs every change, asks in the terminal for a reason at major changes, and writes gzipped save copies tointernals/sample_saves/<YYYYMMDD>_<commit>/as headless start points. It also appends new script console lines fromconsole/<save id>.jsontoconsole.jsonl.gzthere. Details in its docstring; purpose in building_planner.md.devtools/play/save_diff.py(a save tool): diffs consecutive kept saves of a recorder run (buildings per outpost against the building cap, tiers, tech, orders, purchases, power, fluids, running scripts, stock), matches each owner reason fromevents.jsonlto the rows it explains and lists the unexplained decision rows. Reports carry save details, so--outgoes to private storage. Purpose in save_database.md.save_scripts.py: maps the repo's current scripts onto a save's slots for--scripts, so an old save runs current scripts and libs.run.mjs --saveruns it by default; call it by hand for another commit's scripts (A/B)..venv/Scripts/python.exe devtools/simulation/headless/save_scripts.py --save <save.json> --out <dir>writes<dir>/<slotId>.pyfor each slot whose resolved source differs and<dir>/lib/for--libs. Matching, placeholders and renumbering followscripts_sync.py'ssync_file(); placeholders come from the slot's code in the save or the template default, and a slot with neither is skipped and listed. A marker naming a renamed role (RENAMED_ROLES) maps to the current role; a slot holding a removed role (RETIRED_ROLES) gets an empty script, so its old code doesn't crash on current libs. Add both maps' entries when a role is renamed or removed.--tierdefaults to the tier the save's progress meets (.criteria, asscripts_sync.pypicks it, without the high-water mark).--policy plan.json(policy.mjs): plays the Shop and Inventory from a build-order plan, through the UI commands (Sim.buy/deploy/undeploy/sell/drop). This also works before Ship Computer. The tier-0solar.pybuyer is switched off; with--lib-tierthe policy keeps placing buildings andlib/early_buyer.py(stategeneratorsFalse) buys the vehicles (§2m). From the lib tier on the policy powers only what it deploys.--until-pioneerwaits for a ready scout Pioneer.summary.jsonreportsreachedH,tpH, POIs, net worth and brownout seconds. Build-order search driver and results:devtools/simulation/buildorder_search.py, early_optimization.md.- Patched-module cache: keyed on the raw simworker plus
simhost.mjs, so an unchanged build starts in about 1 s. It is written atomically for parallel runs. - Reading a save from the save folder is fine; the harness never writes there.
Tools that copy or port game internals. Run each check on the new build before relying on the tool. Each step names its pass condition: a step whose condition holds needs no judgment; anything else (a failing check, a feature the fix would drop, an unclear diff) goes back to a reviewer.
A fresh save of the new build: node devtools/simulation/headless/run.mjs --seed N --hours 0.001 --out DIR writes DIR/final_save.json (bare state, accepted by all checks below).
- API docs: export the DOCS Manual in game, run
python devtools/game_update/split_docs_manual.py, review its routing report andgit diff(docs/README.md). - Shared fakes:
python devtools/game_update/extract_game_spec.py, review thetests/game_spec.jsondiff (renamed methods, new statuses, changed defaults), then run the suite (§10). Pass: exit 0,unresolved 0, noduplicates,coverage ok. The coverage line lists anydocs/components/*.mdor scriptable machine without anapientry, i.e. methods the extractor missed (new registration style); a doc file named apart from its API id goes inDOC_API_ALIASES. Tables are found by anchor strings, not minified names. - Seed generators: on fresh saves of 3 seeds,
python devtools/simulation/seed_quality.py recipes --check SAVE.jsonandnode devtools/simulation/headless/field.mjs --check SAVE.json(pass:port matches).devtools/play/swap_seed.pyrelies on both ports (itsfield()is a copy offield.mjs: fix both). Round trip: copy seed A's save tosave_test_a.json,swap_seed.py --save save_test_a.json --seed B --apply; pass whenseed,planet.plants.recipeMap,harvesting.grid,planet.sourcesandplanet.geologicalAnomaliesequal seed B's fresh save. Don't swap a seed until all pass. - Headless: needs the new decompiled simworker in
internals/; the patched-module cache rebuilds itself (§10b). Pass: the fresh-save run prints no[headless]line, andnode --test "devtools/simulation/headless/test/*.test.mjs"is green (anchor policy and the per-patch table: docs/headless/anchors.md). Everysimworker changed:warning means a lost feature (a hook not found) or a pattern step slower thanSLOW_STEP_MS(a quadratic scan; first build takes well under 1 s otherwise). Then load a sample save (latest scripts by default): no crash,errored0, noGame version changedline. Thennode devtools/simulation/headless/anchors.mjs: prints the feature table, the fivescaleanchor counts and theinstant waitcount (want 1 each) for the currentinternals/worker, exit 1 on any miss; a lostscaleanchor means that stand-in mode falls back tostandin, a lostinstantBuildanchor leaves constructioninstantfinishing jobs in the state only, until the pattern inanchors.mjsis updated (docs/headless/anchors.md, "After a game update"). devtools/play/game_speed.py: finds the sim clock by pattern in the simWorker bundle; "sim clock not found" means the pattern needs updating (§8a).- Changes the changelog leaves out:
python devtools/game_update/simworker_diff.pydiffs the previousinternals/simworker commit against the working file, ignoring minifier renames (--old/--newtake a revision or a.jspath). Writesdevtools/game_update/.simworker-diff/<old>_<new>.md(gitignored: decompiled code). Read Number changes first (a constant that moved, with its table row), then Code changes and Added (code); Text changes often name a behaviour change too (a description that says 25× instead of 5×). Editor and tutorial chunks are hidden unless--all. Findings go into the build's adoption notes, not into tracked copies of the code.