Fix stack overflow judging circled Takes on a Shot with a Board (#127) #129

Merged
crowmaki merged 2 commits from issue-127-take-stack-overflow into main 2026-10-09 21:27:36 +00:00
Owner

Closes #127

Cause

Judging a circled Take reads its Shot's Board when a Board feeds its slots. The read went board_images → shot_board → scene_boards → scene_setups, and scene_setups fills the circled-stale counts by judging every circled Take again. The recursion never ended, so scene_takes (Dailies), scene_setups and plan_edit_package (Export) all overflowed the stack once a Shot had both a circled Take and a Board.

Fix

  • scene_setups is split. The new setups_without_stale_counts reads the Setups and the over-budget counts but leaves out the circled-stale counts. scene_setups calls it, then fills the counts.
  • scene_boards calls setups_without_stale_counts, which breaks the cycle. Its doc comment says that anything staleness reaches must call it.
  • scene_takes, reorder_setups and mark_scene_seen need only Shot ids and labels, so they call it too. They no longer judge every circled Take only to discard the result.

Tests

  • a_circled_take_on_a_shot_with_a_board_is_judged_like_any_other (tests/staleness.rs) follows both repro orders in the issue: circle a Take and then save a Board, or render after the Board and then circle. It calls scene_takes, scene_setups (circled-stale count 1) and plan_edit_package. Before the fix it overflowed with STATUS_STACK_OVERFLOW.
  • cargo test --workspace --features studio-core/test-support passes.
Closes #127 ## Cause Judging a circled Take reads its Shot's Board when a Board feeds its slots. The read went `board_images` → `shot_board` → `scene_boards` → `scene_setups`, and `scene_setups` fills the circled-stale counts by judging every circled Take again. The recursion never ended, so `scene_takes` (Dailies), `scene_setups` and `plan_edit_package` (Export) all overflowed the stack once a Shot had both a circled Take and a Board. ## Fix - `scene_setups` is split. The new `setups_without_stale_counts` reads the Setups and the over-budget counts but leaves out the circled-stale counts. `scene_setups` calls it, then fills the counts. - `scene_boards` calls `setups_without_stale_counts`, which breaks the cycle. Its doc comment says that anything staleness reaches must call it. - `scene_takes`, `reorder_setups` and `mark_scene_seen` need only Shot ids and labels, so they call it too. They no longer judge every circled Take only to discard the result. ## Tests - `a_circled_take_on_a_shot_with_a_board_is_judged_like_any_other` (`tests/staleness.rs`) follows both repro orders in the issue: circle a Take and then save a Board, or render after the Board and then circle. It calls `scene_takes`, `scene_setups` (circled-stale count 1) and `plan_edit_package`. Before the fix it overflowed with `STATUS_STACK_OVERFLOW`. - `cargo test --workspace --features studio-core/test-support` passes.
Judging a Board-fed Take reads the Board, whose Scene listing read the
Scene's Setups with their circled-stale counts, which judge the circled
Takes again. The Board and Dailies now read the Setups without the counts.
crowmaki deleted branch issue-127-take-stack-overflow 2026-10-09 21:27:36 +00:00
Sign in to join this conversation.
No description provided.