Repository navigation
fix(metadata): stop manual rematch from resurrecting recorded stale IDs - #276
Conversation
The Apply Match flow (ModeIdentify) re-injected durable provider IDs into the identify request without checking stale_media_ids, so a known-dead tmdb ID rode along, 404ed again during the Phase-2 fetch, and was re-recorded with a fresh last_seen_at — the item never left the Stale External IDs list and jumped back to the top after every rematch. Filter recorded-stale IDs out of the injected durable set in prepareProcessRequest. Caller-supplied IDs are untouched, so an admin deliberately re-selecting a previously-stale ID still retries it (which is also why the ModeIdentify suppression guard in processInternal stays). Fixes Silo-Server#268 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Warning Review limit reached
Next review available in: 58 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code reviewFound 1 issue:
silo-server/internal/metadata/service.go Lines 827 to 831 in fa72747 silo-server/internal/api/handlers/admin_match.go Lines 192 to 197 in fa72747 Otherwise the fix verified cleanly: it correctly filters only the injected durable set, preserves the deliberate 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…'t be bypassed by casing Review on PR Silo-Server#276 flagged that suppressRecordedStaleProviderIDs lowercases and trims the stored stale row's provider before looking it up in the incoming map, while the map keys are used verbatim, and that HandleApplyItemMatch passes req.ProviderIDs from the JSON body straight into metadata.Process without the normalization the search endpoint applies. A caller-supplied key like "TMDB" or " tmdb " therefore defeated the suppression. The same normalization gap was previously flagged on PR Silo-Server#182. Fix both layers: - HandleApplyItemMatch now runs req.ProviderIDs through normalizeMatchProviderIDs (same semantics as the search endpoint) and returns 400 when no non-blank entries remain, mirroring the existing empty-map rejection. - suppressRecordedStaleProviderIDs now indexes the incoming map by normalized key and deletes the matching original keys, so suppression is robust regardless of caller casing or padding. Adds regression tests at both layers: a metadata-level case where the durable row arrives as "TMDB " while the stale row records "tmdb", and handler-level cases asserting apply normalizes keys/values and rejects all-blank provider-id maps. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Addressed the review finding in 515d245:
New tests: stale-ID suppression despite 🤖 Generated with Claude Code |
…Ds (Silo-Server#276) * fix(metadata): stop manual rematch from resurrecting recorded stale IDs The Apply Match flow (ModeIdentify) re-injected durable provider IDs into the identify request without checking stale_media_ids, so a known-dead tmdb ID rode along, 404ed again during the Phase-2 fetch, and was re-recorded with a fresh last_seen_at — the item never left the Stale External IDs list and jumped back to the top after every rematch. Filter recorded-stale IDs out of the injected durable set in prepareProcessRequest. Caller-supplied IDs are untouched, so an admin deliberately re-selecting a previously-stale ID still retries it (which is also why the ModeIdentify suppression guard in processInternal stays). Fixes Silo-Server#268 Co-Authored-By: Claude Fable 5 <[email protected]> * fix(metadata): normalize provider-id keys so stale-ID suppression can't be bypassed by casing Review on PR Silo-Server#276 flagged that suppressRecordedStaleProviderIDs lowercases and trims the stored stale row's provider before looking it up in the incoming map, while the map keys are used verbatim, and that HandleApplyItemMatch passes req.ProviderIDs from the JSON body straight into metadata.Process without the normalization the search endpoint applies. A caller-supplied key like "TMDB" or " tmdb " therefore defeated the suppression. The same normalization gap was previously flagged on PR Silo-Server#182. Fix both layers: - HandleApplyItemMatch now runs req.ProviderIDs through normalizeMatchProviderIDs (same semantics as the search endpoint) and returns 400 when no non-blank entries remain, mirroring the existing empty-map rejection. - suppressRecordedStaleProviderIDs now indexes the incoming map by normalized key and deletes the matching original keys, so suppression is robust regardless of caller casing or padding. Adds regression tests at both layers: a metadata-level case where the durable row arrives as "TMDB " while the stale row records "tmdb", and handler-level cases asserting apply normalizes keys/values and rejects all-blank provider-id maps. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: Quick <[email protected]>
Problem
When an item with a stale provider ID (e.g.
Formula 1, tmdb=324880) is manually rematched to a correct result from a different provider via Admin → Match → Apply Match, it never leaves the Stale External IDs list — itslast_seenrefreshes and it jumps back to the top.Mechanism: the Apply Match flow runs
ProcessinModeIdentify.prepareProcessRequestre-injects the item's durable provider IDs — including the known-dead tmdb ID — into the request without consultingstale_media_ids. The Phase-2 fetch 404s on it again, and the post-persist stale-row refresh (DeleteByContentID+ re-Upsertof this run's 404s) re-creates the stale row with a freshlast_seen_at. The list is orderedlast_seen_at DESC, hence the row resurfacing at the top.Approach
Filter recorded-stale IDs out of the injected durable set in
prepareProcessRequest(reusingsuppressRecordedStaleProviderIDs), before it merges into the request. Two properties fall out deliberately:req.ProviderIDsare never filtered, so an admin explicitly re-selecting a previously-stale ID (e.g. the provider fixed it) still retries it. This is also why the existingMode != ModeIdentifysuppression guard inprocessInternalstays untouched.HandleRematchStaleIDbehavior.For non-identify modes the filtering is redundant-but-harmless: those paths already suppress recorded-stale IDs later in
processInternal.Two regression tests via
ProcessWithProviders: one reproduces the full #268 scenario (stale tmdb + rematch to tvdb → request must not carry tmdb, stale rows must be empty after persist; failed before the fix with the stale row re-upserted), and one pins the exception (user re-selecting the recorded-stale ID keeps it).Risks / follow-ups
Behavior change is limited to durable-ID injection when a matching
stale_media_idsrow exists. Scheduled/manual refreshes already suppressed these IDs downstream, so no observable change there.Fixes #268
AI-use disclosure
Implemented with Claude Code (test-first); human-reviewed before submission.
🤖 Generated with Claude Code