Public: anyone can read this; the crew can change it.
forked from trevato/cs · proposes · 4 behind
The determinism harness becomes engine: one folded digest behind the door, and both games' pins hold to the byte #139
Check · Review · Land · Live done — Landed and live in production.
The determinism harness is now one module behind the engine's door. `src/engine/digest.ts` holds the generic half both games had written out twice — the quantiser (`QUANTUM`, `quantise`), `CHECKPOINT_CHARS`, the `fold` that hashes every tick and keeps a short digest every *n* ticks, the `Pin`, and the `compare` that names the span two runs parted at and prints the constants to paste. It knows a ti…
shipped production is serving it deploy ae07c2d
Sign in to join this conversation.
new above
offline
The determinism harness is now one module behind the engine's door.
src/engine/digest.tsholds the generic half both games had written out twice — the quantiser (QUANTUM,quantise),CHECKPOINT_CHARS, thefoldthat hashes every tick and keeps a short digest every n ticks, thePin, and thecomparethat names the span two runs parted at and prints the constants to paste. It knows a tick count, a stepper, a line of bytes and how many ticks a checkpoint covers; the rate, the state, the field names, what a span is called and the file the digest is committed in all arrive from the caller as aComplaint.The proof is that nothing moved: every digest and every per-second checkpoint in
src/client/replay.test.tsandsrc/range/pin.test.tsis unchanged to the byte, and the only edit to either test file is which moduleCHECKPOINT_CHARSandQUANTUMare imported from — worth reading the diff of those two files first. The game modules keep their scripts, field tables, snapshots and doctrine and lose the arithmetic:replay.ts263 → 227 lines,pin.ts303 → 265. The failure message is the better of the two old ones, unified: the second that first differs, the ticks it covers, how many differ, the fields that were hashed and the two constants to paste.src/engine/digest.test.tspins the tool on a state that is not a game — a counter, a stepper the test writes and a checkpoint of four ticks — with a divergence injected at tick 9 and found at the span holding it, the quantiser's rounding and its!NaN/!Infinityspelling, a fold of zero ticks, and the complaint read back in full. LikefakePage, it ships in no bundle, and that is asserted rather than hoped: every committed bundle is read for this module's sentence, for the complaint it writes and forCryptoHasher. All three bundles were rebuilt and not one moved a raw byte (app 72,128, range 28,978, example 8,754); only the minifier's short names shuffled, so neither ceiling insrc/games.tsmoved. The door, the pinned surface list,GUIDE.md's new digest section (how a third game pins itself) and the README's module tour grew with it.bun testis 617 passing.🤖 Generated with Claude Code
Closes #110