Skip to content

Pokemon Navigation: golden files for the overworld simulations (seam 3, S3-0) - #419

Merged
dayfine merged 12 commits into
nav/grid-story-stepsfrom
nav/sim-goldens
Nov 13, 2026
Merged

dayfine merged 12 commits into
nav/grid-story-stepsfrom
nav/sim-goldens

Conversation

@dayfine

@dayfine dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Depends on #362. Base: nav/grid-story-steps; the diff shows only this change.

Shared plumbing for seam 3's sim goldens, so each game's sim can record what it observably does and later refactors onto the shared sim core can prove it unchanged.

  • Pokemon/Navigation/Simulation/Pokemon_SimGolden.h: a golden's path beside its test's source, its text (a # comment line, then a line per fact), the first differing line (CRLF ignored), and check_sim_golden(), which rewrites the file with CRLF endings when PA_UPDATE_SIM_GOLDENS=1.
  • The game goldens merge this in: FRLG in the PR on frlg/stage8-rocktunnel; BDSP's sim is on the bdsp/center-run-settle line and follows separately.

Testing: headless runner, Pokemon::Navigation - Sim golden suite (6 cases) passes, built together with the FRLG goldens on frlg/stage8-rocktunnel.

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

dayfine and others added 2 commits November 12, 2026 00:36
Shared plumbing for seam 3's sim goldens: a golden's path beside its
test, its text, the first differing line, and a check that rewrites the
file when PA_UPDATE_SIM_GOLDENS is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine

dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

API review (claude-sonnet-5-5) at 2fba611: LGTM_with_nits

The plumbing is sound: the line walk, CRLF handling, and update/check split behave correctly on the edge cases I traced. The one design issue is that the new first_golden_difference API uses "" to mean "no difference". There are also two small nits: the CRLF-writing path is untested, and <utility> is missing for std::move.

  • [style] SerialPrograms/Source/Pokemon/Navigation/Simulation/Pokemon_SimGolden.cpp:84 New API uses an empty string as the "no difference" sentinel (header: '"" if none.'). check_sim_golden then has to test difference.empty(), which is easy to misread. It also silently conflates "no difference" with a difference whose text is empty. Fix: Return std::optional<std::string> (nullopt = identical) and have check_sim_golden test if (difference.has_value()). Update the header comment and the CRLF and difference tests to match.
  • [nit] SerialPrograms/Source/Pokemon/Navigation/Simulation/Pokemon_SimGolden.cpp:20 with_crlf is the core of the update path (it is why goldens are written with CRLF), but it sits in the anonymous namespace. Nothing tests it, and the rewrite branch of check_sim_golden has no test either. A regression there would only show up as a whole-file diff in the game PRs. Fix: Declare with_crlf in the header (or add a test that writes a temp golden and reads the bytes back). Add a case checking that bare LF and CRLF input both come out as exactly one CRLF per line.
  • [nit] SerialPrograms/Source/Pokemon/Navigation/Simulation/Pokemon_SimGolden_Tests.cpp:41 std::move is used without #include <utility>; it only compiles through transitive includes. Fix: Add #include <utility> to the include block.

dayfine and others added 3 commits November 12, 2026 15:05

@dayfine dayfine left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed SHA: 9d73176

LGTM_with_nits

Verdict

APPROVED

Prior review (2fba611), all three findings fixed at this tip: first_golden_difference returns std::optional<std::string> and check_sim_golden tests has_value(); with_crlf is declared in the header and has a test (bare LF, CRLF, stray CR); <utility> is included.

Readers are defensive: line_at/next_line handle an offset past the end, an empty golden or actual, a missing trailing newline (treated the same as one), a trailing blank line (reported as a difference), and CRLF vs LF. A missing golden returns a failure with the way to write it, not a crash. A failed write returns an error. No bug-level findings.

Nits:

  • The PR description says "6 cases"; the suite registers 7 (SIM_GOLDEN_CASES, including "a missing golden fails"). Fix the count. I did not run the suite, so the "passes" claim and "built together with the FRLG goldens" are the author's, not checked here.
  • The update branch of check_sim_golden (the file write) is not covered by a test; only with_crlf is. A write that fails partway leaves a truncated golden (WRITE truncates); acceptable for a dev-only update flag, but worth a comment.
  • SimGoldenTestCase::Expectation has an unused description that every case leaves {}; drop it or fill it.

dayfine added a commit that referenced this pull request Nov 13, 2026
@dayfine
dayfine merged commit 7a0b7de into nav/grid-story-steps Nov 13, 2026
dayfine added a commit that referenced this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant