Repository navigation
Lock a hash-verified seeded legacy baseline (REQ-MIGRATION-002) #17
Copy link
Copy link
Closed
Labels
area:toolingCI, scripts, guards, developer toolingCI, scripts, guards, developer toolingpriority:highImportant and time-sensitive; schedule ahead of normal workImportant and time-sensitive; schedule ahead of normal worktype:processDevelopment workflow, governance, or coordination changeDevelopment workflow, governance, or coordination change
Description
Goal
A reproducible, hash-verified seeded baseline of the legacy C# simulation exists,
independent of console/CSV formatting, so later canonical-migration changes have a
locked golden reference to diff against — closing REQ-MIGRATION-002.
Evidence
REQ-MIGRATION-002(docs/spec/mirror/REQUIREMENTS_REGISTRY.csv, M0,READY,
PRIORITY=P0): "Record a reproducible seeded legacy baseline independent of
console formatting." Acceptance: "Repeated same-seed legacy runs on the same
runtime produce the same normalized snapshot/hash."docs/spec/mirror/06 - Handoff/11 — REPOSITORY_MIGRATION_AND_MILESTONE_GATES.md,
Milestone 0, lists as implementation steps: "Record current default-branch test
result and representative 30-turn seeded output/hash" and "Add a deterministic
canonical test helper and snapshot/hash utility independent of console
formatting"; Gate M0 requires "same legacy seed produces the same legacy snapshot
across repeated runs on the same runtime."- Repository check: no snapshot/hash utility exists today.
TradeCraftSimulation.Tests
hasDealTests.cs,LocalMarketTests.cs,MarketTests.cs,SimulationTests.cs,
StorageTests.cs— none hash or snapshot simulation output, and
grep -rli "hash|snapshot|baseline"overTradeCraftSimulation*finds nothing. docs/spec/IMPLEMENTATION_STATUS.mdshows 0 of 0 requirements implemented — this
requirement has not been started.REQ-MIGRATION-001(baseline lock: "dotnet build succeeds and all existing tests
pass unchanged") is already true of currentmasterand will be exercised as part
of this Issue's verification, but is not itself closed by this Issue — it has no
new artifact of its own and is left for a separate run to formally evidence and
close.
Scope
- Add a deterministic snapshot/hash helper in
TradeCraftSimulation.Teststhat
normalizes representative simulation output (city stocks, prices, balances — not
printed/CSV text) after a seeded run (per the spec's "representative 30-turn
seeded output/hash") into a stable hash. - Add a test proving two runs with the same seed produce an identical normalized
hash, and a sanity test proving a different seed changes it. - Add a short migration marker (e.g.
TradeCraftSimulation/MIGRATION.mdor a header
comment set) documenting which classes are legacy, matching the "keep Program
behavior unchanged" constraint in the M0 implementation steps.
Non-goals
- Canonical TypeScript scaffolding (
REQ-MIGRATION-003) — separate requirement,
separate runtime, not touched here. - Any change to legacy economic formulas,
ProgramCLI behavior, or existing test
assertions — this Issue only adds new, independent test infrastructure. - CI workflow changes — this repository forbids mixing a policy change with a
product change in one PR (see Issue Give canonical TypeScript work a required check #14 / PRs Add the canonical TypeScript toolchain #15, Make canonical TypeScript work verifiable #16 precedent). - Formally closing
REQ-MIGRATION-001orREQ-MIGRATION-004in
docs/spec/IMPLEMENTATION_STATUS.md— onlyREQ-MIGRATION-002.
Acceptance criteria
- A deterministic snapshot/hash utility exists for the legacy simulation,
computed from normalized simulation state rather than console/CSV text. - A test proves two same-seed runs on the same runtime produce an identical
normalized hash. - A test proves a different seed produces a different hash (the utility is not
a constant). - A migration marker documents which classes are legacy.
- All existing legacy tests remain green and unmodified in behavior.
-
Program.csCLI behavior (--turns,--seed,--csv,--quiet) is
unchanged. -
docs/spec/IMPLEMENTATION_STATUS.mdupdated forREQ-MIGRATION-002with the
proving test name.
Verification
dotnet restore
dotnet build --configuration Release --no-restore
dotnet test --configuration Release --no-buildReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:toolingCI, scripts, guards, developer toolingCI, scripts, guards, developer toolingpriority:highImportant and time-sensitive; schedule ahead of normal workImportant and time-sensitive; schedule ahead of normal worktype:processDevelopment workflow, governance, or coordination changeDevelopment workflow, governance, or coordination change
Activity
drevendev commentedon Sep 3, 2026
Claim — role: AUTHOR
Intended scope: implement
REQ-MIGRATION-002exactly as scoped in this Issue —add a deterministic snapshot/hash helper in
TradeCraftSimulation.Testsovernormalized simulation state (city stocks, prices, balances), a same-seed
determinism test, a different-seed sanity test, a legacy migration marker, and
an
IMPLEMENTATION_STATUS.mdupdate forREQ-MIGRATION-002only.Branch:
claude/issue-17-legacy-baseline-hashKnown blockers: none yet. Will read
REQUIREMENTS_REGISTRY.csv,SPEC_CHANGELOG.md, and the single domain document(
06 - Handoff/11 — REPOSITORY_MIGRATION_AND_MILESTONE_GATES.md) named by thisrequirement before implementing, per the AUTHOR runbook.
drevendev commentedon Sep 3, 2026
Handoff — role: AUTHOR
Branch:
claude/issue-17-legacy-baseline-hashTested revision:
d1530395556c3da5f55f959af2050dfdfc271d0cPull request: #18 (
Closes #17)Decision: the snapshot/hash utility lives in
TradeCraftSimulation.Tests(not the production
TradeCraftSimulationproject), since it is test/goldeninfrastructure, not simulation behavior — matches the Issue's own Scope
wording ("deterministic snapshot/hash helper in
TradeCraftSimulation.Tests").Hashing is SHA-256 over a delimited string built by iterating
Cities/Population/Storage.Allin their fixed declaration order (neverdictionary/hash-set order) with round-trip (
"R") double formatting, so theresult cannot alias the console/CSV views' fixed-decimal-precision text. Not
expensive to reverse, so no ADR filed.
Checks:
dotnet restorepassed,dotnet build --configuration Releasepassed (0 warnings/errors),
dotnet test --configuration Releasepassed(44/44, up from 42 pre-existing + 2 new). The canonical TypeScript suite is
not_run— nosrc/**or root project files were touched.What remains:
docs/spec/IMPLEMENTATION_STATUS.mdcurrently recordsREQ-MIGRATION-002asIN_PROGRESSrather thanIMPLEMENTED, since thefile's own legend defines
IMPLEMENTEDas "merged" and an AUTHOR run nevermerges. Whoever merges PR #18 should flip that status and name the merge
commit. No other gate remains from this Issue's scope.
Add hash-verified seeded legacy baseline (REQ-MIGRATION-002) (#18)
drevendev commentedon Sep 3, 2026
Accepted and merged PR #18 as squash commit 2ee9a06 (head revision reviewed: d153039).
Evidence:
build-and-test,typescript,policy-guard(allpass).dotnet restore && dotnet build --configuration Release --no-restore && dotnet test --configuration Release --no-build— build succeeded (0 warnings, 0 errors), 44/44 tests passed (42 pre-existing +LegacyBaselineSnapshotTests.The_same_seed_produces_the_same_normalized_snapshot_hashandA_different_seed_produces_a_different_normalized_snapshot_hash).TradeCraftSimulation.Tests/**,TradeCraftSimulation/MIGRATION.md,docs/spec/IMPLEMENTATION_STATUS.md— no workflow/policy files touched, no invariant or existing test weakened.REQ-MIGRATION-002 is closed by this merge;
docs/spec/IMPLEMENTATION_STATUS.mdrow can move fromIN_PROGRESStoIMPLEMENTEDin a follow-up (its own note says that transition happens on merge).Issue closed automatically via the PR's "Closes #17".
Fix status:* label hygiene in the ZenDev runbooks (#22)