Skip to content

BDSP AutoStory: bound optional scene-start waits - #606

Draft
dayfine wants to merge 7 commits into
bdsp/intro-pickersfrom
bdsp/autostory-optional-dialogue-waits
Draft

dayfine wants to merge 7 commits into
bdsp/intro-pickersfrom
bdsp/autostory-optional-dialogue-waits

Conversation

@dayfine

@dayfine dayfine commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Stacked on fork PR #527 (bdsp/intro-pickers); this diff audits and removes redundant scene-start waits only.

Console B on 2026-11-15 spent the full 15-second pre-dialogue timeout in mom_calls, barry_goes_home, and barry_runs_to_the_lake after the preceding settle had already played dialogue.

The review fix preserves the original 15-second opening-line guard for every scene not yet observed. talk_over() now reports whether it actually saw dialogue; only then does the immediately following MASH scene skip its redundant pre-watch. Every intervening engine-dispatched step invalidates that signal. The following quiet settle still runs.

The simulation carries any first-line delay not covered by the pre-watch into TalkOver as a moving gap, so a shortened guard now fails the 9-second regression instead of passing vacuously. It audits all 23 MASH scenes through 01.11, pins the exact default skip set, checks the three measured doorway skips, and verifies that scenes after TALK and BATTLE retain the full guard.

Other 15-second save/battle failure bounds are unchanged.

How to review:

  • No code was moved.
  • Read StoryEngineSteps::act()/StoryWalkSteps::begin_step() first, then StoryWalkSteps::mash(), then the late-line and skip-set simulation regressions.
  • git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change origin/bdsp/intro-pickers...bdsp/autostory-optional-dialogue-waits

Tests:

  • targeted C++ code-health scan against origin/bdsp/intro-pickers: 0 failures
  • red Fork Draft CI at 3a7f06ebc exposed the non-MASH short-circuit and corrected audit expectation
  • Fork Draft CI at 839c1a61e: passed (Ubuntu GCC build and 33,000+ unit tests)

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

Verdict

NEEDS_REWORK

Correctness read: the pre-watch (StoryWalkSteps::mash, ~line 740) only waits; it presses nothing, and settle() -> talk_over() runs after it. So a scene that starts late is still caught, but only inside a much smaller window: 3 s pre-watch + 5 s quiet (TALK_OVER_QUIET) = about 8 s from the start of the step, down from 15 s + 5 s = 20 s. A scene that first shows its line after ~8 s (camera zoom, slow NPC walk-in; the Roark talk in the same file already allows 8 s for a zoom, r98) is judged over, and the program walks on mid-scene. The PR does not show this is safe, and the new test cannot show it. Findings:

  1. PokemonBDSP_AutoStory_StoryActions_Tests.cpp test_scene_start_waits: it only checks that each MASH step's dialog_within wait is <= 3000 ms. That restates the constant (3000 appears again as a literal) and passes for any implementation that calls dialog_within(3 s), including one that then ends the scene early. It never runs a late scene. Add a case through the real mash/settle path with first_line knobs for a MASH step: first line at 6-7 s must still be pressed through to the end of the scene; and a line at ~9 s must be a stated, tested outcome (fails loudly or is handled), not silent. SimFailureCases_Tests.cpp ~245 does this for one TALK step at 7000 ms; copy it for mash. Pick the window from measured console data (the three 00.01 scenes that waited 15 s), and say what the longest real first-line delay is.
  2. Same test: SimMisses::dialog_waits is keyed by step name (m_step), and a later call overwrites an earlier one. If two rows share a step name the check reads only the last wait. Key by row + step, or record the max.
  3. Same test: the sim only runs 00.00 to 01.11 (run_rows_on) but the loop covers every row in story_steps(). A MASH step in a later row fails with "did not check for its opening line". Today it passes only because none exist; bound the loop to the same range. The brief asked whether all 23 MASH scenes are covered: the test logs the count but does not assert it; assert the expected count or derive it from the data.
  4. SCENE_START_WAIT is a single constant but two other optional-line waits remain as literals in the same file (dialog_within(10000ms) ~line 303, 8000ms ~729) and 2000 ms in PlannedRoute.cpp (837, 949). If the rule is "scene start waits are short because settle covers the rest", sweep and name those sites, or say why they differ. Right now it patches the mash symptom only.
  5. The comment above SCENE_START_WAIT says a delayed scene has 8 s; put that number in code (SCENE_START_WAIT + TALK_OVER_QUIET) and use it in the test instead of the literal 3000, so the two cannot drift.
  6. Log text: "no line within {} ms; the step before may already have played it." is a WARNING on the normal path now (the step before usually did play it), so it will warn in most runs. Make it a LOG.

Style otherwise fine: Milliseconds, braces, CRLF kept, no tabs. CI green.

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

Verdict

NEEDS_REWORK

Re-check at 2026-11-16 16:10Z: no rework has been pushed. The branch head bdsp/autostory-optional-dialogue-waits is still deeba2b, the SHA reviewed at 07:58Z (last commit 06:40Z). None of findings 1-6 in the earlier review are addressed yet. That review stands as the rework list:

  1. Add a late-scene test through the real mash/settle path (first line at 6-7 s is pressed through; ~9 s is a stated, tested outcome). Base the window on measured console delays.
  2. SimMisses::dialog_waits keyed by step name overwrites; key by row+step or keep the max.
  3. Bound the test loop to the simulated range (00.00-01.11) and assert the MASH scene count.
  4. Sweep the other optional-line waits (10000ms, 8000ms, PlannedRoute 2000 ms) under the same rule, or say why they differ.
  5. Express the 8 s window as SCENE_START_WAIT + TALK_OVER_QUIET and use it in the test instead of literal 3000.
  6. Downgrade the "no line within ..." WARNING to a LOG.

@dayfine

dayfine commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

The core timing objection was correct, so I replaced the global 3-second reduction in 2edb8e336/68d3f7b18.

  • Restored the original 15-second guard whenever the prior step has not observed dialogue.
  • talk_over()/settle() now report whether dialogue was actually seen; only that confirmed case skips the next redundant MASH pre-watch.
  • Added 7-second and 9-second late-line cases through the real MASH/settle path.
  • The audit is bounded through 01.11, asserts all 23 MASH scenes, and records the maximum wait for duplicate step names.
  • The normal skip is STATUS rather than WARNING.

I left the other dialog_within values unchanged because they are different contracts: the 10-second site is route/run-to-dialogue behavior, the 8-second site is the required TALK/Roark answer guard, and the 2-second PlannedRoute sites are NPC interaction probes. They do not share the MASH optional-prewatch rule.

Code health: 0 failures. Fork Draft CI is green at 68d3f7b18.

@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: 68d3f7b

Verdict

NEEDS_REWORK

Re-review of 2edb8e3 and 68d3f7b. Read from the diff, the walk steps in context, the sim's play_scene/settle and the 00.00 to 01.11 plan data. No build of my own; CI green, and local code health has 0 failures.

The new design is better than the 3 s cut. It keeps the 15 s guard and skips the wait only after a settle that pressed through dialogue. Earlier findings 2 (the max is kept per step name), 3 (the loop is bounded to 01.11 and asserts 23) and 6 (the skip logs at STATUS) are addressed. I accept the reasons given in the reply for leaving the 10 s, 8 s and 2 s sites alone (finding 4). Finding 5 no longer applies now that the window is 15 s again. Finding 1 is not met yet:

  1. mash_scene_speaks_late is vacuous (SimFailureCases_Tests.cpp ~251). It passes with the old 3 s wait too. With SCENE_START_WAIT = 3000ms, dialog_within returns false for the 7 s and 9 s knobs, mash only notes a WARNING (GridSimRouteIO::note throws only on FAILURE), and then SimStoryStepIO::settle plays the scenes knob straight through. It ignores how late the first line is, so the run completes. The test cannot fail on the regression it is named for. Put the delay the pre-watch did not cover into the scene itself, e.g. {sim_pause("Barry still walking up", delay - waited, /*moving=*/true), sim_line(...)}. Then play_scene's TalkOver judges a long gap as over ("judged over ...", FAILURE), the way the console would. Check that the 9 s case fails with a 3 s wait and passes with 15 s. One way: have SimKnobRouteIO::dialog_within record the uncovered remainder for settle to prepend.

  2. The skip flag goes stale across non-walk steps (StoryWalkSteps.cpp). m_previous_settle_saw_dialogue is cleared only in route/legs/step/talk/mash/begin_attempt. BATTLE, GAME, HEAL, SAVE, TRAIN and ANSWER run through the bound actions (story_game() in StoryActions.cpp) and never touch it. So a door step that settles dialogue, then a battle or game action, then a scene skips the scene's opening-line wait on the strength of dialogue from two steps back. That is exactly the after-battle case where the first line is slowest. No row through 01.11 hits it today (lake_entrance and rowans_trigger take one_step, which clears the flag without settling), but the name and comment promise "the step before". Clear the flag in one place per step, in the engine's step dispatch, rather than in five walk methods, or store the step that set it and compare.

  3. Nothing pins which scenes skip (StoryActions_Tests.cpp test_scene_start_waits). It checks only the waits it recorded, and a skipped scene records none. So a change that skipped every scene would still pass; guarded is logged but never asserted. test_seen_scene_skips_start_wait covers three positive cases and no negative one. Either assert the exact skip set through 01.11 (the three 00.01 scenes; every other scene of the 23 keeps 15 s), or add a negative case: a scene after a TALK, and one after a battle (see 2), keeps its 15 s wait.

Style / minor:
4. test_scene_start_waits compares against a literal Milliseconds(15000) that copies SCENE_START_WAIT. If the constant stays in the .cpp's anonymous namespace, keep the literal but say in a comment what it mirrors. Don't widen a header just for the test.
5. StoryActions_Tests.cpp:256 SimExecutor sim(logger, {}, knobs); needs /*misses=*/{} (code health param_comment).
6. StoryWalkSteps.cpp:745 builds the STATUS note with +; use std::format (code health advisory).
7. The comment on SCENE_START_WAIT, "keeps the original full guard", describes history. Say what it is: how long a scene waits for its first line when the step before did not press through dialogue.
8. SimKnobRouteIO::dialog_within now returns true whenever a step has a first_line knob within the wait, which bypasses GridSimRouteIO::dialog_within. Add a one-line comment on why the knob wins (the knob is the step's line).
9. GridSim_Tests.cpp:451 squeezes two statements onto one line. Keep the multi-line body, as WallBattleSim_Tests does.

@dayfine

dayfine commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

Addressed the re-review in 3a7f06ebc, 1b7bfcd6f, and 839c1a61e.

  1. The late-line simulation now records the portion of first_line not covered by dialog_within() and prepends it to the scene as a moving pause. The 7-second and 9-second cases therefore exercise the real MASH/settle/TalkOver path; a 3-second guard makes the 9-second case fail early, while the restored 15-second guard passes.
  2. Dialogue reuse is now scoped in one place, StoryEngineSteps::act() via StoryWalkSteps::begin_step(). Every dispatched step consumes the prior signal; only an immediately following MASH can use it. A regression covers intervening TALK and BATTLE actions.
  3. The audit now pins the exact default simulation result: only barry_goes_home is naturally pre-played and the other 22 scenes keep 15 seconds. The separate console-measurement fixture supplies the other two doorway scenes and requires all three measured skips. This distinction was caught by the first red CI run.
  4. The 15000 ms test literal now says it mirrors SCENE_START_WAIT without widening the header.
  5. Added the /*misses=*/ argument label.
  6. The STATUS message uses std::format.
  7. The constant comment now describes its current first-line contract.
  8. Documented why a first_line knob overrides map dialogue.
  9. Restored the multi-line GridSim fake body while keeping the file within the 1000-line health limit.

The first review CI run usefully exposed a short-circuit in the new central invalidation; that was fixed before the final run. Code health reports 0 failures, and Fork Draft CI is green at 839c1a61e.

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