Repository navigation
fix(metadata): select and cache refresh artwork correctly - #676
Conversation
|
Warning Review limit reached
Next review available in: 59 minutes Limit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day 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 (11)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (15)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughMetadata refresh now selects artwork by type, language, provider, rating, and text presence. It then caches artwork for the refreshed content target, reports cache failures, and updates web notifications from loading to success or failure. ChangesMetadata refresh artwork
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to The PR makes interactive metadata refreshes prioritize the selected item's artwork and improves poster selection and refresh feedback; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant WebApp
participant ItemRefreshExecutor
participant ImageCacheProcessor
participant ImageCacheJobRepository
WebApp->>ItemRefreshExecutor: Start metadata refresh
ItemRefreshExecutor->>ImageCacheProcessor: CacheTargetArtwork(targetContentID)
ImageCacheProcessor->>ImageCacheJobRepository: Retry and claim target jobs
ImageCacheJobRepository-->>ImageCacheProcessor: Claimed jobs and running state
ImageCacheProcessor-->>ItemRefreshExecutor: Cache success or failure
ItemRefreshExecutor-->>WebApp: Refresh result
WebApp->>WebApp: Replace loading toast
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Review follow-ups on this branch. An artwork failure no longer abandons a committed metadata refresh. Returning the error from the last step jumped over the cache invalidation, both catalog events, and the result payload -- including the remapped detail content id -- so a single 404 on a poster left the client sitting on an item id that no longer resolved, with every query cache entry stale. The failure is now carried on the result as a warning and surfaced as one in the UI; the refresh itself still completes. The target-scoped wait now reaches a series' children. Season, episode, and localization jobs are queued under their own content ids with series_id pointing at the series, so filtering on target_content_id alone meant a series refresh waited for the two series-level rows, found nothing else, and reported success while every episode still sat behind the global backlog -- the case this branch set out to fix. Scope matching now covers both columns, which the existing (series_id, status) index serves. That wait is bounded. It had no deadline beyond the fifteen-minute lease and polled four statements at 10Hz, so a worker that died holding a job parked an interactive refresh on a spinner for the full lease. It now backs off from 100ms to 2s, gives up after 30s without progress, and reports the remainder as pending rather than blocking. retryTargetNow runs once per refresh instead of once per poll, and no longer resets attempt_count or clears last_error. Running it every pass wiped backoff that background workers had deliberately set on jobs that merely share a target. Backdrop selection has its terminal tier back. Narrowing it to language-neutral with no fallback meant an item whose backdrops are all language-tagged -- common for animation and title-card art -- kept an empty backdrop path permanently, and no per-language localization row could ever pick one. Language-neutral still wins; a tagged backdrop now beats none. The step count reflects whether caching will actually run rather than whether the cacher object exists, since it is wired whenever object storage is configured regardless of metadata.cache_images. Failure and completion totals track what the executor published, so progress no longer jumps from 4/4 back to 0/3. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Pushed review fixes to this branch (
|
Preserve target-scoped image-cache recovery from Silo-Server#676 while retaining the cooldown for jobs that exhaust their lease-expiry budget.
Problem
Related to #211; this PR does not close it.
Manual Quick and Complete Refresh can finish metadata while the selected item's artwork remains queued behind the global image-cache backlog. Poster selection also has no way to distinguish a genuinely text-bearing poster from a language-tagged but textless poster, so an English library can keep the wrong artwork.
Approach
includes_textimage signal and use four explicit poster tiers: preferred-language text, English text, other text, then textless. Local sidecars remain authoritative; backgrounds remain language-neutral; logos retain language-aware fallbacks.Authorship and live verification
All of this work is mine. I tested it end-to-end in my live Silo installation and confirmed that it works.
Codex assisted with upstream cleanup, tests, adversarial review, and PR preparation as disclosed below.
Testing
Focused Go tests:
CI-equivalent changed-line lint:
Changed Web tests and formatting:
Additional successful checks:
go vet ./internal/metadata ./internal/adminjob ./cmd/silogo build ./internal/... ./cmd/...make migrate-validatemake verify-local-pathspnpm exec eslint src/hooks/queries/items.ts src/hooks/queries/items.test.tsThe legacy unscoped
make lintwas run and reported the documented upstream baseline of 300 findings; the PR/CI changed-line gate above is clean. A full localmake test-goalso reached unrelated macOS-sensitive failures ininternal/jellycompatprocess-lock identity tests and fake-NVENC playback probes; all changed packages passed, and a transientinternal/transcodenodetiming failure passed in isolation.A new screenshot/recording is not attached because capturing the transient toast would require triggering another metadata-changing live refresh. The behavior has already been live-tested; visual evidence can be added if maintainers require it.
Adversarial review
The diff review found two material issues and both were fixed before publishing:
The final pass also checked local artwork precedence, provider ordering within tiers, background/logo fallbacks, Complete Refresh ID remapping, error propagation, and per-mutation toast identity. No material findings remain.
Risks & follow-up
includes_textfield to distinguish language-tagged textless posters. Providers that do not emit it retain the current language-based fallback.AI Disclosure
Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Documentation