Skip to content

AutoStory: a checkpoint as story events, outcome classes and tile poses - #532

Draft
dayfine wants to merge 6 commits into
plza/upstream/s1-03from
plza/upstream/s1-04
Draft

dayfine wants to merge 6 commits into
plza/upstream/s1-03from
plza/upstream/s1-04

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Depends on #531

Adds the story-event model: a checkpoint as events that each state what must hold before (require), do one thing (act) and check what the game shows after (expect), with skip_if, retries, named recoveries and interrupts. It also adds the failure class of an Outcome and the tile pose the tile games hand the engine. Tests: the StoryEvents suite, built and run by Fork Draft CI. Part of the re-split of #522/#524/#525 into reviewable steps; review fixes are new commits on the PR that owns each problem, merged up the chain.

@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: 29440eb

Verdict

NEEDS_REWORK

First-pass review (agent), own diff against plza/upstream/s1-03. Size accepted as stated (825 non-test lines). Code health job passes; CI at review time: build/no-tabs pass, Fork Draft CI ubuntu / build pending. I read the runner (run_checkpoint / run_event / recover / clear_interrupts) for loops and escalation: every retry path is bounded (recovery attempts, max_interrupts_per_event), GAME_NOT_RUNNING short-circuits recovery, and exceptions are logged and rethrown. No correctness bug found there.

High

  1. Pokemon_StoryEvents.h header: "See docs/design/AutoStory-Event-Model.md." - that file does not exist (not at this PR, not in docs/design on the fork, and docs/design is not upstream at all). Put the needed design in the header comment (it mostly is already) and drop the pointer.

Medium

  1. Pokemon_StoryEvents.cpp is now the home of Outcome's, Pose's, Condition's and Recovery's out-of-line functions (outcome_ok, certainty_covers, to_string(Pose), pose_known, recovery_name, ...), declared in the headers #530/#531 added. The description even notes that Pokemon_StoryOutcomeClass exists because of it. Each of those headers should get its own .cpp in the PR that adds it (see the #530/#531 reviews); then this PR is the runner only.
  2. Pokemon_TilePose.{h,cpp}: Position is an open base class read back with dynamic_cast (tiles_of, facing_of), while #529's DeclaredPose models the same "tile game or zone game" split as a std::variant. Two encodings of one idea in the same chain; a variant (or the game's pose type as a template parameter) would drop the casts and the empty-vector "not a tile pose" answer from tiles_of. At least say in the header why it is open-ended.
  3. tile_pose(map, {}, ...) returns a pose with a non-null where and UNKNOWN certainty, while Pose's comment says where is null whenever the position is unknown. Either return where = nullptr for no tiles or fix the comment.
  4. Tests: StoryEventTestCase::Expectation::description is never compared (same shape issue as #530's ListCheckTestCase); the case table is a list of named functions wearing name/input/expectation. Plain registered functions would be honest; otherwise the expectation should be data the runner checks.

Low

  1. event_log_line / checkpoint_log_line here format "[Checkpoint] {}" again; Pokemon_StoryLog.cpp already has checkpoint_prefix(). One formatter for the prefix.
  2. Output parameters (T4): stop_checkpoint(..., CheckpointReport& report) both mutates and returns a copy of report; describe_line(..., std::string& text), describe_event(..., std::string& text), lint_*(..., std::vector<std::string>& problems) thread an accumulator. Returning the line / the problems and appending at the caller reads simpler.
  3. lint_recoveries: (int)recovery.kind < (int)last relies on RecoveryKind's declaration order being the escalation order. Say so on the enum (// In order of escalation; lint_recoveries() relies on it.).
  4. run_event: a RETRY (from an interrupt) logs nothing, so a log with an interrupt followed by a second "start"-less attempt is hard to read; a log_status("retry", run) costs one line.
  5. Comment voice: // Registers unit tests for story event sequencing and execution. style; and test descriptions like "executes registered events in sequence and records traces" read generated. Nit.

No brace-style, tabs, CRLF, Qt, std::filesystem or threading issues; SourceFiles.cmake lists every new file.

# Conflicts:
#	SerialPrograms/Source/Pokemon/AutoStory/Pokemon_AutoStory_Tests.h
#	SerialPrograms/cmake/SourceFiles.cmake
The Outcome, Pose, Condition and interrupt functions now live with the
headers that declare them, so they leave Pokemon_StoryEvents.cpp. The header
no longer points at a design note that is not in the repo, and the event
tests are plain named tests: their descriptions were never compared.
@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Review fixes, tip effea5e83:

Fixed: 1 (design-note pointer dropped), 2 (the Outcome/Pose/Condition/interrupt definitions moved to the PRs that declare them; this file is the runner only), 5 (StoryEvents cases are plain named tests).
Not changed: 3, 4, 6, 7, 8, 9, 10.

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