Repository navigation
AutoStory: shared story files, dev-folder override and execution keys - #474
Merged
Merged
Conversation
PLZA's built-in checkpoint files with a dev-folder override, its shared execution keys (save autosave/menu, reload_when_chained, dev_only), the run-row helpers and StoryActionNotImplemented, as game-agnostic engine code under Pokemon/AutoStory/Data and Engine, parameterized by the game's slug, checkpoint reader and lint hook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Template functions declared before their definitions, add_story_row's output parameter last, and the allow tag on Exception::name()'s base signature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
added a commit
that referenced
this pull request
Nov 14, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
added a commit
that referenced
this pull request
Nov 14, 2026
PLZA's checkpoint files now load through Pokemon::load_story_data() (#474): PokemonLZA_AutoStoryStoryFiles keeps only PLZA's reader (the shared execution fields, "save" still required and "dev_only" still refused), its lint and the starts_without_save hook. StoryData is Pokemon::StoryData<StoryCheckpoint>; StoryRunPolicy, story_run_rows, reloads_before, the dev-folder files and StoryActionNotImplemented are the engine's. The generic dev-override and execution-field cases go to the shared Pokemon::StoryFiles suite; the production-rows test pins the rows, autosaves and reloads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
added a commit
that referenced
this pull request
Nov 14, 2026
Brings in the shared story files and the autostory/engine updates under them. Adapts BDSP to two moves on that side: the screen events now live in CommonTools/ScreenEvents (namespace PokemonAutomation, SwitchHomeObserver in NintendoSwitch_HomeScreenObserver.h), and type_on_system_keyboard is now FastCodeEntry::type_on_system_keyboard. The system keyboard detector takes the engine side's version; BDSP calls only its shared API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
added a commit
that referenced
this pull request
Nov 14, 2026
load_bdsp_story() reads the embedded checkpoints through Pokemon::load_story_data (#474), so a BDSP run gets the dev-folder override (<user files>/AutoStoryDev/bdsp/) and the shared execution keys: the reader takes "save", "reload_when_chained" and "dev_only" next to BDSP's "on_failure" and "saves_in". The rows stay in id order. A run reads the dev files at its start and logs each one it uses; the dropdowns and the run list dev_only rows only in Developer Mode. story_checkpoints() stays the built-in rows, so tests never read the user's dev folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…ata moves to StoryRowExecution.h load_story_data checked reload_when_chained in file-name order, but BDSP plays its rows in id order (bdsp-mine-01.03 sorts after 01.11 by name). StoryFileReader::plays_before lets a game give its order; the loader sorts the rows by it before checking reloads. StoryData moves to the data-only Pokemon_StoryRowExecution.h, so a game's table header need not include the file loader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…order StoryFileReader gains in_story_order(id). When a game sets it, load_story_data() throws ParseException naming the file (the dev file's path for an override) and the id of any checkpoint the game's story order does not list, instead of skipping it or sorting it to the end. Games that keep no list leave it unset and load as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
added a commit
that referenced
this pull request
Nov 14, 2026
dayfine
added a commit
that referenced
this pull request
Nov 14, 2026
…y_order load_frlg_story() sets #474's StoryFileReader::in_story_order from STORY_ORDER, so a file whose id it does not list fails naming the file and the id. Its own check after the load keeps only the duplicate-id test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine
commented
Nov 14, 2026
dayfine
left a comment
Owner
Author
There was a problem hiding this comment.
Verdict: mergeable on the fork
Reviewed SHA: 2a0c69b
Verdict
APPROVED
Correctness pass on git diff origin/autostory/engine...origin/autostory/shared-story-data, then a style pass. CI green. No existing comments. Nothing on this branch calls the new APIs yet; the PR body names the adopting game PRs. No blocking findings.
Should-fix
Data/Pokemon_StoryFiles.h:191withData/Pokemon_StoryFiles.cpp:72— thereload_when_chainedcheck takes the previous row from the full order, dev-only rows included.story_rows_for_mode(..., USER)(:204) then drops the dev-only rows. So when a dev-only row is the autosave row before a reloading row, a user's run reaches the reload from a row that does not autosave, and the reload loads an older save. That is the case the check is meant to refuse. Either check against the previous non-dev-only row as well, or refuse a dev-only autosave row that a reload depends on.
Nits
Data/Pokemon_StoryFiles.cpp:19—known |= ...over every built-in file:std::ranges::any_of, or reusefind_dev_file()'s comparison, reads more clearly.Engine/Pokemon_StoryActionNotImplemented.h:18— the comment says "a game's backend lets it end the run". On this branch the engine's catch turns it intooperation_failed(Pokemon_StoryActions.cpp:133), which reloads and retries. Say that only a game backend that catches it ends the run (PLZA today).- The PR description has a garbled paragraph ("The name / Adoption") and the FRLG adoption note twice; worth a tidy-up before anyone reads it for handoff.
…merged, review fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #332
PLZA (#335, #354) built a few AutoStory pieces that don't depend on the game: checkpoint files built into the program with a dev-folder override (
<user files>/AutoStoryDev/<game>/), thesave/reload_when_chained/dev_onlyexecution keys, the run-row helpers, andStoryActionNotImplemented. This PR adds them to the shared engine asPokemon/AutoStory/Data/Pokemon_StoryFiles.h,Pokemon_StoryRowExecution.h,Pokemon_StoryDevFiles.handEngine/Pokemon_StoryActionNotImplemented.h. Each game passes in its slug, its own checkpoint reader, its lint hook and, when it does not play its files in name order, aplays_beforeorder; the loader checksreload_when_chainedin that final order.StoryDatalives in the data-onlyPokemon_StoryRowExecution.h, so a game's table header need not include the loader. No game code changes here. The newPokemon::StoryFilesunit suite covers loading, dev overrides, the execution keys, rows per mode and reloads. I compiled the touched files locally; CI runs the suite.Not moved: PLZA's SceneMachine is built around PLZA's own readings (mission banner and complete card, controls hint, autosave badge) and
PlzaBackend, and the engine already has the shared settle rule (TalkOverinPokemon_SceneJudges.h: B while quiet, done after 5 s of quiet overworld). A shared copy would be a second scene judge, so PLZA should move ontoTalkOverplus its readings instead. The name / AdoptionPokemonLZA_AutoStoryTable.hcan includePokemon_StoryRowExecution.hforStoryDatain place ofPokemon_StoryFiles.h; its reader is unchanged (it keeps requiring "save" and refusing "dev_only" itself).load_bdsp_storyinPokemonBDSP_AutoStory_StoryData.cpppasses.plays_before(id order) toload_story_dataand drops its ownstd::sort; the duplicate-id check stays.read_story_checkpoint_file'sExecutionReadercallsread_story_row_execution(execution, where, {"menu", "supplies", ...})in place ofonly_fields, andstory_checkpoints()callsload_story_datawith the dev files fromstory_dev_folder("frlg")andin_story_orderasplays_before.FRLG in
PokemonBDSP_AutoStory_StoryData.cpp(validate_json_fields→read_story_row_execution(..., {"on_failure", "saves_in"}),load_authored_story→load_story_dataand then its sort), withstory_dev_folder("bdsp"). About +15 / -10 lines.A game with a story order sets
in_story_order(id)on its reader; a built-in or dev file whose checkpoint id that order does not list is then a load error (ParseExceptionnaming the file, or the dev file's path, and the id), not a skipped or misordered row. It is a load error rather than a per-run refusal: built-in files load once and fail the unit tests, and dev files are read at each run's start, so a misnamed override stops that run with the message before it plays anything while a valid override loads as before. Games without a list (BDSP, PLZA) leave it unset.🤖 Generated with Claude Code
https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss