Skip to content

fix(catalog): list and play every episode of a multi-episode file - #3112

Merged
Quick104 merged 5 commits into
Silo-Server:mainfrom
Tobechukwu-Njoku:fix/739-multi-episode-files
Oct 28, 2026
Merged

Quick104 merged 5 commits into
Silo-Server:mainfrom
Tobechukwu-Njoku:fix/739-multi-episode-files

Conversation

@Tobechukwu-Njoku

@Tobechukwu-Njoku Tobechukwu-Njoku commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tobechukwu Njoku

Problem

Closes #739
Related issue: N/A
Validation tasks: none

A file named for several episodes, such as Show - S01E01-E02 - Title.mkv, shows only its first episode. The filename parses correctly (episodes 1 to 2), but the file links to episode 1 only, so only episode 1 gets a library membership. Every episode list leaves out episode 2, in the web app and in Jellyfin clients, while season availability counts it as present. This change lists every episode the file spans, plays the file from each one, and marks the whole range watched when the file finishes.

Approach

The file keeps its single link to its first episode (media_files.episode_id), so nothing that reads the file side changes. A multi-episode file now serves the later episodes of its range:

  • Each episode a present multi-episode file spans gets the folder membership a linked file gives (episode_libraries). It is added where links are made (scan repair, folder reconcile, relink, bulk link, file split) and removed with the file. A scoped scan, relink or link clear that checks the first episode also checks the episodes after it.
  • File lookups by episode (item detail, playback, overlays, Jellyfin file presence) resolve a spanned episode to the same file. Probed durations stay on the first episode, so a later one keeps its own runtime.
  • Finishing the file in playback marks the rest of its range watched. Progress is still saved on the first episode, as before, since one position can't be split across episodes.
  • A season or series download fetches the file once.
  • Card play targets, poster badges, and the episode catalog entry use the same coverage. A download of a later episode is registered under the file's first episode, as a season download is. A file split moves the later episodes' watch state too.
  • Lookups search at most ten earlier episodes, the bound watch history import already uses for multi-episode plays, so long seasons stay cheap. A file spanning more than eleven episodes serves its first eleven.

The shared SQL lives in internal/catalog/multi_episode_files.go. Season availability already counted spanned episodes and is unchanged. Next Up still offers only episodes with a file linked directly, so it never offers the same file again for its later episodes.

Validation

  • Go build, vet, gofmt and golangci-lint (v2.12.2, changed lines): pass.
  • Changed-package unit tests: pass. internal/api/handlers fails TestPersonalPosterSourceRefusesLocalAddresses only in a container without IPv6; it passes on the Linux VM.
  • New database contract (listed in scripts/ci/db-contracts.txt) against a migrated PostgreSQL 18 database: passes, and fails on the base commit. make test-db-contracts: all pins pass.
  • New playback test: passes, and fails with the range marking removed.
  • internal/jellycompat TestPlaybackInfoWithoutStripOrToneMapStillHasNoRoute and TestPlaybackInfoSkipsStripWhenRPUCannotBeStripped fail the same way on the base commit (8b84639) without this change.

Evidence

Before After
before-desktop after-desktop
before-mobile after-mobile
after-e02-detail

Surface and build: web app series page, Episodes section, desktop (1440 px) and phone (390 px) widths, plus the second episode's detail page. Test library with one generated Hey Arnold! - S01E01-E02 - Downtown as Fruits + Eugene's Bike.mkv, base 8b84639 vs this branch. Before: "1 total", only Episode 1. After: "2 total", Episode 2 listed with the file's badges and a Play button.

Risks

Two migrations. One clears stored multi-episode ranges, except ones an import supplied, because parsers before #1313 stored ranges for names such as S02E01 - 013 - Title (episodes 1–13), and this change would make those files serve later episodes. The next library scan writes real ranges again with the current parser; until then a multi-episode file shows only its first episode, as before. The other builds each episode's catalog entry (the technical filters) from the files serving it. Existing libraries pick up the new memberships on their next scan. Known limits:

  • Rewatching a multi-episode file adds a play for the first episode only; later episodes already completed are not counted again.
  • Marker edits made from a later episode edit the shared file, which the first episode uses too. Intro and credits detection already skips multi-episode files.
  • Range marking applies to playback through Silo's player and Jellyfin clients. A manual mark on the first episode doesn't cascade.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (claude.ai cloud session; tests run on the author's Linux dev VM through Claude Code Remote Control)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted
  • Adversarial review: A separate Claude Code review pass (/code-review, high effort) read the full diff for correctness. It found ten issues, including stale memberships after scoped scans and relinks, duplicate season downloads, doubled runtimes on spanned episodes, and an unbounded self-join on long seasons. Seven were fixed in the second commit. Three were accepted as limits and are described above: progress stays on the first episode, rewatch counts, and marker edits.

Note

Fix catalog to list and play every episode served by a multi-episode file

  • Adds shared SQL fragments in multi_episode_files.go (ServedEpisodeFilesSQL, NoServingEpisodeFileSQL, EpisodeHasServingFileSQL, SpanReachSQL, InsertSpannedEpisodeMemberships) with a MaxEpisodeSpan bound of 10 episodes. Repositories for catalog lookups, overlay summaries, playable targets, and file listings now treat an episode as served when a multi-episode file spans it, not only when a file links directly
  • Recreates the media_files catalog-refresh trigger so changing multi_episode_start/multi_episode_end refreshes catalog entries for episodes covered by the old and new ranges; refresh_episode_catalog_entry computes technical stats through the new episode_serving_files SQL function
  • Watched-state and playback: a completed multi-episode file now marks its later spanned episodes as watched via PlaybackHandler.markSpannedEpisodeWatched and watchstate.Service.RecordSpannedEpisodeWatched; downloads deduplicate a selected multi-episode file to one item keyed to its linked episode
  • File moves, bulk linking, content-link clearing, and present-state repair insert and remove episode-library memberships using the span-reach and no-serving-file predicates
  • Risk: migration 20261028165234_reparse_multi_episode_ranges.sql sets multi_episode_start and multi_episode_end to NULL for non-import rows where end <= start; the Down migration is a no-op and does not restore them. Span lookups are capped at 10 episodes past a file's first episode, so wider ranges are truncated

Macroscope summarized 3a879ca.

Tobechukwu-Njoku and others added 2 commits October 26, 2026 20:44
A file named S01E01-E02 links to its first episode only, so only that
episode got a library membership and the episode lists hid the second
one, while season availability already counted it as present.

Each episode a present multi-episode file spans now gets the folder
membership a linked file gives, and loses it with the file. File
lookups by episode (detail, playback, overlays, durations, Jellyfin
file presence) resolve a spanned episode to the same file. Completing
the file marks the rest of its range watched, so Next Up does not offer
the same file again.

Refs Silo-Server#739

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HPRMUf61FKDxra1ZSpK4iK
…okups

Spanned episodes now lose their membership when a scoped scan, a
relink, a content-link clear or a file split checks the file's first
episode, not only on a full folder reconcile. Lookups search at most
ten earlier episodes, the bound watch history import already uses, so
long seasons do not join every earlier episode.

A season download fetches a multi-episode file once. Probed durations
stay on the first episode, so a later one keeps its own runtime.
Jellyfin episode targets report a spanned episode as having a file.

Refs Silo-Server#739

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HPRMUf61FKDxra1ZSpK4iK
@silo-triage silo-triage Bot added the size/XL 500–999 added + deleted lines (all files); change volume, not priority. label Oct 26, 2026
@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b75e81e4-8da1-4962-bb50-42a0afd83574
Commits

Reviewing files that changed from the base of the PR and between a6ab3e6 and 3a879ca.

Files selected for processing: 17
  • internal/api/handlers/items.go
  • internal/api/handlers/playback.go
  • internal/api/handlers/playback_test.go
  • internal/catalog/episode_library_repo.go
  • internal/catalog/episode_repo.go
  • internal/catalog/filesplit/filesplit.go
  • internal/catalog/multi_episode_files.go
  • internal/catalog/overlay_summaries.go
  • internal/catalog/playable_targets.go
  • internal/catalog/playable_targets_plan_db_test.go
  • internal/catalog/playable_targets_postgres.go
  • internal/downloads/service.go
  • internal/scanner/multi_episode_file_test.go
  • internal/sections/overlay_summaries_test.go
  • migrations/sql/20261028165234_reparse_multi_episode_ranges.sql
  • migrations/sql/20261028165553_episode_catalog_spanned_files.sql
  • scripts/ci/db-contracts.txt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

The change adds shared episode coverage rules for multi-episode files. Scanner and catalog operations use those rules for file lookup and episode memberships. Playback records later covered episodes as watched after qualifying stops, and download selection avoids duplicate items for a spanning file.

Changes: Multi-episode file support

Layer / File(s) Summary
Episode coverage and catalog rules
internal/catalog/multi_episode_files.go, migrations/sql/20261028165553_episode_catalog_spanned_files.sql, migrations/sql/20261028165234_reparse_multi_episode_ranges.sql
Shared SQL rules identify files serving an episode and expand ranges up to the configured limit. Catalog refreshes include covered episodes. The separate reparse migration clears increasing ranges for non-import editions.
Episode file discovery and selection
internal/scanner/file_repo.go, internal/catalog/episode_repo.go, internal/jellycompat/batch_loaders.go, internal/catalog/overlay_summaries.go, internal/catalog/playable_targets.go, internal/catalog/playable_targets_postgres.go, internal/catalog/playable_targets_plan_db_test.go, internal/sections/overlay_summaries_test.go, internal/downloads/service.go, internal/api/handlers/items.go
Episode file lookups, playable-target checks, overlay summaries, and download resolution include files that span episodes. Episode duration lookup filters files by episode ID.
Episode membership lifecycle
internal/catalog/episode_library_repo.go, internal/catalog/filesplit/filesplit.go, internal/scanner/file_repo.go, internal/scanner/scanner.go, internal/scanner/multi_episode_file_test.go, scripts/ci/db-contracts.txt
Reconciliation, file linking, series moves, and scanner synchronization create or remove memberships based on file coverage. The database-backed test checks lookups, membership restoration, and stale membership removal.
Playback history for covered episodes
internal/watchstate/service.go, internal/api/handlers/playback.go, internal/api/handlers/playback_test.go
After a qualifying stop, later episodes covered by the file are recorded as watched. The test checks which episodes are complete after a near-end stop.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Possibly related issues

  • Silo-Server/silo-server#2116 — The changes associate a multi-episode file with later episodes in its range; per-series episode-order selection remains outside this change.

Sequence Diagram(s)

sequenceDiagram
  participant Scanner
  participant Catalog as catalog.InsertSpannedEpisodeMemberships
  participant Database
  Scanner->>Catalog: Insert memberships for files in the current folder and scope
  Catalog->>Database: Insert missing episode-folder memberships
  Database-->>Catalog: Return inserted series IDs
  Catalog-->>Scanner: Return series IDs
  Scanner->>Database: Recompute membership denormalizations
Loading

Suggested reviewers: quick104, rhainland

Merge Risk: Minimal · up to 3a879

Files named for episode ranges now list, play and mark watched across their covered episodes, bounded to the first eleven episodes. After upgrade, existing libraries need a library scan to restore real multi-episode ranges. No unresolved merge-blocking defect was identified in the supplied evidence.

Security architecture risk: Low · up to 3a879

The change is bounded to episodes sharing an existing media file. The reviewed playback and library access controls remain in place, and no introduced access-control bypass was established. Download authorization and some interrupted-update behavior remain incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The added serving relationship extends one file's effects to later episodes within its existing season rather than granting authority over arbitrary series. Playback watch-state effects are directed to the session's user and profile.

Security Findings and Attack Paths

  • observed — Download selection prefers access-filtered candidates but returns the original candidates when none survive filtering. The changed creation path checks parent-item accessibility. Delivery reauthorization and whether spanning lookup materially changes this fallback's exposure were not resolved, so an introduced download bypass is not established.

Trust Boundaries and Controls

  • observed — Both playable-target query paths pass the same file conditions into the new spanning branch, including library scope, enabled-folder checks and playback-quality limits. Episode-list responses filter expanded repository results before exposing file metadata.
  • observed — Native playback loads the requested file through a gate that checks its parent item and file-level library and quality permissions. The stop endpoint checks both account and profile ownership before invoking the transition that can write additional episode history.

Resilience and Maintainability Implications

  • observed — For PostgreSQL, later-episode progress and history are committed in one transaction. The progress upsert checks completed state atomically, and history is written only for targets actually marked. First-episode history is a separate operation; a later-range failure is logged, and qualifying repeated stops can attempt the range again. This does not establish durable recovery after every interruption.
  • observed — Reviewed reconciliation, relink, clear and file-move paths pair file ownership changes with spanning-membership maintenance inside transactions. Membership insertion uses conflict-safe writes and ordered series locking. Scoped scanner repair can still leave temporary stale membership between successive transactions until reconciliation runs.
Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: listing and playing every episode served by a multi-episode file.
Description check Passed The description directly explains the multi-episode file problem, implementation approach, validation, risks, and user-visible results.
Linked Issues check Passed Issue [#739] requires support for episode ranges and association of both episodes with one physical file. The PR uses the existing first-episode link and adds span-aware SQL with MaxEpisodeSpan = 10…
Out of Scope Changes check Passed The changes remain within issue [#739]. The shared SQL, membership maintenance, lookup changes, catalog refresh, download de-duplication, watch-state propagation, migrations, and tests directly suppor…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Full details: Linked Issues check

Explanation

Issue [#739] requires support for episode ranges and association of both episodes with one physical file. The PR uses the existing first-episode link and adds span-aware SQL with MaxEpisodeSpan = 10. It maintains later-episode library memberships during scan, reconcile, relink, bulk link, and file split operations. Episode, playback, Jellyfin, overlay, catalog, and download paths resolve the serving file. Playback records later episodes as watched when the file completes. The database and playback tests cover the main range behavior.

Full details: Out of Scope Changes check

Explanation

The changes remain within issue [#739]. The shared SQL, membership maintenance, lookup changes, catalog refresh, download de-duplication, watch-state propagation, migrations, and tests directly support multi-episode file behavior. No unrelated product change is demonstrated.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish triaged High-confidence review completed; does not mean fixed, validated, or accepted for release. labels Oct 26, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026

Copy link
Copy Markdown

The Evidence table is empty, so reviewers cannot see the visible changes described in the text.

  • internal/scanner/file_repo.go, internal/catalog/multi_episode_files.go, and internal/jellycompat/batch_loaders.go: later episodes served by a multi-episode file now appear in episode lists and resolve to that file. Add actual before-and-after captures of the same series Episodes section and second-episode detail page at desktop and phone widths, plus same-request before-and-after response excerpts for the Jellyfin behavior.
  • internal/api/handlers/playback.go and internal/watchstate/service.go: completing the file marks its later episodes watched. Add before-and-after captures of the affected watch state or a short recording of playback completion.
  • internal/downloads/service.go: a season or series download now queues the shared file once. Add before-and-after captures of the download queue or relevant response excerpts.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

Comment thread internal/catalog/multi_episode_files.go Resolved
Comment thread internal/catalog/multi_episode_files.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bca84a7e-21c2-4514-9a61-9b477cdc055b
Commits

Reviewing files that changed from the base of the PR and between 8b84639 and 1169c0d.

Files selected for processing: 13
  • internal/api/handlers/playback.go
  • internal/api/handlers/playback_test.go
  • internal/catalog/episode_library_repo.go
  • internal/catalog/episode_repo.go
  • internal/catalog/filesplit/filesplit.go
  • internal/catalog/multi_episode_files.go
  • internal/downloads/service.go
  • internal/jellycompat/batch_loaders.go
  • internal/scanner/file_repo.go
  • internal/scanner/multi_episode_file_test.go
  • internal/scanner/scanner.go
  • internal/watchstate/service.go
  • scripts/ci/db-contracts.txt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread internal/api/handlers/playback.go Resolved
…range

Adding spanned memberships now locks the candidate series rows in
content ID order before inserting, matching the parent-first order that
curated rebind and split take.

Completing a multi-episode file marks watched only the episodes the
file serves, up to MaxEpisodeSpan past its first, so it agrees with the
lookups.

Refs Silo-Server#739

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026

Copy link
Copy Markdown

The Evidence section now shows the episode list before and after on desktop and mobile, but these visible changes still lack matching evidence:

  • The second episode's detail/playback target and Jellyfin episode availability (internal/scanner/file_repo.go, internal/jellycompat/batch_loaders.go): add before-and-after captures of the same second-episode detail screen, and before-and-after Jellyfin response excerpts for the same request.
  • Later episodes becoming watched after playback completes (internal/api/handlers/playback.go, internal/watchstate/service.go): add before-and-after captures of the affected watch state or a short recording of playback completion.
  • The shared file appearing only once in a season or series download (internal/downloads/service.go): add before-and-after captures of the download queue or matching response excerpts.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of a6ab3e6, with findings from my pass and a cross-provider pass (Codex gpt-6.1-sol), each checked against the source. Main merges cleanly into this branch and the changed packages build.

Both new tests fail on the base and pass at this head. I ran the database contract against a migrated PostgreSQL. The failing Go DB pins check is TestLogPartitionsMatchPartmanOnNonUTCServer, which this PR doesn't touch.

The first finding matters most: on existing installs, stale stored ranges make this PR show the wrong files and mark the wrong episodes watched. The rest are paths that still read only media_files.episode_id. I'm fixing all of them on this branch and will post a summary when the fixes are pushed.

Review by Claude Code (claude-opus-5-5) for a maintainer.

Comment thread internal/catalog/multi_episode_files.go Resolved
Comment thread internal/scanner/file_repo.go Resolved
Comment thread internal/catalog/multi_episode_files.go Resolved
Comment thread internal/catalog/multi_episode_files.go Resolved
Comment thread internal/catalog/filesplit/filesplit.go Resolved
Comment thread internal/api/handlers/playback.go Resolved
Comment thread internal/downloads/service.go Resolved
Comment thread internal/scanner/file_repo.go Resolved
Quick104 and others added 2 commits October 28, 2026 12:52
…ranges

Parsers before Silo-Server#1313 stored multi-episode ranges for names that are not
multi-episode files, such as "S02E01 - 013 - Title" (episodes 1-13). With
spanned episodes now served by the file, those rows listed one file as a
version of up to ten later episodes and marked them watched on completion.
A migration clears the stored ranges so the next scan writes them again
with the current parser.

Later episodes of a multi-episode file now also get a play target on
cards, poster badges, and catalog entries with the file's technical
fields, so filters match them. A native download of a later episode
resolves to the file, keyed on its first episode like a season download,
which also dedupes it across pages. A file split moves the spanned
episodes' watch state. Folder reconcile locks the series it adds and
removes memberships for in one ordered statement. A repeated stop of a
completed play marks the range again, so a failed mark is not lost.
Marking a later episode watched records its own runtime, not the file's.

Refs Silo-Server#739

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. and removed size/XL 500–999 added + deleted lines (all files); change volume, not priority. labels Oct 28, 2026
@silo-kody

silo-kody Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104

Quick104 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer review summary

Reviewed head: 3a879cabe (the branch's a6ab3e6b5, with current main merged in as fc55b1d7b, plus one fix commit).

Addressed

All nine findings from the review are fixed in 3a879cabe, and each thread says how:

  • Stale ranges: a migration clears stored multi-episode ranges, except ones an import supplied, so the next scan rewrites them with the current parser. Without it, older libraries using Sonarr's anime naming (S02E01 - 013 - Title) would list each file as a version of up to ten later episodes, and finishing one episode would mark those episodes watched.
  • Card play targets, poster badges, and the episode catalog entry now use the files that serve an episode. The catalog entry needed a second migration so resolution, HDR and language filters match a later episode.
  • Fixed:
    • native download of a later episode
    • download deduplication across pages
    • watch state moved by a file split
    • series lock order in folder reconcile
    • range marking after a retried stop
    • the watch-history duration of a later episode

Verification

  • Both of the PR's own tests fail on the base and pass at the head. The playback unit test ran locally; the database contract ran on a migrated PostgreSQL.
  • I extended the database contract to check the later episode's card play target, overlay badge, and catalog-entry resolution. Each check fails on the head before the fix commit.
  • make test-db-contracts and the db-pins.txt suite pass on a fresh migrated database. Two pins needed the new columns in their stub tables. One pin, TestOverlaySummariesRankingMatchesGo, exposed a slow plan in the new overlay query (183 s); collecting the served files in a materialized CTE fixed it (1.1 s; 0.6 s on base).
  • On a disposable server built from this branch, the migrations cleared 26 stored ranges and a library scan restored only the one real multi-episode file. Episodes 4 and 5 of that S01E03-E05 file each list only that file and have catalog entries with resolution codes. The anime-format episode that listed 12 versions now lists its own two.
  • Not covered by tests: the file-split watch state, the reconcile lock order, the retried-stop marking, and the two download changes. These were checked against the source, and the existing split and download contracts pass.
  • make lint-changed reports 0 issues.
  • Review method: my own pass plus a cross-provider pass with Codex (gpt-6.1-sol). Every finding was checked against the source before posting.

Left for maintainers

  • Upgrade behavior. After the migration, real multi-episode files act as they do on main until the library is scanned: only the first episode is listed. The default scan_libraries task runs a full scan daily at 02:00, so that lasts at most a day; installs that disabled the task need a manual scan. Keeping the stored ranges instead would leave the misparsed ones active until that same scan, and a completed play in that window could mark up to ten later episodes watched.
  • Accepted limits from the PR body: progress stays on the first episode, a rewatch counts once, and marker edits apply to the shared file. A file spanning more than eleven episodes serves its first eleven. The bound now lives in Go (MaxEpisodeSpan) and in SQL (episode_serving_files), and the two must stay in step.
  • Downloads. A download started from a later episode is registered under the file's first episode. Apple and Android should check that their download lists handle that.

Other checks

  • Validated features: unavailable. The validation tooling returned no data for this PR, so no passed case was checked. The PR body says Validation tasks: none.
  • User manual: running-a-server/media-folders.md says "A file with several episodes links to its first episode." That stays true, but the page should now say that every episode in the range is listed and plays the file, that finishing the file marks the range watched (up to eleven episodes), and that existing libraries need a scan. I recommend a Silo-Server/siloserver.org issue for that page.
  • Apple/Android: no client change is required for listing or playback, since later episodes come back as ordinary episodes with a file. Client follow-up is recommended for the download keying above.
  • jellycompat: later episodes report a file through EpisodeHasServingFileSQL and appear in episode lists through their memberships. Jellyfin-client stops mark the range too.
  • CI: the earlier Go DB pins failure was TestLogPartitionsMatchPartmanOnNonUTCServer, which this PR doesn't touch. It passed in my local run.

Fit: 8/10 · Readiness: 7/10 — conditional (assuming CI is green)

Fit: issue #739 is a real gap in Series libraries, and the approach reuses the range relation season availability already had. It stretches simplicity: the span rule now has a Go copy and a SQL copy, and several read paths depend on it. Readiness: every verified defect is fixed, and the main paths have tests that fail without the fixes. The condition is the paths listed under Verification that have no test yet.

Review by Claude Code (claude-opus-5-5) for a maintainer.

@macroscopeapp

macroscopeapp Bot commented Oct 28, 2026

Copy link
Copy Markdown

The PR's Validation tasks: none line is inaccurate. The changed paths reach Series browse/play/watch, series downloads, Jellyfin episode availability, marker/subtitle playback, and recommendation inputs. Those linked task cases are currently Not run. Collections Server #193 S4's library-content-change subcase is also Not run and now exercises the new membership path. The existing #193 S3 access result remains applicable: parent-series and file-folder checks still filter spanned episodes.

Suggested replacement:

Validation tasks: changes #1250 C1, C3-C5; changes #1251 C1, C3; changes #1252 C1-C4, C8-C10; changes Silo-Server/silo-apple#337 C1-C4, C8-C10; changes Silo-Server/silo-apple#338 C1-C4, C8-C10; changes Silo-Server/silo-android#347 C1-C4, C8-C10; changes Silo-Server/silo-android#348 C1-C4, C8-C10; changes #1168 C1, Silo-Server/silo-apple#319 C1, and Silo-Server/silo-android#329 C1; changes #1246 C1-C2; changes #1151 C1, #1152 C2, and #1153 C1; changes #1158 C2, #1159 C2-C4, Silo-Server/silo-apple#313 C2-C4, Silo-Server/silo-apple#314 C2-C4, Silo-Server/silo-android#323 C2-C4, and Silo-Server/silo-android#324 C2-C4; changes #1145 C1-C2, #1146 C1 and C3, Silo-Server/silo-apple#309 C1 and C3, Silo-Server/silo-apple#310 C1 and C3, Silo-Server/silo-android#319 C1 and C3, and Silo-Server/silo-android#320 C1 and C3; changes #193 S4, #194 A2, #195 W4, Silo-Server/silo-apple#20 C4, Silo-Server/silo-apple#21 C4, Silo-Server/silo-android#5 C4, and Silo-Server/silo-android#6 C4.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

@Quick104
Quick104 merged commit 5f36edd into Silo-Server:main Oct 28, 2026
32 of 34 checks passed
@Tobechukwu-Njoku
Tobechukwu-Njoku deleted the fix/739-multi-episode-files branch October 29, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. triaged High-confidence review completed; does not mean fixed, validated, or accepted for release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

**Feature request: Support multi-episode files (S01E01-E02)**

2 participants