Repository navigation
Story wire cases: steps as an action plus typed args - #104
Conversation
…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.
There was a problem hiding this comment.
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 martfor "action of another kind". - Against
nav/sharedat 9a093aba (without #490): 2 cases disagree, "all shared fields" and "empty fields read as absent". Both fail withunsupported 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
test_checkpoint_wire.pycountsKeyErrorandTypeErroras a rejection. A reader bug that raisesTypeError(for examplelen()on a non-list) would pass as a correct rejection. Make the readers raiseValueErrorfor every malformed input and assert onlyValueError. TodayKeyErrorcomes from missingid,title,item,quantity,steps_hashand similar fields.schemas/story-checkpoint.schema.jsonstill 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.read_action_specsaccepts an arg that is bothrequiredand has afallback. The C++ side would never use that fallback either. Rejecting the combination keeps the declared specs honest.
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.