2.5 KiB
2.5 KiB
| id | title | priority | status | scope | owner | updated_at | evidence | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| p1-09 | Determinism gate — same seed produces byte-identical runs | p1 | done | game1 | testwright | 2026-04-19 |
|
Summary
Determinism is foundational for save/load, replay, bug reproduction, and golden tests. Prior work fixed seed-ingestion (game_state.gd:113-115), migrated HashMap→BTreeMap in several crates, sorted DataLoader enumeration, and pathfinder tiebreakers. Testwright's T1 task landed mc-mapgen/tests/determinism.rs (389 lines) with PCG32 golden vector + seed-stable map generation, now running green in CI.
State as of 2026-04-17 PM: the Rust side of the gate is running. CI enforces cargo test --workspace on every push to main (Stage 1 of .forgejo/workflows/ci.yml), the apricot runner is registered + polling, and T1's determinism vector is green. Two remaining blockers, both tractable:
- HashMap iteration audit is no longer abstract. The T2 serde round-trip test (
mc-turn/tests/serde_roundtrip.rs) concretely demonstrated thatPlayerState.strategic_axes: HashMap<_>andTechState.progress: HashMap<_>produce non-deterministic save output across processes. Fix isHashMap → BTreeMapinmc-turn/src/game_state.rs, scoped to p0-12 (shipwright). The 3 currently-#[ignore]'d T2 tests will flip to passing the moment that change lands. - GUT save/replay test + end-to-end byte-identical turn_stats diff are still both missing. The autoplay smoke stage is advisory right now because
turn_stats.jsonlisn't landing reliably on fresh flatpak checkouts — fixing the sandbox path handling intools/autoplay-batch.shunblocks the turn_stats equality check.
Acceptance
cargo test --workspacegreen on apricot including mc-mapgen determinism tests (currently 3 fails).- Two runs of
AUTO_PLAY_SEED=42 AUTO_PLAY_TURN_LIMIT=100on apricot produce byte-identicalturn_stats.jsonl. - GUT test exists that replays a saved game and asserts the resulting turn_stats matches the original.
- CI (when p2-10 lands) blocks any PR that regresses these.
- No HashMap iteration in any hot path in
src/simulator/crates/; grep confirms BTreeMap/BTreeSet or sort-before-iterate.
Non-goals
- Cross-platform byte-identical (floating point divergence on ARM vs x86 may remain; gate is same-platform).