# Replay actual colony commands and compare every tick Task ID: M01-T Role: sol_implementer Status: READY ## 1. Context and baseline Game root /home/faumaray/Projects/stoneheart_at_home, milestone/m01-authoritative-simulation based on M00 checkpoint 904bdf8. The baseline has 28 core and 4 LAN cases, reflection suites from pinned Void. Legacy task notes/.serena are untracked. ## 2. Objective and deliverables Build an executable M01 replay regression in the normal settlement_core_tests target, exercising the explicit serial reference and normal modes on the same saved starting state. ## 3. Scope and non-goals Own the test fixture, useful game scenarios, mode/legacy boundary assertions and minimal source registration. Keep every existing core and LAN case. No new runner or game production logic. ## 4. Files to inspect Inspect tests/core_tests.cpp (save_contents and test_two_players_share_the_first_colony, resource/hauling and parallel job tests), tests/test_main.cpp, CMakeLists.txt, world.hpp, docs/plan/milestones/M01.md, docs/plan/void-library.md and actual game behavior. ## 5. Write ownership and coordination Write scope: tests/replay_tests.cpp; CMakeLists.txt You are not alone. Core owner writes only world.hpp/world.cpp/world_save.cpp. Root owns docs and Git. Do not revert their changes; serialize your new file registration in CMake yourself. ## 6. Implementation or investigation approach Add a reflected Void Suite in NEW tests/replay_tests.cpp, register this file on existing settlement_core_tests. Mark new cases with tag replay. Use the actual write_save binary bytes as prototype oracle (no hashes or shadow codec). Record a fixed test-local set of PlayerCommand values including explicit player sequences and scheduled step attempt ordinals. Check expected receipts/rejections, tick/revision and pause/resume, then compare state bytes every attempt through meaningful colony output. See preflight requirements below. ## 7. Interfaces and data contracts NEW frozen API settlement::ExecutionMode::{Parallel, SerialReference}; World(seed,w,h, size_t workers=min_worker_count, ExecutionMode mode=ExecutionMode::Parallel); World::read_save(stream, size_t workers=min_worker_count, ExecutionMode mode=ExecutionMode::Parallel). Serial requires logical count 1 and reports worker_count()==1. Parallel 2..64 and ordinary one-worker rejection remain. Invalid combinations/unknown enum throw invalid_argument. Existing PlayerCommand, CommandReceipt, make_first_colony, resource/job APIs apply. ## 8. Dependencies and integration Core author implements the frozen API concurrently. Use an uninterrupted serial reference versus 2/6/12 from the same initial bytes. At a proven material-in-hand checkpoint resume another world per mode from bytes, keep uninterrupted reference alive and compare every subsequent tick. Use warmed path cache in the live history; report path counters and first differing tick/mode/object or byte offset if a comparison fails. Coordinate builds after both sides compile. ## 9. Edge cases security and performance Cover empty, paused, one resident/fewer residents than workers. Include multiple competing generic jobs and an unreachable route forcing a retry to another job (all three dispatch points), and two eligible residents contending for the last item, with a specific winner and conservation after delivery/consumption. Choose meaningful positive outcomes to rule out all modes equally doing nothing. Compare bounded scenarios and avoid OS timing assertions. ## 10. Acceptance criteria 1. Reproducible command schedule advances a real colony and checks accepted and rejected commands. 2. Exact byte equality every tick for serial/2/6/12 including reload vs uninterrupted; prove in-hand stop and useful work. 3. Contention winner and unit accounting, job selection/retry, and valid/invalid configs are checked. 4. Existing tag/CTest entry points still work. ## 11. Verification commands and evidence From game root source /tmp/stoneheart-verify.KoZwE4o8/env.sh; cmake --build /tmp/stoneheart-milestones.xprJ2SVp/windows --parallel 8 --target settlement_core_tests; wine /tmp/stoneheart-milestones.xprJ2SVp/windows/settlement_core_tests.exe --tag replay. Root built this directory from the exact clean Void pin. Report counts and time. Work with core owner if build awaits API. ## 12. Constraints and stop conditions Do not weaken old tests, compare only hashes/final counts, edit game files, change branches, stage/commit or spawn. Investigate actual source when a fixture fails; distinguish bad setup from real divergence and inform root. ## 13. Authorization and decisions User requested milestone implementation with subagents. This scoped M01 tranche establishes replay evidence before replacing the executor or changing the authoritative command format. ## 14. Return format Return M01-T status, changes, fixture/expected state, counts and commands, any coverage you could not verify and integration notes. Send early if there is a real disagreement across modes.