Skip to content

AutoStory: review fixes on the shared engine (#312, #313, #332, #474, #479) - #490

Merged
dayfine merged 7 commits into
nav/sharedfrom
autostory/engine-fixes
Nov 14, 2026
Merged

dayfine merged 7 commits into
nav/sharedfrom
autostory/engine-fixes

Conversation

@dayfine

@dayfine dayfine commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Base: nav/shared. Follow-up to #312, #313, #332, #474 and #479 (all merged); the diff shows only this change.

Fixes the should-fix review findings left on the shared AutoStory engine before a game moves onto it.

Testing: new cases in the StoryEngine runs and save suites, StoryFiles, StoryStepJson, StoryFailureClasses and ScreenEventLog tests; touched files compiled locally, code health 0 against nav/shared, Fork Draft CI runs the suites.

A reload after that save would land mid-checkpoint while the retry runs
from step 1. The engine now records the save and ends the checkpoint's
attempts there.
…text

A test pins that the engine's SAVE step saves nothing in a testing run;
StoryStepExecutor::run says a game off the engine must gate it itself.
The step reader accepts once_per_save. The Save and Verify Mode texts
say when After verification saves.
Declared poses reach the run as the event layer's pose; a zone's spot and
heading are not carried until a game has a position reader.
… value

INTEGER_ROWS stays: FRLG's foe_threats and BDSP's avoid args use it.
A user's run skips dev-only rows, so the row a reload follows there must
autosave as well.
story_failure_class_info() throws for a class with no row in its place,
and a test checks every class has one.
Covers the first frame's rises, rose/fell edges, the capacity drop and
describe().

@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: a80d9f3

Verdict

APPROVED

Approved with nits; nothing blocks the merge. All seven items do what the description says.

Checked

  • No retry after a part-way SAVE: m_saved_part_way is declared before m_game, so the gated handler's reference is safe. It is reset in run_once() and is set only when the save succeeded. run_with_retries returns FINAL before repeats_on_reload. The new runs case checks that there is no [Test] reload and that the no-retry line is logged.
  • reload_when_chained: the user-run predecessor is held as an index, not as a view into data.checkpoints, so push_back cannot leave it dangling. A dev-only row skips the user-run check. Both new load cases cover the intended paths.
  • Failure-class table: function-local static. The lookup checks both the index and failure_class. every_class_has_a_row together with rows_in_enum_order covers the whole enum.
  • Both static_asserts match the last enumerators (SWITCH_HOME_MENU, TIMED_LEGS). The one on StoryArgType checks the count only, which is enough here.
  • CI: Fork Draft CI at this SHA (run 43649720085) ran and passed all 12 new tests: StoryEngine runs "no retry after a save step", StoryEngine save "save step skipped while testing", both StoryFiles reload cases, StoryStepJson "once per save" and "every time by default", StoryFailureClasses "every class has a row", and the four CommonTools::ScreenEventLog cases. The log has no FAILED lines.
  • Code health against origin/nav/shared: 0 failures. CRLF is kept in the touched files.
  • I also built Pokemon_StoryStepJson at this SHA against PokemonSimulation#104's wire cases. All 70 cases agree; see that PR.

Nits (follow-up or the next touch)

  1. Pokemon_StoryFiles.cpp check_reload_after(..., std::string_view run, ...): "" stands for the developer's run, which is a string sentinel. Use a small enum (dev run / user run) that picks the suffix.
  2. Pokemon_StoryFailureClasses.cpp class_rows(): for (std::vector<StoryFailureClassInfo> group : {...}) copies each group out of the initializer_list, so make_move_iterator moves from that copy. Use const auto& group with a plain insert. It runs once, so this is about clarity only.
  3. Same file: there is a stray blank line before }; at the end of run_rows(), walk_rows() and warp_rows().
  4. ScreenEvents_Tests.cpp ScreenEventLogCase: int ms, size_t capacity and size_t dropped have no initializers. AGENTS.md says to initialize every scalar, so add = 0.
  5. Test gap: there is no case for a dev-only row with reload_when_chained whose user-run predecessor does not autosave. It should load, because only the dev run is checked. One row in LOAD_CASES would pin that branch.
  6. Advisory: Pokemon_StoryEngineRuns_Tests.cpp is at 990 of the 1000-line limit, so the next case added there needs a split first. The StoryRunOptions constructor is at 50 of the 50-line limit.

@dayfine
dayfine marked this pull request as ready for review November 14, 2026 23:04
@dayfine
dayfine merged commit 81e6a30 into nav/shared Nov 14, 2026
16 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