Skip to content

AutoStory: story log, failure classes and the step outcome - #530

Draft
dayfine wants to merge 4 commits into
plza/upstream/s1-01from
plza/upstream/s1-02
Draft

dayfine wants to merge 4 commits into
plza/upstream/s1-01from
plza/upstream/s1-02

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Depends on #529

Adds the story log (one line format for checkpoint start, attempt, reset and pass in every game), the shared list of step failure classes (id, meaning, how a run sees it, what a retry should do), and the step Outcome and Pose, each with its own .cpp. These are what a run reports a step by, so every later layer names failures the same way. Tests: the StoryLog and StoryFailureClasses suites, 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: 15d9c5a

Verdict

NEEDS_REWORK

First-pass review (agent), own diff against plza/upstream/s1-01. Code health: 4 failures, all the known defaulted bool add_checkpoint_prefix in Pokemon_StoryLog.h (inherited; follow-up: an enum class CheckpointPrefix{ADD, AS_GIVEN} or an options struct, which also removes the /*add_checkpoint_prefix=*/false comments at the SV call sites). CI at review time: build/no-tabs pass, Fork Draft CI ubuntu / build pending.

High

  1. Pokemon_StoryOutcome.h, Pokemon_StoryPose.h: this PR declares Outcome::succeeded(), outcome_ok, outcome_unchanged, outcome_failed, outcome_game_not_running, to_string(const Outcome&), certainty_name, certainty_covers and to_string(const Pose&), but none is defined here: the definitions are in Pokemon_StoryEvents.cpp, which arrives later in the chain. It compiles only because nothing calls them yet; the first caller in this PR or a cherry-pick of it would fail to link. Either add the definitions here (a Pokemon_StoryOutcome.cpp / Pokemon_StoryPose.cpp, which is where they belong anyway) or move these two headers to the PR that defines them. They also have no tests here.
  2. Comments about the split, not the code (user theme T3): both headers say "Split out of Pokemon_StoryEvents.h, unchanged; it includes this header." - that file does not exist at this PR and the history belongs in the commit message. Replace with what the header is for (an Outcome is how an action or check ended; a Pose is where the player is believed to be). Same in Pokemon_StoryFailureClasses_Tests.cpp before OUTCOME_CASES: "the engine's code returns (autostory/engine), and #477's launch_failed" names a branch and a PR number.

Medium

  1. Pokemon_StoryOutcome.h Outcome: empty failure means success - a sentinel in a new API that every later PR builds on. succeeded() hides it, but every caller can still write outcome.failure.empty() / build an Outcome with an empty failure and a class. Consider std::optional<Failure> (name, detail, class) so success has no failure fields at all. Same pattern, smaller: Position::describe() returns "" for "nothing to say".
  2. Pokemon_StoryFailureClasses.cpp row tables: each StoryFailureClassInfo is a positional aggregate of six fields, three of them adjacent string_views (meaning, detected_by and the id). Swapping two lines compiles. Use designated initializers (.failure_class =, .id =, .meaning =, ...) - user theme T6.
  3. Pokemon_StoryFailureClasses_Tests.cpp ListCheckTestCase: Expectation::holds is never read, so the "expectation" is a comment in a struct; the check function is the whole test. Either drop the name/input/expectation shape for these (plain named functions are clearer) or make the expectation something the runner compares. Similarly Pokemon_StoryLog_Tests.cpp: Input::line is the formatter's output, computed during static initialization of the table; an exception there would abort before the runner starts. Make the input the call's arguments (or a lambda) and call it in run().

Low

  1. Pokemon_StoryFailureClasses_Tests.cpp header comment: "every sim fault ... maps to one class" - no test here looks at sim faults. SIM_MISMATCH / "the story sim" also refer to a simulator that is not in this repo; say what it is or drop the row until it lands.
  2. read_story_failure_class_tag() matches the first class= anywhere, including inside another word (subclass=lost_tap) or an earlier unrelated field. Fine for today's lines; a word-boundary check costs one comparison.
  3. GAME_NOT_RUNNING in Pokemon_StoryOutcome.h duplicates the "game_not_running" id/outcome strings in the class table; use the constant in the table (and test) or drop it.
  4. Unused includes: Pokemon_StoryPose.h includes MoveOnlyFunction.h, Pokemon_StoryLog.h, <vector>, <string_view>, <cstddef>; Pokemon_StoryOutcome.h includes <memory>, <set>, <vector>, Pokemon_StoryLog.h.
  5. Comment voice: // Constructs a successful event outcome..., // Formats a Pose as a human-readable string., // Returns the string label..., // Callable action executed for a story event. restate the signature and use // where the file uses // . Pokemon_StoryPose.h also points at Pokemon_TilePose.h, which is not in this PR.

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

# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
…hat they claim

Outcome's and Pose's functions were declared here but defined only with the
event runner; they get their own .cpp files. The checkpoint prefix flag is an
enum instead of a defaulted bool. The log tests call the formatter when they
run instead of during static initialization, the list checks are plain named
tests, and the failure class rows use designated initializers.
@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Review fixes, tip cce8838ea:

Fixed: 1 (Pokemon_StoryOutcome.cpp and Pokemon_StoryPose.cpp define Outcome's and Pose's functions here), 2 (split-history comments and the #477/branch reference), 4 (designated initializers in the class rows), 5 (list checks are plain named tests; the log tests call the formatter in run()), 6 (header no longer claims sim faults), 9 (unused includes), 10 (comment voice in the two headers, no Pokemon_TilePose.h pointer). Also the follow-up from the header: add_checkpoint_prefix is now enum class CheckpointPrefix{ADD, AS_GIVEN}.
Not changed: 3 (Outcome as optional touches every later PR; worth its own change), 7, 8.

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