Repository navigation
Conversation
dayfine
left a comment
There was a problem hiding this comment.
Reviewed SHA: 3ed042a
Verdict
NEEDS_REWORK
First-pass review (agent), own diff against plza/upstream/s1-04. Code health job passes; CI at review time: build/no-tabs pass, Fork Draft CI ubuntu / build pending. The JSON reader is strict and well covered (unknown fields, kinds, actions, args, wrong types, both/neither pose kinds); no correctness bug found in the readers or in build_story_checkpoint's wrapping (pause, once-per-save).
Medium
Data/Pokemon_StoryStepJson.cppDIRECTIONSrepeatsdirection_name()(#529) as a second table, andKINDSis a third spelling of the step kinds besidestory_step_kind_name()("MASH"/"scene", "GAME"/"game_action"). Paired tables that encode one mapping drift (T7). Make one two-way table per enum (the wire name), and derive the log name from it or say why they differ.Pokemon_StoryStepExecutor.hStoryStepExecutor: the comment says "an interface with no data", but it holdsStoryPausePoints* m_pauseset throughset_pause_points(), a non-owning pointer whose lifetime is a comment.build_story_checkpoint()is the only reader; pass the pause points to it (as it already takesPreparedSteps*) and the executor stays a pure interface.grid_pose_of(const DeclaredPose&)turns aZoneDeclaredinto aGridPosewithmap = placeand silently dropsspotandheading;pose_ofthen gives the run an UNKNOWN pose on a "map" that is really a place. The executor is documented as tile-games-only; either reject a zone pose here (a ParseException-like failure / lint problem) or keep the zone fields. Related:read_declared_posecopies aGridPosefield by field intoTileDeclared, which is the same struct (see #529 item 2).read_metadata(const JsonValue&, std::string_view, StoryCheckpoint& checkpoint): output parameter filling two fields of the caller's checkpoint (T4). Return{metadata, postconditions}and assign at the call site.
Low
integer()throws "coordinate exceeds native int" for every int it reads (tiles, leg tiles, timed-leg turn and ms, heading). Say "integer out of range" or pass what it is.- Error messages lose context:
read_story_stepthrows "Empty story step id." andread_story_checkpoint"Empty or duplicate story event id." withoutsourceor the id;read_verification/read_metadatacallto_string_throw()withoutsource, unlike the rest of the file. A story author gets no file name for these. lint_story_checkpoint: "once per save with skip_if" is a problem because the addeddone_from_this_savecondition is ANDed with the step's ownskip_if; the comment ("skip_if's conditions must all hold; once per save is one more") hints at it. Say the consequence: such a step would never skip.- Test names "old field", "old variant", "old pose" describe our earlier wire formats (T3); name them by what they reject ("may_lose outside args", "variant instead of action", "certainty/where pose").
- Include guard
PokemonAutomation_StoryStepJson_Hdrops thePokemon_of the file name used by every other guard in the chain. - Header comment claims behavior not in this PR (language fallback via
StoryRunOptions, "the story engine's own SAVE action"). Fine once the chain lands; for this PR alone it describes code a reviewer cannot see.
Note for #531: the "pause points pause before each step" case here covers some of StoryPausePoints, but from the executor; OFF/STEPS/LEGS and before_leg are still untested.
No brace-style, tabs, CRLF, Qt, std::filesystem or threading issues; SourceFiles.cmake lists every new file.
# Conflicts: # SerialPrograms/Source/Pokemon/AutoStory/Pokemon_AutoStory_Tests.h
…one test build The JSON reader read directions from its own copy of direction_name()'s table; it uses the shared names now. The step kind table stays, with a note on why its wire names differ from the log names. The standalone test entry point is dropped (nothing builds it), rejected-format cases are named by what they reject, and the executor tests are plain named tests.
|
Review fixes, tip Fixed: 1 for directions (read_direction() uses direction_name() over ALL_DIRECTIONS; the copy is gone), 8 (cases named by what they reject), 9 (include guard). Also dropped the standalone test entry point and the PokemonSimulation case-file mention; executor cases are plain named tests. |
|
Second fix round, tip |
Depends on #532
Adds the tile games' step executor (one vocabulary of steps: a route, a fixed walk, a talk, a battle, the nurse, a shop, a save) and the strict JSON readers for poses, steps and checkpoints. Reading story JSON happens only in this layer; a step comes out with its args typed and checked. Tests: the StoryStepExecutor and StoryStepJson 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.