Skip to content

Lock a hash-verified seeded legacy baseline (REQ-MIGRATION-002) #17

Closed

Description

@drevendev

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
    has DealTests.cs, LocalMarketTests.cs, MarketTests.cs, SimulationTests.cs,
    StorageTests.cs — none hash or snapshot simulation output, and
    grep -rli "hash|snapshot|baseline" over TradeCraftSimulation* finds nothing.
  • docs/spec/IMPLEMENTATION_STATUS.md shows 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 current master and 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.Tests that
    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.md or a header
    comment set) documenting which classes are legacy, matching the "keep Program
    behavior unchanged" constraint in the M0 implementation steps.

Non-goals

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.cs CLI behavior (--turns, --seed, --csv, --quiet) is
    unchanged.
  • docs/spec/IMPLEMENTATION_STATUS.md updated for REQ-MIGRATION-002 with the
    proving test name.

Verification

dotnet restore
dotnet build --configuration Release --no-restore
dotnet test --configuration Release --no-build

Activity

  1. added
    priority:highImportant and time-sensitive; schedule ahead of normal work
    type:processDevelopment workflow, governance, or coordination change
    area:toolingCI, scripts, guards, developer tooling
    status:readySpecified and unblocked; safe for an agent to claim
    on Sep 3, 2026
  2. drevendev commented on Sep 3, 2026

    @drevendev
    OwnerAuthor

    Claim — role: AUTHOR

    Intended scope: implement REQ-MIGRATION-002 exactly as scoped in this Issue —
    add a deterministic snapshot/hash helper in TradeCraftSimulation.Tests over
    normalized simulation state (city stocks, prices, balances), a same-seed
    determinism test, a different-seed sanity test, a legacy migration marker, and
    an IMPLEMENTATION_STATUS.md update for REQ-MIGRATION-002 only.

    Branch: claude/issue-17-legacy-baseline-hash

    Known 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 this
    requirement before implementing, per the AUTHOR runbook.

  3. added
    status:in-progressClaimed work with an active branch or pull request
    status:needs-reviewImplementation complete, awaiting acceptance
    and removed
    status:readySpecified and unblocked; safe for an agent to claim
    status:in-progressClaimed work with an active branch or pull request
    on Sep 3, 2026
  4. drevendev commented on Sep 3, 2026

    @drevendev
    OwnerAuthor

    Handoff — role: AUTHOR

    Branch: claude/issue-17-legacy-baseline-hash
    Tested revision: d1530395556c3da5f55f959af2050dfdfc271d0c
    Pull request: #18 (Closes #17)

    Decision: the snapshot/hash utility lives in TradeCraftSimulation.Tests
    (not the production TradeCraftSimulation project), since it is test/golden
    infrastructure, 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.All in their fixed declaration order (never
    dictionary/hash-set order) with round-trip ("R") double formatting, so the
    result cannot alias the console/CSV views' fixed-decimal-precision text. Not
    expensive to reverse, so no ADR filed.

    Checks: dotnet restore passed, dotnet build --configuration Release
    passed (0 warnings/errors), dotnet test --configuration Release passed
    (44/44, up from 42 pre-existing + 2 new). The canonical TypeScript suite is
    not_run — no src/** or root project files were touched.

    What remains: docs/spec/IMPLEMENTATION_STATUS.md currently records
    REQ-MIGRATION-002 as IN_PROGRESS rather than IMPLEMENTED, since the
    file's own legend defines IMPLEMENTED as "merged" and an AUTHOR run never
    merges. Whoever merges PR #18 should flip that status and name the merge
    commit. No other gate remains from this Issue's scope.

  5. added a commit that references this issue on Sep 3, 2026
    2ee9a06
  6. drevendev commented on Sep 3, 2026

    @drevendev
    OwnerAuthor

    Accepted and merged PR #18 as squash commit 2ee9a06 (head revision reviewed: d153039).

    Evidence:

    • CI checks green at head: build-and-test, typescript, policy-guard (all pass).
    • Independently rebuilt and retested the legacy .NET runtime at the head revision in an isolated worktree: 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_hash and A_different_seed_produces_a_different_normalized_snapshot_hash).
    • All acceptance criteria confirmed met against the diff; scope confined to 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.md row can move from IN_PROGRESS to IMPLEMENTED in a follow-up (its own note says that transition happens on merge).

    Issue closed automatically via the PR's "Closes #17".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolingCI, scripts, guards, developer toolingpriority:highImportant and time-sensitive; schedule ahead of normal worktype:processDevelopment workflow, governance, or coordination change

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions