Skip to content

AutoStory: action registry, shared built-in actions and the step runner - #539

Draft
dayfine wants to merge 12 commits into
plza/upstream/s2-04from
plza/upstream/s2-05
Draft

dayfine wants to merge 12 commits into
plza/upstream/s2-04from
plza/upstream/s2-05

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Depends on #538

Adds the action registry (a game's actions over the shared built-ins, checked against their specs before anything runs), the shared built-in actions written once against the backend, and the step runner that runs one step through the registry. Tests: the StoryEngine suite over a scripted fake backend (also added here), 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: febd94c

Verdict

NEEDS_REWORK

First-pass review of this PR's own diff against plza/upstream/s2-04. Code health: 0 failures, 2 advisories. One allow tag (FakeStoryBackend public_methods=12) has a reason that holds up. Fork Draft CI build passed; the ubuntu job was still pending when read.

High

None.

Medium

  1. walk_legs may report a pose the player never reached. Engine/Pokemon_StoryBuiltinActions.cpp:117. StoryBackend::tap() is documented (#538) as "one tile in direction, or a turn to face it". walk_legs taps leg.tiles times per leg, and after_legs() then advances the pose by every tile. A leg whose direction differs from the current facing spends its first tap on the turn (BDSP: a 40-80 ms tap only turns), so the walk ends a tile short, yet the outcome's pose claims the full move. Either add a turn tap when the facing changes, or document that legs assume each tap moves a tile and have the backend guarantee it. Add a test case for a turn followed by a move.

  2. Half the registry's logic has no test in this PR.

    • StoryEngine_Tests.cpp instantiates only GridPose; there are 0 ZonePose cases. So the no-tiles path is untested: tile_arg_problems, check()'s tile-arg rejection, legs and face dropped from the built-ins, and undeclarable().
    • lint() (empty or repeated step names, check_declared) is never called. Only check() is.
    • The console_only refusal in dispatch() (CONSOLE_ONLY) and console_only readers in holds() have no case.

    A few table cases would cover each of these, using a ZonePose fake from the same FakeStoryBackend.

  3. Two comments describe history or lab runs, not the code:

    • Engine/Pokemon_StoryStepRunner.h:8-9: "it replaces StoryStepExecutor and the games' own executors". StoryStepExecutor is still here, and Pokemon_StoryStepRunner.cpp includes it.
    • Engine/Pokemon_StoryEngine_Tests.cpp:70 ("FRLG 00.31 (console B, 2026-11-10) took it so and saved on ...") and :307 ("the old wait ... 00.31's false pass").

    Say what each piece does and what the fault looks like on screen. The run and its date belong in the PR description (user theme T3).

Low

  1. "unsupported_step" is spelled as a raw literal at Engine/Pokemon_StoryBuiltinActions.cpp:40 and :49, while dispatch() uses the unsupported_step(step) helper. Use one spelling, e.g. a named constant like CONSOLE_ONLY (user theme T5).
  2. Engine/Pokemon_StoryBuiltinActions.cpp:81 backend.wait(100ms) with MAX_OPEN_LOOKS = 20 gives a 2 s window for a text box. Name the 100 ms next to the other text constants and say why 2 s is enough (T2).
  3. Engine/Pokemon_StoryBuiltinActions.cpp:55 (mash_to_overworld) and :128 (answer) declare using namespace std::chrono_literals; but use no literal.
  4. Engine/Pokemon_StoryActionRegistry.h:63 pause_points() const returns a mutable reference to a mutable member, so a const registry hands out run state. Consider having the runner or engine own StoryPausePoints and keeping the registry immutable.
  5. Engine/Pokemon_StoryActionRegistry.cpp:25 and the other helpers use inline inside an anonymous namespace, which is redundant. undeclarable(..., bool tile) takes a bool parameter. Pass StoryPoseTraits<PoseType>::TILE_MOVES through a template instead, or just the two messages.

Checked: brace style, no std::filesystem/std::thread/std::mutex, CRLF kept, new files are in SourceFiles.cmake, and the includes resolve against the parents. Test cases follow the name / input / expectation shape.

…t the run

The step runner's header says what it is rather than what it replaced, and
the warp test describes the wrong-floor fault instead of the console run
that found it.
@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Review fixes, tip 86f3dad15:

Fixed: 3 (step runner header and the engine test comments describe the code and the fault, not the run).
Not changed: 1 (walk_legs and turn taps is a behavior question for the game backends; needs a console check before changing), 2 (ZonePose/lint/console_only cases), 4-8. #542's handler_sees_step, stick_and_heading and buttons_by_name still test this PR's code from #542; not moved in this pass.

@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Second fix round, tip 40f08f844: the tests of this PR's code moved here from #542's StoryEngineRuns suite (commits ff8a5cf, 40f08f8): "fake backend - stick and heading" and "fake backend - buttons by name" as a BackendCase table, and "registry - handler sees its step" as a registry row with an action that logs the step it was handed. Code health on this PR: 0 failures.

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