Skip to content

AutoStory: tile grid, step kinds, action args and the built-in action table - #529

Draft
dayfine wants to merge 9 commits into
autostory/shared-statsfrom
plza/upstream/s1-01
Draft

dayfine wants to merge 9 commits into
autostory/shared-statsfrom
plza/upstream/s1-01

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Depends on #519

Adds the bottom of the shared AutoStory vocabulary: the tile grid and directions (Pokemon/Navigation), step kinds, typed action args and specs, grid poses, and the table of built-in story actions with the args each takes. A step's args are checked against its action's spec when read, so a typo in story data fails at load, not on the console. It also adds add_tests_AutoStory(), the one entry the unit test runner calls for the shared AutoStory suites. Tests: the StoryActionArg suite (synthetic, no CommandLineTests frames), 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.

CheckpointId parses "SS.CC" ids like "03.08" (exactly two digits, a dot,
two digits), prints them back, orders them, and starts_segment() tells a
caller when a run enters a new segment so it can count Segments Started.
FRLG splits boss battles out of a checkpoint without renumbering the
ones after it (00.12b, 12.02b). The suffix sorts after the bare id and
before the next checkpoint; starts_segment ignores it.
suffix is std::optional<char> instead of a '\0' sentinel, the fields have defaults and are private behind accessors, so parse() is the only way to build an id. Order tests take ids as text. The parse test expects one optional. Sorted the CMake list and the test-runner include; shortened the starts_segment comment.

@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: 82eccbd

Verdict

NEEDS_REWORK

First-pass review (agent), own diff against autostory/checkpoint-id. Code health: 0 failures (4 advisories). CI at review time: build/code-health/no-tabs pass; Fork Draft CI ubuntu / build still pending, so the StoryActionArg suite has not run yet.

Medium

  1. Types/Pokemon_StoryActionArg_Tests.cpp (header comment, the #ifndef/#ifdef PA_STORY_DATA_STANDALONE blocks and main()): nothing defines PA_STORY_DATA_STANDALONE, not in this PR, not in CMake/CI, not at 00c6ceb. The standalone main() is dead code and the comment promises a build that does not exist. Drop the macro, the guards and main(), or add the target that builds it.
  2. Types/Pokemon_DeclaredPose.h: nothing in this PR includes it, and TileDeclared is field for field GridPose (map, tiles, facing). Either move the header to the PR that reads declared poses, or say why the tile kind is not just GridPose (using TileDeclared = GridPose; or std::variant<GridPose, ZoneDeclared>).
  3. Pokemon/Navigation/Pokemon_Grid.{h,cpp}, Pokemon_Direction.{h,cpp}: Grid<Cell>, cell_at, TilePos::next, to_string(TilePos), the std::hash specialization, ALL_DIRECTIONS, direction_name (and story_step_kind_name) have no caller and no test in this PR. This is shared navigation code at the bottom of the chain; it should land with its tests (at least next per direction, contains on the edges, hash/<=> on negative coordinates), or with the PR that first uses it.

Low

  1. Comments point at things that do not exist yet at this PR: Pokemon_StoryActionArg.h -> Data/Pokemon_StoryStepJson.h; Pokemon_StoryStepKind.h -> Pokemon_StoryStepExecutor.h; Pokemon_StoryActionSpec.h -> StoryBackendKind and the "console_only" failure (the console_only field itself is unused here); Pokemon_DeclaredPose.h -> StoryPoseTraits::Declared and "the lint". Fine once the chain lands, but a reviewer of this PR alone cannot follow them; either add a "(later in the chain)" note in the PR description or move the field/comment with its user.
  2. Types/Pokemon_StoryActionSpec.h StoryArgSpec: required = true plus a fallback is representable and meaningless (the fallback is never used for a required arg). Three valid states (required / optional with fallback / optional without) - consider a small enum or document that the pair is invalid, and have story_args_errors or the table reject it.
  3. Types/Pokemon_StoryActionArg_Tests.cpp check_case(): "" means pass - a sentinel. std::optional<std::string> (failure text or nothing) says it in the type.
  4. Pokemon_MapUtil.h: value_at_it has no caller. Every call of value_if_at_it names the map twice (value_if_at_it<int64_t>(args, args.find("floor"))); a value_if<Type>(map, key) reads simpler. It is also not Pokemon- or AutoStory-specific, so Pokemon/AutoStory is an odd home if it is meant to be reused.
  5. Types/Pokemon_StoryActionArg.cpp story_arg_type(): C-style cast of index(); a valueless_by_exception variant gives an out-of-range enum. Nit-level, but a static_cast plus that note costs nothing.
  6. Comment style: // Action category classification for individual story steps., // Returns the readable string representation..., // Array containing all four cardinal directions., // Hash specialization for TilePos., // Grid coordinate with integer x and y components. restate the code and use // where the rest of the PR uses // . Replace with a why or drop.
  7. Pokemon_BuiltinStoryActions.h: the comment table above builtin_story_actions() repeats make_builtin_actions() line by line and will drift; point at the .cpp instead, or keep only the "first one is the default" rule.

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

…e step types

Nothing defines PA_STORY_DATA_STANDALONE, so the standalone main() and its
guards were dead. Pokemon_DeclaredPose.h has no reader here; it moves to the
PR that adds the step and checkpoint types that hold one.
@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Review fixes, tip 19b035106:

Fixed: 1 (standalone main() and guards dropped), 2 (Pokemon_DeclaredPose.h moved to #531, where the step types first hold one), 6 (check_case returns std::optional), 8 (static_cast with the valueless note).
Not changed in this pass: 3 (Grid/Direction tests), 4 (pointers to later PRs in the chain; they resolve once the chain lands), 5, 7, 9, 10. Open for a follow-up commit here.

@dayfine
dayfine changed the base branch from autostory/checkpoint-id to main November 15, 2026 19:15
@dayfine
dayfine changed the base branch from main to autostory/checkpoint-id November 15, 2026 19:27
@dayfine
dayfine changed the base branch from autostory/checkpoint-id to autostory/shared-stats November 15, 2026 20:35
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