Repository navigation
fix(adminjob): keep podcast IDs through a complete metadata refresh - #4022
Conversation
A complete refresh cleared the file links under the show folder before rescanning it. The podcast scanner finds a show through those links, so it created a new show and new episodes, which detached favorites, progress and history. Podcast libraries now keep their links; the scan still re-reads every episode's tags. Closes Silo-Server#3405
|
Warning Review limit reachedThis organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing. Next included review available in 17 minutes. View limit details
|
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:
|
Review summaryReviewed head: This fixes a real defect. On Findings: none. The guard uses the same Tests: Outside this PR (pre-existing on
Validated features: not checked. The validation board could not be read from this session. From the code, only podcast complete refresh changes. Quick, reset, movie, series and episode refreshes and non-podcast scans share no changed code. User manual: no change needed. The metadata page says Complete Refresh "can give it a new ID or type", which stays true. Other clients: N/A. The API is unchanged and items now keep their IDs. Jellycompat has no item-refresh path. Second opinion: one cross-provider round (Codex, gpt-6.1-sol) on this head found no defect this PR introduced. It raised the two pre-existing points above. Fit: 9/10 · Readiness: 9/10 — ready Fit: a small fix at the point where a complete refresh destroys the identity the podcast scanner depends on. It changes no API, adds no setting, and leaves other library kinds alone. Readiness: the approach holds and a database test that fails on the base proves the fix. The only gap is the validation board check, which couldn't run. 🤖 Claude Code (claude-opus-5-5) |
Problem
Closes #3405
Related issue: N/A
Validation tasks: none
A complete metadata refresh of a podcast show or one of its episodes gave the show and every episode new content IDs. Favorites, watch progress and history are keyed by those IDs, so they disappeared from the profile after the refresh. This change keeps the existing IDs.
Before rescanning, a complete refresh clears the file links in its scope so the files are matched again. The podcast scanner finds an existing show through those links. Without them it created a new show and new episodes, and the old show was removed.
Approach
A complete refresh in a podcast library now keeps the file links. Root and group claims are still cleared, and the scan still re-reads every episode's tags, so a retagged title is picked up. In a podcast library, complete and quick refresh therefore index the show the same way. The podcast scanner already rewrites the show and its episodes on every scan, so podcasts lose no refresh behaviour that matters. Movie, series and mixed libraries are unchanged.
docs/admin-catalog-api.mdnow says whatcompletedoes and why podcasts keep their links.No client change is needed: the API shape is the same, and refreshed items keep their IDs. Jellycompat has no refresh path of its own.
Validation
mainwith new IDs and passes with the fix. It is listed inscripts/ci/db-contracts.txt.mainand then from this branch, same database and synthetic podcast, movie and TV libraries, refresh run throughPOST /api/v2/admin/items/{id}/refresh-metadatawith an admin token: see Evidence.go build ./...,gofmt -l .,go mod tidy -diff,go vet ./...,make lint-changed,make lint-router-recovery,make test-go,make verify-local-paths,make verify-case-collisions,make verify-size-ratchet,make verify-bidi: pass. On this host, four packages (internal/api/handlers,internal/backup,internal/ebookconvert,internal/uploads) failmake test-goonly because the default temp directory is group-writable; they pass with a privateTMPDIR.Evidence
Synthetic podcast show with two episodes. The show is a favorite and episode 1 is marked played, then the show gets a complete refresh.
A complete refresh of an episode behaved the same way on each build. On this branch, an episode retagged before the refresh came back with its new title and the same ID, and a later full library scan kept all IDs.
Without a podcast metadata provider installed, the refresh job ends with
refresh metadata: no metadata found from any provideron both builds, after the scan. A quick refresh fails the same way, so this is unrelated to the change.Risks
None identified. The change applies only to podcast libraries, which are beta.
Checklist
AI Disclosure
item_refresh_test.go. Opus noted that the podcast behaviour of complete refresh was undocumented, sodocs/admin-catalog-api.mdnow covers it. Opus also suggested asserting the IDs again after a full rescan; dropped, because the podcast scanner tests already cover a rescan keeping a show's ID and the local run checked it. A re-review of those follow-up changes found nothing.Note
Fix
prepareCompleteRefreshto preserve podcast IDs on complete refreshcompleterefresh used to clear file-to-content links under the scan-path prefix for all folder types. For podcast libraries this dropped show and episode IDs referenced by favorites and progress. item_refresh.go now takes the media folder into account and keeps links for podcast folders; other folder types still clear them.TestCompleteItemRefreshKeepsPodcastIDsDB, that runs complete refreshes on a podcast show and episode and asserts IDs stay unchanged. It is registered in db-contracts.txt and skips whenSILO_TEST_DATABASE_URLis unset.Macroscope summarized 14e5c5d.