Skip to content

AutoStory 2D core: scene judges, transitions and interrupts - #361

Merged
dayfine merged 14 commits into
nav/grid-navfrom
nav/grid-screen-state
Nov 13, 2026
Merged

dayfine merged 14 commits into
nav/grid-navfrom
nav/grid-screen-state

Conversation

@dayfine

@dayfine dayfine commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Depends on #360 (base nav/grid-nav; the diff shows only this change).

Second 2D core PR: brings back the screen-state pieces only tile games use, which left #313 in f4b149c: Interrupts, Transitions, SceneJudges, FadeProfiles and WarpJudge with the Interrupts and Transitions suites. The warp-seen and talk-over cases that used to sit in the core ScreenEvents suite now live in a new Pokemon::SceneJudges suite. Review fix: TransitionTracker::push() ignores samples with no stats, so an empty or dropped frame can no longer start a black fade; the Transitions suite gained empty-frame cases (red before the fix).

Testing: headless SerialProgramsTests (scratch merge of the headless runner, not in this branch), --filter for Pokemon::Transitions, Pokemon::SceneJudges and Pokemon::Interrupts: all pass. Code health 0 failures: python -m devtools.code_health --base-ref origin/nav/grid-nav --root <worktree> from the agents checkout, at 8e0fa63.

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

Restores the files commit f4b149c moved out of nav/screen-state, unchanged:
Interrupts, Transitions, SceneJudges, FadeProfiles and WarpJudge with their
tests. The warp-seen and talk-over cases now live in Pokemon_SceneJudges_Tests
rather than back in the core Pokemon_ScreenEvents_Tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine

dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

API review (claude-sonnet-5-5) at 3be04b2: LGTM_with_nits

No bugs or hard-rule violations found. The synthetic expectations I spot-checked against the tracker and classifier logic agree (timeout boundary, log overflow, FRLG flash, fade-in-progress). The findings below are judgement-level only: two comments that describe the PR instead of the code, headers split from their definitions, redundant includes, and a few small readability items.

  • [style] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_FadeProfiles.h:5 The header comment says "Split out of Pokemon_Transitions.h, unchanged; it includes this header." That is history of this PR, not what the file is. It will be wrong or meaningless after the next edit. Pokemon_WarpJudge.h line 5 has the same problem. Fix: Replace it with what the file holds, e.g. "Per-game fade thresholds (FadeProfile) and the transition kinds the tracker reports." Put the split history in the PR description or commit message.
  • [nit] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_FadeProfiles.h:13 , , ImageStats.h and VideoFeed.h are included but nothing in this header uses them. It only needs , and Time.h. Extra includes in a header that Transitions.h, WarpJudge.h and Interrupts.h all pull in widen the rebuild surface. Fix: Drop the unused includes. Pokemon_Transitions.h already includes what it needs itself.
  • [nit] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_FadeProfiles.h:73 This header declares BDSP_FADE_PROFILE, FRLG_FADE_PROFILE and transition_kind_name(), but their definitions live in Pokemon_Transitions.cpp. The same split happens with Pokemon_WarpJudge.h: warp_judgement_name() and both judge_warp() overloads are defined in Pokemon_Interrupts.cpp. Anyone following a header to its .cpp lands in the wrong file. Fix: Add Pokemon_FadeProfiles.cpp and Pokemon_WarpJudge.cpp and move the definitions there. Alternatively, say in each header which .cpp defines its declarations.
  • [nit] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_Interrupts.cpp:8 The file uses std::string_view (the separator in describe()) and std::chrono::duration_cast but does not include <string_view> or . It builds only through transitive includes, which is fragile under /W4 /WX across MSVC, GCC and clang. Fix: Add #include <string_view> and #include .
  • [nit] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_SceneJudges.h:80 The parameter of TalkOver::look() is also named look, so it shadows the member function it belongs to. It reads as if look were recursive. Fix: Rename the parameter to events, to match note_warp().
  • [nit] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_SceneJudges.cpp:36 WallClock::max() is used as a "not started" sentinel for m_quiet_since and m_calm_since. Both are set, tested and reset in several places, and subtracting from them is only safe because of the surrounding guards. Fix: Use std::optional and test has_value(). That drops the repeated == WallClock::max() checks.
  • [nit] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_SceneJudges.h:58 Comments cite lab runs and run labels ("lab-B 2026-10-31 09:45", "r23", "r31", "r30"). The same pattern is in Pokemon_FadeProfiles.h and Pokemon_Interrupts.h. A reader can't resolve these, and they describe provenance instead of the behavior. Fix: Keep the behavioral reason (a scene pauses while someone walks off, a speech pauses for a fanfare) and move the run IDs to the commit message or an issue link.
  • [nit] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_Interrupts_Tests.cpp:31 expect_equal() is copied verbatim into Pokemon_SceneJudges_Tests.cpp. The per-file case wrappers also disagree on the body type: std::function<UnitTestResult()> in the Interrupts and SceneJudges tests, a raw function pointer in Pokemon_Transitions_Tests.cpp. Fix: Put expect_equal() in one shared test helper header. Use one body type (a plain function pointer is enough) across the three suites.
  • [nit] SerialPrograms/Source/Pokemon/AutoStory/Pokemon_Transitions_Tests.cpp:150 track_captured_case() calls std::stoi on every .png stem in a CommandLineTests folder. A frame with a non-numeric name ("frame_0.png") throws std::invalid_argument, and the test dies with an opaque exception. The ".png" comparison is also case-sensitive. Fix: Parse with std::from_chars and return a test failure naming the file if the stem is not a number. Compare the extension case-insensitively, or skip non-matching files explicitly.

dayfine and others added 4 commits November 12, 2026 14:59
…shared expect_equal, frame-name parsing

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

@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: ae1941b

Verdict

changes_requested

One defensive-reader bug; everything else is nits. Supersedes the f89bc00 review (LGTM_with_nits) for this SHA.

Bug

  • [bug] Pokemon_Transitions.cpp transition_sample() / TransitionTracker::level_of(): TransitionSample::frame is documented "May be empty", and transition_sample() leaves middle default-constructed (count 0, average and stddev all zero) for an empty VideoSnapshot. level_of() never checks middle.count, so a zero-stat sample satisfies stddev <= uniform_max_stddev_sum && sum <= dark_max_sum and is classified Level::DARK. Pushing an empty/dropped frame therefore starts or extends a black fade, and a run of them reaches HOLD and later reports a FADE_BLACK warp. The test at Pokemon_Transitions_Tests.cpp:160 only checks middle.count == 0; no test pushes an empty sample into the tracker. Fix: treat count == 0 as "no reading" in push() (ignore the sample, or return std::nullopt without touching phase/m_before), and add a tracker test that interleaves empty frames in a scene and in a hold.

Unverified claim

  • [nit] The description says "Code health 0 failures against autostory/engine". I could not reproduce it: devtools.code_health is not importable in the review worktree (module absent at this SHA), so I treat the claim as unverified. Say which checkout/command produced it, or drop it.
  • [nit] "unchanged" for the moved suites: the diff against nav/grid-nav is all additions (17 files, +2254), so I could not check the move against #313's f4b149c with --color-moved; the description should give that command.

Prior-review nits still apply (not re-listed in full): bare bool on_partial/on_uniform(sample, bool white) (Transitions.cpp), output parameter in add_fade_evidence(const FadeSpan&, Changes&) (Interrupts.cpp:84), sentinel -1 in the SceneJudges test helper, literal ImageFloatBox(0.1, 0.1, 0.8, 0.8) not tied to fade_of_screen(), and lab-run IDs/issue numbers in comments (WarpJudge.h).

Checked and fine: empty-log paths in classify_interrupt (guarded front(), last_frame().value_or), Transition::hold() with unset peak/rise, *m_current.rise in RISING (only reachable after HOLD sets it), *warp.fade->up in the WARPED case (only produced when up is set).

An empty or dropped frame has count 0 and zero stats, which level_of() read as uniform and dark, so it could start or extend a black fade and give a false FADE_BLACK warp. push() now skips such samples. Tests mix empty frames into a scene and into a rise. Also: named bool args, optional beat in the talk-over test, no issue numbers in comments.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine added a commit that referenced this pull request Nov 13, 2026
@dayfine
dayfine merged commit 8e0fa63 into nav/grid-nav Nov 13, 2026
16 checks passed
dayfine added a commit that referenced this pull request Nov 13, 2026
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