Repository navigation
fix(metadata): don't promote season/episode 404s to item-level stale provider IDs - #35
Conversation
…provider IDs
The main-refresh path in MetadataService.processInternal passes
`provider404s` to handleProvider404 for season (line 1140) and episode
(line 1173) fetch errors. handleProvider404 records the item's provider
ID as stale whenever provider404s is non-nil. A 404 fetching seasons or
episodes is a child-resource failure (e.g. TMDB returns 404 for
`/tv/{id}/season/0` when a series has no specials season) — it must not
mark the item's TMDB ID itself as stale.
The equivalent target-refresh paths (fetchTargetSeasonResults at line
2305 and fetchTargetEpisodeResults at line 2339) already pass `nil` for
this exact reason. The main-refresh path was the missing half of that
fix.
In our deployment this bug caused 13,524 series items to have their
`media_items.tmdb_id` cleared and recorded as stale during a single
refresh sweep — every series whose TMDB entry doesn't have a 'specials'
season was affected. Once recorded, `suppressRecordedStaleProviderIDs`
locked the items out of future TMDB enrichment.
Tested by curl-ing 5 affected items against TMDB directly:
- /tv/{id} returns 200 for all 5
- /season/1 returns 200 for all 5
- /season/0 returns 404 for 4 of 5 (the ones that don't have specials)
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughHTTP 404 errors encountered during metadata season and episode fetching are now treated as child-resource normal failures rather than propagating as item-level stale provider IDs. The ChangesChild-resource 404 error handling
Docs: README community link
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
…provider IDs (Silo-Server#35) * fix(metadata): don't promote season/episode 404s to item-level stale provider IDs The main-refresh path in MetadataService.processInternal passes `provider404s` to handleProvider404 for season (line 1140) and episode (line 1173) fetch errors. handleProvider404 records the item's provider ID as stale whenever provider404s is non-nil. A 404 fetching seasons or episodes is a child-resource failure (e.g. TMDB returns 404 for `/tv/{id}/season/0` when a series has no specials season) — it must not mark the item's TMDB ID itself as stale. The equivalent target-refresh paths (fetchTargetSeasonResults at line 2305 and fetchTargetEpisodeResults at line 2339) already pass `nil` for this exact reason. The main-refresh path was the missing half of that fix. In our deployment this bug caused 13,524 series items to have their `media_items.tmdb_id` cleared and recorded as stale during a single refresh sweep — every series whose TMDB entry doesn't have a 'specials' season was affected. Once recorded, `suppressRecordedStaleProviderIDs` locked the items out of future TMDB enrichment. Tested by curl-ing 5 affected items against TMDB directly: - /tv/{id} returns 200 for all 5 - /season/1 returns 200 for all 5 - /season/0 returns 404 for 4 of 5 (the ones that don't have specials) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Quick <[email protected]>
…provider IDs (#35) * fix(metadata): don't promote season/episode 404s to item-level stale provider IDs The main-refresh path in MetadataService.processInternal passes `provider404s` to handleProvider404 for season (line 1140) and episode (line 1173) fetch errors. handleProvider404 records the item's provider ID as stale whenever provider404s is non-nil. A 404 fetching seasons or episodes is a child-resource failure (e.g. TMDB returns 404 for `/tv/{id}/season/0` when a series has no specials season) — it must not mark the item's TMDB ID itself as stale. The equivalent target-refresh paths (fetchTargetSeasonResults at line 2305 and fetchTargetEpisodeResults at line 2339) already pass `nil` for this exact reason. The main-refresh path was the missing half of that fix. In our deployment this bug caused 13,524 series items to have their `media_items.tmdb_id` cleared and recorded as stale during a single refresh sweep — every series whose TMDB entry doesn't have a 'specials' season was affected. Once recorded, `suppressRecordedStaleProviderIDs` locked the items out of future TMDB enrichment. Tested by curl-ing 5 affected items against TMDB directly: - /tv/{id} returns 200 for all 5 - /season/1 returns 200 for all 5 - /season/0 returns 404 for 4 of 5 (the ones that don't have specials) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Quick <[email protected]>
…provider IDs (#35) * fix(metadata): don't promote season/episode 404s to item-level stale provider IDs The main-refresh path in MetadataService.processInternal passes `provider404s` to handleProvider404 for season (line 1140) and episode (line 1173) fetch errors. handleProvider404 records the item's provider ID as stale whenever provider404s is non-nil. A 404 fetching seasons or episodes is a child-resource failure (e.g. TMDB returns 404 for `/tv/{id}/season/0` when a series has no specials season) — it must not mark the item's TMDB ID itself as stale. The equivalent target-refresh paths (fetchTargetSeasonResults at line 2305 and fetchTargetEpisodeResults at line 2339) already pass `nil` for this exact reason. The main-refresh path was the missing half of that fix. In our deployment this bug caused 13,524 series items to have their `media_items.tmdb_id` cleared and recorded as stale during a single refresh sweep — every series whose TMDB entry doesn't have a 'specials' season was affected. Once recorded, `suppressRecordedStaleProviderIDs` locked the items out of future TMDB enrichment. Tested by curl-ing 5 affected items against TMDB directly: - /tv/{id} returns 200 for all 5 - /season/1 returns 200 for all 5 - /season/0 returns 404 for 4 of 5 (the ones that don't have specials) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Quick <[email protected]>
…provider IDs (#35) * fix(metadata): don't promote season/episode 404s to item-level stale provider IDs The main-refresh path in MetadataService.processInternal passes `provider404s` to handleProvider404 for season (line 1140) and episode (line 1173) fetch errors. handleProvider404 records the item's provider ID as stale whenever provider404s is non-nil. A 404 fetching seasons or episodes is a child-resource failure (e.g. TMDB returns 404 for `/tv/{id}/season/0` when a series has no specials season) — it must not mark the item's TMDB ID itself as stale. The equivalent target-refresh paths (fetchTargetSeasonResults at line 2305 and fetchTargetEpisodeResults at line 2339) already pass `nil` for this exact reason. The main-refresh path was the missing half of that fix. In our deployment this bug caused 13,524 series items to have their `media_items.tmdb_id` cleared and recorded as stale during a single refresh sweep — every series whose TMDB entry doesn't have a 'specials' season was affected. Once recorded, `suppressRecordedStaleProviderIDs` locked the items out of future TMDB enrichment. Tested by curl-ing 5 affected items against TMDB directly: - /tv/{id} returns 200 for all 5 - /season/1 returns 200 for all 5 - /season/0 returns 404 for 4 of 5 (the ones that don't have specials) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Quick <[email protected]>
Summary
The main-refresh path in
MetadataService.processInternalpassesprovider404stohandleProvider404for season and episode fetch errors. SincehandleProvider404records the item's provider ID as stale wheneverprovider404s != nil, a 404 fetching seasons or episodes promotes the item itself to stale — even though the 404 is a child-resource failure (TMDB returns 404 for/tv/{id}/season/0when the series has no specials season; for episodes that haven't aired yet; etc.).The equivalent target-refresh paths (
fetchTargetSeasonResultsandfetchTargetEpisodeResults) already passnilfor this exact reason. This PR brings the main-refresh path in line with the existing target-refresh pattern.Diff
Two call sites in
internal/metadata/service.go:handleProvider404(provider404s, ...)handleProvider404(nil, ...)handleProvider404(provider404s, ...)handleProvider404(nil, ...)For reference, the already-correct sites that this fix matches:
service.go:2305—fetchTargetSeasonResults, already passesnilservice.go:2339—fetchTargetEpisodeResults, already passesnilObserved impact
On our deployment, the bug caused 13,524 series items to have their
media_items.tmdb_idcleared and recorded as stale during a single library refresh sweep — every series whose TMDB entry doesn't have a "specials" season (most anime, many older shows) was affected. Once recorded,suppressRecordedStaleProviderIDslocked the items out of future TMDB enrichment, so subsequent refreshes couldn't self-heal even when TVDB supplied a working TMDB cross-reference.The bug is fully reproducible. Live log capture during a refresh sweep:
Every single 404 has
season=0. Direct curl tests confirm:The TMDB IDs themselves are valid. Only the specials-season fetch 404s.
Why this regressed
The target-refresh paths (lines 2305/2339) already use
nilfor season/episode child fetches. The main-refresh paths (lines 1140/1173) still passedprovider404s. Looks like a previous half-finished cleanup — the fix was applied to one branch of the code path but not propagated to the symmetric branch.Related
Issue Silo-Server/silo-plugin-tmdb#2 — symptom report. The TMDB plugin itself is fine; the bug is in silo-server's classification of child-resource 404s.
Suggested follow-up (out of scope for this PR)
The asymmetry between
processInternal(~lines 870-1240) andfetchTargetSeasonResults/fetchTargetEpisodeResults(~lines 2280-2350) means the same child-fetch logic exists in two places that have drifted apart once already. Worth either (a) consolidating into a shared helper, or (b) makinghandleProvider404's "should I record this as stale" signal explicit instead of a load-bearing nil-check onprovider404s. Both would prevent this class of bug.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation