No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Winnie/bankwars!102
Loading…
Reference in a new issue
No description provided.
Delete branch "100-shelf-reset"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What shipped
openLoanOffersis the phase-scratch global behind(market-loans). PR #101 fixed the cross-game leak by nilling it atrun()start, which covers turn-1 HOOK reads. But the bench path loads brain files inassignPlayersBEFORErun(), anddefvarinitializers are evaluated AT LOAD: a brain that caches the shelf at load, e.g.(defvar pool-est (length (market-loans))), still captured the previous game's leftover shelf and carried it as cached state for the whole game.This PR moves the authoritative clear to the construction boundary:
NewGamenow nils the shelf the moment a new game is created, before any brain file parses.run()'s clear stays as a second guard.Why not gate
(market-loans)outside the loan phaseThe dispatch suggested that as defense in depth. I left it out on purpose: within a running game the shelf doubles as last turn's loan book, and deposit-phase reads of it are the same information regime as the #84 deposit/bond snapshots (last-turn book). Gating the accessor would change what brains observe mid-game and shift bench economics. The construction-boundary clear fully closes the cross-game leak without touching in-game semantics.
Regression test
TestNewGameClearsShelfBeforeBrainLoadmirrors the bench path: it plants a stale shelf (a previous game's leftovers), callsNewGame, loads a probe brain whosedefvar shelf-at-load (length (market-loans))runs AT LOAD, posts that value on turn 1, and asserts it is 0. It also verifies the hook really fired (arunscounter read back via the env) and that the shelf was rebuilt by the first loan phase, so it cannot pass vacuously.Red/green: the test fails on master as of this branch's base (turn-1 post 0.5000 = the capped nonzero stale read) and passes with the
NewGameclear.Gates
go buildOKgo test -count=1 .OK (includes #101'sTestGameStartClearsStaleShelf)go vet ./...OKDiff:
game.go+shelf_load_test.goonly.