Repository navigation
fix(watchstate): clear watched episodes without a file when unwatching a series - #2465
Conversation
…g a series Marking a series or season unwatched expanded it through the episode listings, which only return episodes a library holds a file for. An episode watched and later deleted from disk was skipped, so its completed progress survived and Next Up kept offering the episode after it. Series and season unwatch now take every episode with a file plus the file-less episodes the profile still has history or progress on, from one partition read, the same selection show history removal uses. The native watched endpoints and the Jellyfin unplayed and user-data routes share the new watchstate helper. File-less episodes nobody watched stay out. Closes #2461 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ❌ |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The change is visible on Apple and Android Home, where unwatching the series or season removes it from Next Up/Continue Watching. The evidence section covers desktop web only; please add before-and-after captures of the same Home section and profile/data from each client, with the surface and build identified:
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
The change is in the server's Home sections response ( |
|
@kody start-review |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Major change: series/season unwatch now resolves a different server-side episode set. The recorded Web and iOS rehearsals cover watched/unwatched and Next Up, but do not document a watched episode after its file is removed; this PR clears that episode’s completed progress, which can remove the series from Continue Watching/Next Up. The cross-device progress portion of C4 remains blocked by #1249; this PR does not resolve it. The tvOS and Android Series task tables are still Not run. The PR must explain why the C4/C9 outcomes change; its existing rationale is that file-less watched progress otherwise keeps the series as a Next Up anchor. These cases need re-validation after merge on an RC, including a watched episode whose file has been removed. Please replace the current
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Conflicts: - internal/api/handlers/items.go: keep the lookup and expansion split and carry Silo-Server#2465's played parameter, so series and season unwatch still skip the episode listing. - internal/contractledger/ledger_test.go: keep the clearResumePosition row and Silo-Server#2425's watchlist-title wording. - internal/recommendations/taste_signals_test.go: Silo-Server#1966's stale-abandonment rule gives a recent low-progress row no weight, so the cleared-position case moves into its table test. - web/src/components/MediaItemMenu.tsx: keep Reset Progress ahead of Silo-Server#2433's personal-list entries. Main also changed two things the reset used without a textual conflict: - Silo-Server#1966 replaced triggerProfileRefresh with notifySignalsChanged, so ClearResumePosition now calls the new notifier. - Silo-Server#2425 made viewerNoContentMutation naturally idempotent for favorites and watchlist writes. clearResumePosition registers its operation directly so it stays non_retryable, as unmarkWatched does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
Closes #2461
Related issue: N/A
Validation tasks: changes #1252 C4/C9; changes Silo-Server/silo-apple#337 C4/C9, Silo-Server/silo-apple#338 C4/C9, Silo-Server/silo-android#347 C4/C9, and Silo-Server/silo-android#348 C4/C9
Marking a series or season unwatched leaves the series in Up Next when some of its watched episodes no longer have a file, for example episodes deleted from disk after watching. Home keeps offering the episode after the last one watched, and the only way out is removing the card by hand, which only the web app offers on every Up Next layout. This change makes the unwatch clear those episodes too, so the series leaves Up Next and Continue Watching.
Series and season unwatch expanded through
EpisodeRepository.ListBySeries/ListBySeasonID, which return only episodes a library holds a file for. A watched episode whose file was deleted was skipped, so its completed progress and history stayed, and Next Up, which anchors on any completed episode, kept the series.Approach
Series and season unwatch now clear every episode with a file plus the file-less episodes the profile still has history or progress on. Both sets come from one
PartitionIDsBySeries/PartitionIDsBySeasonread, the same selection show history removal adopted in #2167. File-less episodes nobody watched stay out, so a long-running show with many metadata-only episodes doesn't get thousands of hide rows.The rule lives in a new
watchstate.Service.ParentUnwatchTargets, which uses the history-or-progress filter moved fromfavorites.gotowatchstate.WatchedItemIDs. Both the nativeDELETE /api/v1|v2/watched/{id}path and the Jellyfin paths use it:DELETE /UserPlayedItems/{id}, its legacy route, and a user-data update withPlayed=falseon a series or season. Mark watched is unchanged. Native unwatch of a series or season no longer loads episode metadata and file durations it didn't use.Apple, Android and web need no change: they already send
DELETE /api/v2/watched/{seriesId}and reload Home afterwards.Validation
operational_logs(unmarkWatched, 204).scripts/ci/db-contracts.txt.DELETE /UserPlayedItemsand user-dataPlayed=falseon a season; it fails without the new resolver.go testforinternal/watchstate,internal/jellycompat,internal/api/handlers,internal/apiv2: pass.make lint-changed: clean.Evidence
Home on desktop web, same profile and data, after marking 1883 unwatched: before, S1E4 is still offered; after, the series is gone. The web app's code is unchanged, so phone-width layout is unaffected.
Surface and build: web Home, sandbox from main e21984f (before) and this branch (after)
Evidence: https://evidence.siloserver.org/r/silo-server/issue-2461/
Risks
The Series watched/unwatched and Next Up cases (C4, C9) change for one state: a watched episode whose file was removed. Marking its series or season unwatched now clears that episode's completed progress, so the series leaves Continue Watching and Next Up instead of staying anchored on it. With every file present the outcome is unchanged. Re-test those cases on an RC with a watched episode whose file was removed. The cross-device part of C4 stays blocked by [v1] Series #1249; this PR doesn't address it.
v1's
affected_countfor a series or season unwatch now includes the cleared file-less episodes, so a retried call can report a smaller number than the first. v2 answers 204 with no count.Watch providers now get the removal of manual plays on those file-less episodes, matching what unwatch already sent for episodes with files. Jellyfin-path unplayed marks still send no provider events, as before.
Episodes with a NULL
season_idare still missed by season-level unwatch, as they are by season mark-watched and history removal; this change does not alter that.Checklist
AI Disclosure
sonnetmodel alias (two review subagents), gpt-6.1-sol (adversarial review)season_id(shared with mark-watched, not reproducible in the sandbox data) and SQLite's bound-variable limit above 32k episodes. A three-finder Claude review of the diff found no defects; its notes are in Risks. A background adversarial review by gpt-6.1-sol of 11a605b found no defects.🤖 Generated with Claude Code