Skip to content

weave_to_episode: refuse a missing member instead of persisting a shifted timeline (#98) - #101

Merged
thorwhalen merged 2 commits into
mainfrom
fix/episode-missing-member-98
Oct 13, 2026
Merged

thorwhalen merged 2 commits into
mainfrom
fix/episode-missing-member-98

Conversation

@thorwhalen

@thorwhalen thorwhalen commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #98.

WeaveToEpisode.execute built the persisted timeline over [index[mid] for mid in member_ids if mid in index] but persisted the full ordered_member_ids. One member missing at execute time shifted the position pairing for every member after it (member_spans, episode_script + captions.cues_for, the picture track).

  • execute now raises ValueError naming the missing ids, before any render work. It shares one helper (_resolve_members) with the episode_timeline reconstruction path, which already refused this state (its message is unchanged).
  • Test first: tests/test_transforms_episode_members.py failed with "DID NOT RAISE" before the fix, plus a control that a complete list keeps ids and timeline in step.
  • Public API unchanged (narrate, render_dialogue, ConversationCast, body schemas, MCP tools untouched). The only behaviour change is a refusal in a state that previously produced a silently wrong episode.

Local: full suite with --doctest-modules 711 passed (the two MCP test files need py2mcp, absent from this venv; CI has it).

Adversarial review (fresh Opus subagent, tried to break it): no confirmed defects. It checked every other site that filters members by the graph index (the video panels and episode_script keep a placeholder so positions do not shift), the cache-hit path, importer-written episodes, scene breaks, re-weave after a member is removed, and that no consumer matches the error text. It confirmed the new execute test fails when the fix is reverted and when the message drops the ids. Its gaps (no test of the episode_timeline refusal; no "nothing was persisted" assertion) are closed in the second commit, and the reconstruction test fails when the refusal is removed.

🤖 Generated with Claude Code

thorwhalen and others added 2 commits October 13, 2026 15:59
…tead of persisting a shifted timeline (#98)

The persisted timeline was built over the members found in the graph while
ordered_member_ids kept the full list; consumers pair them by position, so one
missing member shifted every later one. execute now raises, sharing one helper
with the reconstruction path.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…othing (#98)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thorwhalen
thorwhalen merged commit 324243c into main Oct 13, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the fix/episode-missing-member-98 branch October 13, 2026 16:13
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.

weave_to_episode.execute persists ordered_member_ids that can be out of step with its timeline

1 participant