Skip to content

feat: disc20 fixture + structural chapter-split detection#25

Merged
yxbh merged 4 commits intomainfrom
feature/structural-chapter-detection
Mar 1, 2026
Merged

feat: disc20 fixture + structural chapter-split detection#25
yxbh merged 4 commits intomainfrom
feature/structural-chapter-detection

Conversation

@yxbh
Copy link
Owner

@yxbh yxbh commented Mar 1, 2026

Summary

Replace brittle numeric thresholds in chapter-split detection with structural periodicity detection, and add disc20 fixture.

Changes

disc20 fixture (commit 1)

  • 119-minute movie with 41 scene chapters — must NOT be chapter-split
  • 1 movie episode + 1 extra special
  • Integration tests + conftest + all 6 matrix parametrizations

Structural detection refactor (commit 2)

Problem: _episodes_from_chapters() used two arbitrary guards:

  • est_count <= 2 — happened to catch disc18 (52min movie)
  • _MAX_CHAPTERS_PER_EPISODE = 7 — happened to catch disc20 (8.2 ch/ep)

Both are "just happens to work" thresholds that break on the next disc.

Fix: New _detect_episode_periodicity() function that detects repeating OP/body/ED chapter structure:

Disc Chapters Period Match Result
disc3/14/15 21 5 100% Split ✅
disc16 19 5 75% Split ✅
disc18 23 0% Don't split ✅
disc20 41 0% Don't split ✅

Zero false positives/negatives across all 20 fixtures.

Why it works: Anime episodes reuse OP/ED sequences with frame-exact timing (~91s OP, ~91s ED across all 15 detected episodes). This creates a structural fingerprint that no movie scene-chapter layout will ever produce.

Instruction updates

  • AGENTS.md: "Structural Signals over Thresholds" section
  • debug-analysis.md: "How to Fix Mismatches" section with anti-patterns
  • add-disc-fixture skill: step 4 updated with fix philosophy

Test results

335 passed, lint clean.

yxbh and others added 4 commits March 1, 2026 16:18
Add test fixture for a 119-minute movie compilation with 41 scene
chapters that must NOT be chapter-split into episodes.

- Fixture: 4 playlists, 9 CLPIs, ICS menu (71.7 KB total)
- Integration tests: 1 movie episode, 1 extra special
- Updated conftest fixtures and all 6 matrix parametrizations

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…y detection

Replace two brittle numeric guards in _episodes_from_chapters() with
a positive structural signal: _detect_episode_periodicity().

The old approach asked 'does this NOT look like episodes?' via:
  - est_count <= 2 (arbitrary duration threshold)
  - chapters/est_count > 7 (arbitrary ratio guard)

The new approach asks 'does this look like episodes?' by detecting
a repeating OP (~90s) / body / ED (~90s) / preview cycle in chapter
durations — the structural fingerprint of anime episode compilations.

Tested against all 20 disc fixtures with zero false positives/negatives.

Also updates AGENTS.md, add-disc-fixture skill, and debug-analysis
guide to document the 'structural signals over thresholds' principle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- 1 episode (44.1 min OVA) + 1 digital archive
- Fixture: 4 playlists, 23 CLPIs, ICS menu (36.1 KB total)
- Integration tests + conftest + all 6 matrix parametrizations
- 348 tests pass

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yxbh yxbh merged commit dce24e9 into main Mar 1, 2026
1 check passed
@yxbh yxbh deleted the feature/structural-chapter-detection branch March 1, 2026 06:41
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