Repository navigation
AutoStory: save modes and a postcondition check - #329
Merged
Merged
Conversation
A run's own verdict can be wrong (FRLG 00.31, 2026-11-10: a warp leg confirmed B3F while still on B4F) and its save overwrote the only save. - StorySaveMode none / after_verification / per_checkpoint, and story_save_allowed() as the decision table. A failed checkpoint never saves. SegmentPolicy and VerifyPolicy carry the mode; StoryRunOptions shows it (default none) and a "check postconditions only" option. - run_segment: none skips every save (logged), after_verification saves once at the run's end after the game's postcondition check (a failed check fails the run, no save), per_checkpoint is today's behaviour. Without per-checkpoint saves only the first checkpoint reloads. - verify_checkpoint: after_verification saves at the end of the last run when every run passed. - StoryPostconditions on the checkpoint (position, items, flags) in the checkpoint JSON, and check_postconditions(): what the game can't read is "not checked", never passed. 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 10, 2026
What PLZA (#335) had to work around, now in the engine: - FakeStoryBackend and its script are templated on the pose (GridPose and ZonePose instantiated); ZonePose moves into the engine (cherry-picked). - StoryBackend::stick(degrees, duration, pace) for free-moving games, and the "heading" reading (STORY_HEADING, story_heading()). - ScreenEvent gains CHOICE_BOX and INTERACT_PROMPT. - run_screen_machine_on_observations(): ScreenMachine states over looks, failures returned; ScreenMachineChecks::problem() for observations; StepTrace without video (lines to a log, no screenshots). - Handlers get a StoryActionCall {step, args}; StoryGame::save gets the checkpoint. - StoryEngine::run_segment() and verify_checkpoint(): retries only when a reload returns to the checkpoint's start save (#329), no reload for lint, console_only or game-not-running failures; verify saves only on the last run when every run passed. - StoryActionSpec::console_only, refused off a console as "console_only"; StoryBackend::kind(). - StoryPoseTraits: TILE_MOVES (legs/face only for tile games) and from_declared() (a checkpoint's start and declared_after read as the game's pose; the lint fails what does not fit). A declared pose may omit "tiles". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…ory/save-policy StorySegmentTypes.h gets StoryRunCounts from Pokemon_AutoStoryStats.h now; it no longer needs Pokemon_StoryLog.h. 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
The postcondition checks take their result vector last, set_save takes the checkpoint last, and SegmentHooks::check_postconditions now takes (checkpoint id, RunState&). Messages are built with std::format. Pokemon_StorySavePolicy_Tests.h declares the suite's add_tests function; the test file includes only that header. 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
Keeps the save-mode logic in Pokemon_StorySegments.cpp with nav/shared's order: say(line, hooks), and run_row, verify_run and verify_summary take their inputs first and the RunState or report last. run_segment and verify_checkpoint calls in the save-policy tests follow. 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Owner
Author
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.
Base:
nav/story-engine(#312). The diff shows only this change. FRLG/BDSP wiring follows once their stacks have merged #312.A checkpoint run used to save at every checkpoint on its own verdict; FRLG 00.31 (2026-11-10) reported a false pass on B4F and its save overwrote the only start save. This adds the save policy from
autostory/SAVE_POLICY.mdto the shared run code.StorySaveModenone / after_verification / per_checkpoint, withstory_save_allowed()as the decision table; a failed checkpoint never saves.StoryRunOptionsshows it (default none) plus "Check postconditions only".run_segment: none logs each skipped save; after_verification saves once at the run's end, after the game's postcondition check (SegmentHooks::check_postconditions; a failed check fails the run and refuses the save; no check is logged as "not checked"); per_checkpoint is today's behaviour and stays the engine default. Without per-checkpoint saves only the first checkpoint retries with a reload.verify_checkpoint: after_verification saves at the end of the last run when every run passed.postconditions(position, items with quantities, flags) on the checkpoint JSON, andcheck_postconditions(): map, tile and facing (end pose frompostconditions.position, else the last step's target), item counts and flags, each passed / failed / not checked. Not read is never passed.Testing: new
Pokemon::StorySavePolicysuite (decision table, each mode throughrun_segmentand verify mode, and the postcondition check on 00.31's end state: pass, the B4F false pass, not checked).StorySavePolicy,StorySegments,StoryStepJson,StoryEvents,StoryStepExecutor,AuthoredCheckpointJsonandStoryRangeOptionspass in the headless runner; fullSerialProgramsbuild passes on macOS.🤖 Generated with Claude Code
https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss