Skip to content

Fix shared AutoStory engine review nits - #497

Merged
dayfine merged 2 commits into
nav/sharedfrom
autostory/engine-nits
Nov 15, 2026
Merged

dayfine merged 2 commits into
nav/sharedfrom
autostory/engine-nits

Conversation

@dayfine

@dayfine dayfine commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Fork draft based on nav/shared at 81e6a30c8; the diff contains only these follow-up review fixes.

The shared engine still used a string sentinel, copied failure-class groups, left scalar test fields uninitialized, and lacked the dev-only reload regression.

This replaces the sentinel with RunKind, moves each failure group once, initializes the fields, adds the regression, and splits save/retry tests into a registered 442-line file while reducing the runs test file from 990 to 700 lines.

Local checks passed with code health at 0 failures, all touched C++ units plus the test registry compiled under warnings-as-errors, and clean CRLF, no-tabs, and diff checks; Fork Draft CI provides the full build and test run.

How to review: the 257-line save/retry block moved unchanged from Pokemon_StoryEngineRuns_Tests.cpp; read the small fixes and registration first, then use git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change nav/shared...autostory/engine-nits to distinguish the move.

About 110 lines of test helpers (joined, has_line, expect_inputs, look, game_step, checkpoint_of, game_action, flaky_game, RunsCase, StoryEngineRunsTest) are copied into the new SaveRetry tests file, not moved; the originals stay in the runs test file.

@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: 019fa24

Verdict

NEEDS_REWORK

Four of the five #490 nits are done correctly and the test split is clean. The new reload_when_chained case does not cover the branch that nit 5 asked about, so that item is not done yet.

Major (blocking)

  1. Pokemon_StoryFiles_Tests.cpp, case "a dev-only reload after a user row that does not autosave fails": the case does not test the !execution.dev_only skip. Its only predecessor, 01.00 ("save": "menu"), is the predecessor in both the dev run and the user run. So it fails on the DEVELOPER check, the same way the existing case "reload_when_chained after a row that does not autosave fails" does. It also passes whether or not !execution.dev_only && is on line 107 of Pokemon_StoryFiles.cpp.
    • Nit 5 in the #490 review (#490 (review)) asked for the case that loads: a dev-only reloading row whose dev-run predecessor autosaves and whose user-run predecessor does not.
    • Fix: replace the case with one shaped like this:
      • input: 01.00 {"save": "menu"}, then 01.005 {"dev_only": true, "save": "autosave"}, then 01.01 {"dev_only": true, "reload_when_chained": true}
      • expectation: a .summary (it loads: autosave 01.005, chained 01.01, dev_only 01.005 01.01)
      • name: e.g. "a dev-only reload after a dev-only autosave row, the user's row before it not autosaving, loads"
    • That case fails with "... in a user's run" if the dev_only guard is removed, so it pins the guard.
    • The brief's wording ("a dev-only row that reloads after a user row that doesn't autosave") was ambiguous; the #490 review text is the source to follow.

Minor (non-blocking, follow-up OK)
2. Pokemon_StoryEngineSaveRetry_Tests.cpp: about 110 lines of test scaffolding are copied into the new file, not moved. The copies are joined, has_line, expect_inputs, look, game_step, checkpoint_of, game_action, flaky_game, RunsCase and StoryEngineRunsTest; the originals stay in Pokemon_StoryEngineRuns_Tests.cpp.

  • This repeats an existing pattern: joined was already defined in four other AutoStory test files.
  • The PR description says the block "moved unchanged". Please also say that the helpers are copied.
  • Follow-up: put them in a shared test-only header.

Checked, OK

  • RunKind (nit 1):
    • enum class RunKind{ DEVELOPER, USER } replaces the "" sentinel at both call sites.
    • run_suffix switches over both values and throws InternalProgramError if neither matches.
    • The message text is unchanged, so the existing "in a user's run" expectation still matches.
    • The function comment was updated.
  • Failure-class table (nit 2):
    • append takes each group by value from a prvalue, so the group is moved in and its elements are moved out. No copy is left.
    • The three stray blank lines before }; are removed.
  • ScreenEventLogCase (nit 3): ms, capacity and dropped are now = 0.
  • The move (nit 5):
    • git diff --color-moved=zebra --color-moved-ws=allow-indentation-change 81e6a30c8 019fa241b: all 288 removed lines in the runs test file are marked as moved. The only exceptions are the 5 lines of the file-header comment that were rewritten.
    • In the new file, every line that is not marked as moved belongs to the copied scaffolding above. No test body changed.
    • Case names are the same before and after: 37 .names across both files, compared after sorting.
    • The runs test file went from 990 to 700 lines.
  • Registration:
    • SourceFiles.cmake lists the new .cpp and .h.
    • Pokemon_AutoStory_Tests.h includes the new header and calls add_tests_StoryEngineSaveRetry.
    • Fork Draft CI run 43653585677 logs PASSED for all 5 moved cases ("save gets its checkpoint", "no retry after a save step", "console_only refused off console", "no reload for console_only", "verify saves after all passed"). It also logs PASSED for the new StoryFiles case, and the run reports Failed: 0.
  • The new files are CRLF and have the standard header and include guard. CI code-health and no-tabs are green.

@dayfine
dayfine marked this pull request as ready for review November 15, 2026 00:07
@dayfine
dayfine merged commit 2f729c4 into nav/shared Nov 15, 2026
17 checks passed
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