Skip to content

Story wire cases: steps as an action plus typed args - #104

Merged
dayfine merged 1 commit into
mainfrom
story-cases-v2
Nov 14, 2026
Merged

dayfine merged 1 commit into
mainfrom
story-cases-v2

Conversation

@dayfine

@dayfine dayfine commented Nov 14, 2026

Copy link
Copy Markdown
Owner

The shared story cases in data/story/wire-conformance.json still used the old step format (per-kind fields, variant, certainty/where poses), which Arduino-Source's native reader has rejected since the #312 review, so its CI stopped reading them. This moves the cases to the format that reader reads: a step names an action and its typed args, poses are {map, tiles, facing} or a zone {place, spot, heading}, and the file declares the test game actions. checkpoint_wire gains read_story_step/read_story_checkpoint/read_grid_pose/read_declared_pose matching the native reader; the old readers stay for the authored plans and the replay, which still use the older record. Tested with the Python suite (3.8) and a local native build of Pokemon_StoryStepJson (autostory/engine-fixes, with once_per_save) over the same file: 70 cases, accept/reject and every read value agree.

…eader reads them

data/story/wire-conformance.json moves to pokesim-story-wire-cases/2: steps
name an action and its typed args, poses are {map, tiles, facing} or a zone
{place, spot, heading}, and the file declares the test game actions. Accepted
cases give the record as read, args with fallbacks filled.

checkpoint_wire gains read_grid_pose, read_declared_pose, read_story_step and
read_story_checkpoint, matching Arduino-Source's Pokemon_StoryStepJson
(built-in actions, arg types, once_per_save). read_pose/read_step/
read_checkpoint stay for the authored plans and the replay, which still use
the older record. The legacy schema no longer checks the wire cases.

@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: 70dccff

Verdict

APPROVED

Approved with nits. The PR's claim holds.

Independent check of the claim
I built a harness around Arduino-Source's read_story_step, read_story_checkpoint, read_grid_pose and read_declared_pose, with this file's four game actions as StoryActionSpecs. It reads each case of data/story/wire-conformance.json, and I compared the results with each case's rejected or read. Two normalizations were needed: an absent tiles compares as [], and checkpoint metadata defaults (phase testing, empty source) are filled in, because the C++ structs can't tell those apart from absent.

  • Against dayfine/Arduino-Source#490 at a80d9f3d: 70 cases, 0 disagreements. All 34 accepted cases match value for value, and all 36 rejected cases throw. I checked each rejection reason; each one names the intended fault, for example unknown action mart for "action of another kind".
  • Against nav/shared at 9a093aba (without #490): 2 cases disagree, "all shared fields" and "empty fields read as absent". Both fail with unsupported field once_per_save.
  • The Python suite passes locally (3 tests), and CI is green on this SHA.

Merge order
Nothing on Arduino-Source reads this file today: story-data.yml pins PokemonSimulation 866613f, and StoryDataTests has its own native cases. Merging this PR therefore breaks nothing. Moving that pin to this revision needs #490 merged first, because of once_per_save. That pin bump is a follow-up on Arduino-Source.

Nits

  1. test_checkpoint_wire.py counts KeyError and TypeError as a rejection. A reader bug that raises TypeError (for example len() on a non-list) would pass as a correct rejection. Make the readers raise ValueError for every malformed input and assert only ValueError. Today KeyError comes from missing id, title, item, quantity, steps_hash and similar fields.
  2. schemas/story-checkpoint.schema.json still describes the old record. That is right for the authored plans and the native export, but no schema covers v2 now that the schema test is dropped. One line in CHECKPOINT_CONTRACT.md saying the schema is the old record's would stop someone from validating v2 cases against it.
  3. read_action_specs accepts an arg that is both required and has a fallback. The C++ side would never use that fallback either. Rejecting the combination keeps the declared specs honest.

@dayfine
dayfine marked this pull request as ready for review November 14, 2026 23:03
@dayfine
dayfine merged commit 4e023f3 into main Nov 14, 2026
8 checks passed
@dayfine
dayfine deleted the story-cases-v2 branch November 14, 2026 23:06
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