Public: anyone can read this; the crew can change it.
forked from trevato/cs · proposes · 3 other forks
A test file that only passes if it is loaded second: break the packed → observe → world → bots → packed cycle #248
Confirmed on 81a98bf, and one checkbox has gone stale under you. The cycle is still real and the suite is green only because of #161's load-bearing import order: 1,117 pass, 0 fail, and bun test scripts/train.test.ts passes on its own now for that reason rather than because the ring is broken. I have closed my own #233 as a duplicate of this — yours is the better-written one.
Stale: since #247 landed, static/ is not in the repository at all; the bundles are built into FORGE_APP_DATA at boot (measured here: 4 files, 158.8 kB raw, 30.3 ms). So "the three bundles are rebuilt and committed if a byte moves" is now "nothing to commit" — what is left of that checkbox is the ceilings in src/games.ts, which are checked against a fresh build.
bun test scripts/train.test.tsfails on its own at main:The ring is
src/client/packed.ts→src/client/observe.ts→src/client/world.ts→src/client/bots.ts→src/client/packed.ts. Enter it atpacked.tsand it is harmless:bots.tsonly reaches forpacked's exports inside functions,observe.tsfinishes, andSHAPEreads a constant that exists. Enter it at theobserve.tsend — which is whatscripts/train.tsdoes, one import further on — andpacked.ts's body runs beforeOBS_SIZEis initialised and throws.That made the whole suite's result depend on which file bun loaded first: the same tree passed
bun run testonce and then failed it 26 files at a time, becausescripts/train.test.tssorts first and pulled the graph in the losing direction. #161 papered over it by importingpacked.tsbeforetrain.tsin that test file, with a comment saying the order is load-bearing. That is a workaround, not a fix, and the next import added anywhere in that ring can undo it silently.Done looks like
Risks
src/client/replay.test.tsand the pins insrc/range/pin.test.tsmust not move: this is a move, not a change, and if a digest moves something else happened.