Repository navigation
feat(catalog): rework TV recents and poster playback - #561
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds tracked direct scan lifecycles and provenance, resolves accessible playback targets, adds scan-aware recently added TV sections with cache invalidation, and exposes direct-play overlays across web cards and search results. ChangesScan lifecycle and provenance
Playable targets and TV sections
Web playback controls
Estimated code review effort: 5 (Critical) | ~120 minutes Merge Risk: 🔵 Low · up to Search results add an independent Play control, but the current structure may not provide a valid accessible interaction pattern for keyboard and assistive-technology users. The risk is localized and mergeable with explicit owner awareness or a follow-up fix. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 117 functions across 50 files. (8 skipped: 1 unsupported, 7 over the file limit.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (9)
internal/catalog/recent_tv.go (2)
347-355: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
slices.Sortinstead of a hand-written insertion sort.Lines 349-353 implement insertion sort. The standard library covers this case and removes the nested loop.
♻️ Proposed change
func sortedUniqueInts(values []int) []int { values = uniquePositiveInts(values) - for i := 1; i < len(values); i++ { - for j := i; j > 0 && values[j] < values[j-1]; j-- { - values[j], values[j-1] = values[j-1], values[j] - } - } + slices.Sort(values) return values }Add
"slices"to the import block.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/catalog/recent_tv.go` around lines 347 - 355, Replace the hand-written insertion sort in sortedUniqueInts with the standard library slices.Sort call after uniquePositiveInts returns. Add the slices import and preserve the existing returned values and uniqueness behavior.
189-260: 🚀 Performance & Scalability | 🔵 TrivialConfirm index coverage for the scan-run grouping and the availability
EXISTSchecks.The CTE groups
episode_librariesby(series_id, first_seen_scan_run_id)and runs a correlatedEXISTSagainstmedia_fileson(episode_id, media_folder_id, missing_since)for every candidate row.filteredis then scanned twice, once fortotalsand once forpage. Without indexes onepisode_libraries(media_folder_id, first_seen_at),episode_libraries(first_seen_scan_run_id), andmedia_files(episode_id, media_folder_id), this becomes a full grouping over the library on every uncached request.Capture
EXPLAIN (ANALYZE, BUFFERS)output for a large TV library before release.#!/bin/bash # Description: List indexes declared for episode_libraries and media_files in the migrations. set -euo pipefail fd -e sql . migrations/sql --exec rg -n -i 'CREATE (UNIQUE )?INDEX.*(episode_libraries|media_files)' {} + fd -e sql . migrations/sql --exec rg -n -i 'first_seen_scan_run_id' {} +🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/catalog/recent_tv.go` around lines 189 - 260, Verify index coverage for the query in the recent TV catalog flow, ensuring indexes support episode_libraries filtering by media_folder_id and first_seen_at, grouping by first_seen_scan_run_id, and media_files availability checks on episode_id and media_folder_id. Add or update migration indexes where coverage is missing, then capture EXPLAIN (ANALYZE, BUFFERS) for a large TV library to validate the grouping and repeated filtered scans.internal/api/handlers/catalog_resources.go (1)
340-350: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract a single-season enrichment helper.
Both sites wrap one
seasonResponsein a slice, callenrichSeasonPlayTargets, then read index 0 back. A single-value helper removes the duplicated wrap and unwrap.♻️ Proposed helper
Add to
internal/api/handlers/items.go:func (h *ItemsHandler) enrichSeasonPlayTarget(r *http.Request, seriesID string, season *seasonResponse) { if season == nil { return } wrapped := []seasonResponse{*season} h.enrichSeasonPlayTargets(r, seriesID, wrapped) *season = wrapped[0] }Then simplify both call sites:
- seasonResponses := []seasonResponse{resp} - h.items.enrichSeasonPlayTargets(r, id, seasonResponses) - resp = seasonResponses[0] + h.items.enrichSeasonPlayTarget(r, id, &resp) writeJSON(w, http.StatusOK, seasonDetailResponse{Season: resp})Also applies to: 381-383
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/api/handlers/catalog_resources.go` around lines 340 - 350, Add the single-value helper enrichSeasonPlayTarget on ItemsHandler, guarding nil seasons and internally wrapping, enriching, and copying back the seasonResponse. Update both affected call sites to use this helper directly instead of manually creating a one-element slice and reading index 0.internal/api/handlers/items.go (2)
938-947: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueSkip non-playable item types before calling the resolver.
listPlayableTargetssends every item to the resolver.PlayableTargetResolver.Resolvediscards types other thanmovie,episode,series, andseason, so book, audiobook, and manga items add rows to theunnestarrays without ever producing a target. Filtering in Go keeps the SQL payload proportional to the playable subset on mixed-library browse pages.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/api/handlers/items.go` around lines 938 - 947, Update listPlayableTargets to filter inputs to playable item types—movie, episode, series, and season—before calling resolvePlayableTargetInputs; continue skipping nil items and empty ContentID values, and exclude book, audiobook, manga, and other unsupported types from the SQL payload.
967-982: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConfirm that
enrichSeasonPlayTargetsmust clear unresolved targets.Line 980 assigns the map lookup unconditionally. If the resolver returns no entry for a season,
PlayContentIDbecomes"". The browse path at Lines 923-925 uses the opposite rule and preserves an existing value. No current caller pre-populatesseasonResponse.PlayContentID, so behavior is correct today. Consider matching the browse guard to keep the two paths consistent if a future caller sets the field earlier.♻️ Optional consistency change
for i := range seasons { - seasons[i].PlayContentID = targets[seasons[i].ContentID] + if seasons[i].PlayContentID == "" { + seasons[i].PlayContentID = targets[seasons[i].ContentID] + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/api/handlers/items.go` around lines 967 - 982, Update enrichSeasonPlayTargets to assign PlayContentID only when resolvePlayableTargetInputs returns a non-empty target for the season, preserving any existing value when the lookup is unresolved. Match the guarded assignment behavior used by the browse path while leaving resolved target handling unchanged.internal/catalog/catalog_resolver.go (1)
462-472: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win
req.SkipTotalis ignored on the recent-TV path.
RecentTVQuerycarries no skip-total flag, and Line 515 always reportsTotalExact: true.RecentTVRepository.Listtherefore always evaluatesCOUNT(*)over the fullfilteredCTE, even when the caller setSkipTotal. Every other section path honors the flag. Rail requests that only need the first few items pay for a complete grouping over the library.Thread
SkipTotalintoRecentTVQueryand setTotalExactfrom it.Also applies to: 511-517
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/catalog/catalog_resolver.go` around lines 462 - 472, Propagate req.SkipTotal through the recent-TV flow by adding it to RecentTVQuery and assigning it when constructing the query in the resolver. Update RecentTVRepository.List to skip the full COUNT(*) work when requested, and set the response’s TotalExact value from the query flag rather than always returning true.internal/api/handlers/sections.go (1)
1241-1262: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueReuse the existing dedup set for the play-target batch.
Lines 1211-1224 already build a deduplicated
contentIDslist with theseenmap. The new loop iteratesallItemsagain and can pass the sameContentIDseveral times when one item appears in more than one section. Buildinginputsfrom the deduplicated set removes the redundant rows in the batch query input.♻️ Proposed refactor
playTargets := map[string]string{} if h.fetcher != nil { - inputs := make([]catalog.PlayableTargetInput, 0, len(allItems)) - for _, item := range allItems { - if item == nil || item.ContentID == "" { - continue - } - inputs = append(inputs, catalog.PlayableTargetInput{ContentID: item.ContentID, Type: item.Type}) - } + typeByContentID := make(map[string]string, len(contentIDs)) + for _, item := range allItems { + if item == nil || item.ContentID == "" { + continue + } + if _, ok := typeByContentID[item.ContentID]; !ok { + typeByContentID[item.ContentID] = item.Type + } + } + inputs := make([]catalog.PlayableTargetInput, 0, len(contentIDs)) + for _, id := range contentIDs { + inputs = append(inputs, catalog.PlayableTargetInput{ContentID: id, Type: typeByContentID[id]}) + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/api/handlers/sections.go` around lines 1241 - 1262, Build the playable-target inputs from the existing deduplicated contentIDs/seen result created earlier in the handler instead of iterating allItems. Preserve each target’s required type information using the established item data, and continue passing the resulting inputs to ResolvePlayableTargets without duplicate ContentID entries.internal/sections/resolvedlistcache_test.go (1)
251-254: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer
t.Errorfplus a sentinel error inside loader closures.Both closures call
t.Fatalfrom inside aresolvedListLoader.t.Fatalcallsruntime.Goexit, which is only defined behavior on the goroutine that runs the test. Today these loaders run synchronously on the test goroutine, because the entry is a warm hit at the supplied timestamp, so the call never happens. If the cache timing assumptions change and the loader runs on a background refresh goroutine,t.Fatalproduces a confusing hang or a misattributed failure rather than a clean assertion.Returning an error and asserting on it afterwards keeps the failure attributable regardless of which goroutine invokes the loader.
♻️ Proposed refactor for line 251
+ errUnexpectedLoad := errors.New("late old-generation refresh repopulated the active key") active, _, err := getOrRefresh(context.Background(), newKey, base.Add(6*time.Minute), func(context.Context) ([]*models.MediaItem, int, error) { - t.Fatal("late old-generation refresh repopulated the active key") - return nil, 0, nil + return nil, 0, errUnexpectedLoad })Also applies to: 337-340
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/sections/resolvedlistcache_test.go` around lines 251 - 254, Replace t.Fatal calls inside the resolvedListLoader closures around getOrRefresh with t.Errorf and a sentinel error return, then assert the returned error after getOrRefresh completes. Apply the same pattern to both affected closures so failures remain attributable if refresh execution moves to a background goroutine.internal/sections/resolvedlistcache.go (1)
445-449: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the default scheduler to remove the duplicated closure.
Lines 446-449 repeat the closure defined at lines 93-96. A named function keeps the two definitions in sync if the scheduling behavior changes.
♻️ Proposed refactor
+func defaultResolvedListScheduleInvalidation(delay time.Duration, callback func()) func() { + timer := time.AfterFunc(delay, callback) + return func() { timer.Stop() } +}Then use it in both places:
- resolvedListScheduleInvalidation = func(delay time.Duration, callback func()) func() { - timer := time.AfterFunc(delay, callback) - return func() { timer.Stop() } - } + resolvedListScheduleInvalidation = defaultResolvedListScheduleInvalidation🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/sections/resolvedlistcache.go` around lines 445 - 449, Extract the duplicated scheduling closure into a named default scheduler function, preserving the time.AfterFunc and timer.Stop behavior. Update both the existing definition near the earlier scheduler setup and the resolved-list setup around resolvedListScheduleInvalidation to reference the shared function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/adminjob/direct_scan_run.go`:
- Around line 82-84: Update the Start error path in the direct scan run flow to
transition the accepted run to failed or cancelled before returning the startup
error. Execute that cleanup using a short timeout context derived with
context.WithoutCancel(ctx), so it still runs when the original context has
expired; preserve the existing wrapped error return and handle cleanup failure
according to the repository’s established reliability conventions.
In `@internal/adminjob/item_refresh.go`:
- Around line 500-512: Update the direct-scan flow after completeDirectScan
succeeds to publish EventScanComplete immediately, before folder checks, target
resolution, or metadata refresh. Remove the later duplicate EventScanComplete
publication so the event is emitted exactly once per completed scan.
In `@internal/catalog/catalog_resolver.go`:
- Around line 442-456: Extend recent-TV grouping to recognize media_scope
"video" alongside the existing series condition. Update the logic around
ResolveRecentTVLibraryIDs and RecentTVTarget so video-scoped queries pass
through the TV-resolution path with the same series semantics, while preserving
existing behavior for other media scopes.
In `@internal/catalog/recent_tv_db_test.go`:
- Around line 43-46: Update the t.Cleanup callbacks for the seeded runs,
including runCross and runMissing, to delete their corresponding scan_runs rows
before deleting media_folders. Use each seeded run’s identifiers and preserve
the existing media_items and media_folders cleanup so all related test data is
removed from the shared database.
In
`@migrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sql`:
- Around line 3-17: Make the migration non-transactional with the Goose NO
TRANSACTION directive, add both nullable columns before constraints, and create
each foreign key as NOT VALID to avoid blocking active ingestion. Build both
partial indexes with CREATE INDEX CONCURRENTLY, then validate each foreign key
after index creation. Update any Down migration to drop these indexes with DROP
INDEX CONCURRENTLY.
In `@web/src/components/GlobalSearch.tsx`:
- Around line 64-116: Update the search result row around the role="option"
container so it does not contain the nested button or CardPlayOverlay
interactive control. Either replace the listbox option pattern with a
non-listbox result container that preserves selection and playback actions, or
keep role="option" while moving the play action outside the listbox and ensuring
the row itself is not an interactive descendant container.
---
Nitpick comments:
In `@internal/api/handlers/catalog_resources.go`:
- Around line 340-350: Add the single-value helper enrichSeasonPlayTarget on
ItemsHandler, guarding nil seasons and internally wrapping, enriching, and
copying back the seasonResponse. Update both affected call sites to use this
helper directly instead of manually creating a one-element slice and reading
index 0.
In `@internal/api/handlers/items.go`:
- Around line 938-947: Update listPlayableTargets to filter inputs to playable
item types—movie, episode, series, and season—before calling
resolvePlayableTargetInputs; continue skipping nil items and empty ContentID
values, and exclude book, audiobook, manga, and other unsupported types from the
SQL payload.
- Around line 967-982: Update enrichSeasonPlayTargets to assign PlayContentID
only when resolvePlayableTargetInputs returns a non-empty target for the season,
preserving any existing value when the lookup is unresolved. Match the guarded
assignment behavior used by the browse path while leaving resolved target
handling unchanged.
In `@internal/api/handlers/sections.go`:
- Around line 1241-1262: Build the playable-target inputs from the existing
deduplicated contentIDs/seen result created earlier in the handler instead of
iterating allItems. Preserve each target’s required type information using the
established item data, and continue passing the resulting inputs to
ResolvePlayableTargets without duplicate ContentID entries.
In `@internal/catalog/catalog_resolver.go`:
- Around line 462-472: Propagate req.SkipTotal through the recent-TV flow by
adding it to RecentTVQuery and assigning it when constructing the query in the
resolver. Update RecentTVRepository.List to skip the full COUNT(*) work when
requested, and set the response’s TotalExact value from the query flag rather
than always returning true.
In `@internal/catalog/recent_tv.go`:
- Around line 347-355: Replace the hand-written insertion sort in
sortedUniqueInts with the standard library slices.Sort call after
uniquePositiveInts returns. Add the slices import and preserve the existing
returned values and uniqueness behavior.
- Around line 189-260: Verify index coverage for the query in the recent TV
catalog flow, ensuring indexes support episode_libraries filtering by
media_folder_id and first_seen_at, grouping by first_seen_scan_run_id, and
media_files availability checks on episode_id and media_folder_id. Add or update
migration indexes where coverage is missing, then capture EXPLAIN (ANALYZE,
BUFFERS) for a large TV library to validate the grouping and repeated filtered
scans.
In `@internal/sections/resolvedlistcache_test.go`:
- Around line 251-254: Replace t.Fatal calls inside the resolvedListLoader
closures around getOrRefresh with t.Errorf and a sentinel error return, then
assert the returned error after getOrRefresh completes. Apply the same pattern
to both affected closures so failures remain attributable if refresh execution
moves to a background goroutine.
In `@internal/sections/resolvedlistcache.go`:
- Around line 445-449: Extract the duplicated scheduling closure into a named
default scheduler function, preserving the time.AfterFunc and timer.Stop
behavior. Update both the existing definition near the earlier scheduler setup
and the resolved-list setup around resolvedListScheduleInvalidation to reference
the shared function.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ba726c78-1907-4274-8203-deddf938457c
📒 Files selected for processing (54)
cmd/silo/main.gointernal/adminjob/direct_scan_run.gointernal/adminjob/item_refresh.gointernal/adminjob/item_refresh_test.gointernal/adminjob/library_refresh.gointernal/adminjob/library_refresh_scan_run_test.gointernal/api/handlers/catalog.gointernal/api/handlers/catalog_recent_tv_test.gointernal/api/handlers/catalog_resources.gointernal/api/handlers/items.gointernal/api/handlers/sections.gointernal/api/handlers/sections_test.gointernal/catalog/catalog_resolver.gointernal/catalog/detail.gointernal/catalog/episode_library_repo.gointernal/catalog/filesplit/filesplit.gointernal/catalog/playable_targets.gointernal/catalog/playable_targets_db_test.gointernal/catalog/recent_tv.gointernal/catalog/recent_tv_db_test.gointernal/jellycompat/handlers_items.gointernal/models/media.gointernal/scanbatch/context.gointernal/scanbatch/context_test.gointernal/scanner/file_repo.gointernal/scanner/file_repo_scan_provenance_test.gointernal/scanner/scanner.gointernal/scanqueue/repository.gointernal/scanqueue/repository_direct_runs_db_test.gointernal/scanqueue/service.gointernal/sections/fetcher.gointernal/sections/fetcher_recently_added_compat_test.gointernal/sections/resolvedlistcache.gointernal/sections/resolvedlistcache_test.gointernal/sections/types.gomigrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sqlweb/src/api/types.tsweb/src/components/CardPlayOverlay.test.tsxweb/src/components/CardPlayOverlay.tsxweb/src/components/ContinueWatchingCard.tsxweb/src/components/GlobalSearch.test.tsxweb/src/components/GlobalSearch.tsxweb/src/components/ItemCard.test.tsxweb/src/components/ItemCard.tsxweb/src/components/ItemGrid.tsxweb/src/components/RecommendationGrid.test.tsxweb/src/components/RecommendationGrid.tsxweb/src/components/SeasonAccordion.test.tsxweb/src/components/SeasonAccordion.tsxweb/src/components/SectionItemCard.test.tsxweb/src/components/SectionItemCard.tsxweb/src/components/SectionRow.tsxweb/src/pages/ItemDetail/SeasonCarousel.test.tsxweb/src/pages/ItemDetail/SeasonCarousel.tsx
There was a problem hiding this comment.
♻️ Duplicate comments (1)
migrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sql (1)
48-66: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winDrop invalid indexes without blocking active ingestion.
Lines 62 and 84 run regular
DROP INDEXinsideDOblocks. PostgreSQL takes anACCESS EXCLUSIVElock for a normal index drop. A retry after a failed concurrent build can stall scans and file ingestion. (postgresql.org)Run
DROP INDEX CONCURRENTLY IF EXISTSas a top-level Goose statement, then recreate the index concurrently. Do not wrap either statement inStatementBegin.Proposed fix
-DO $$ -BEGIN - ... - DROP INDEX public.idx_media_files_first_seen_scan_run_id; - ... -END; -$$; +DROP INDEX CONCURRENTLY IF EXISTS public.idx_media_files_first_seen_scan_run_id; -CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_media_files_first_seen_scan_run_id +CREATE INDEX CONCURRENTLY idx_media_files_first_seen_scan_run_idApply the same change to
idx_episode_libraries_first_seen_scan_run_id.#!/bin/bash set -euo pipefail migration='migrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sql' # Expect only concurrent index drops for these retry-cleanup indexes. if rg -n '^\s*DROP INDEX public\.(idx_media_files_first_seen_scan_run_id|idx_episode_libraries_first_seen_scan_run_id);' "$migration"; then echo "Found blocking index drop(s)." >&2 exit 1 fi rg -n 'DROP INDEX CONCURRENTLY IF EXISTS public\.(idx_media_files_first_seen_scan_run_id|idx_episode_libraries_first_seen_scan_run_id)' "$migration"Also applies to: 72-88
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@migrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sql` around lines 48 - 66, Replace the DO blocks that conditionally drop invalid indexes for idx_media_files_first_seen_scan_run_id and idx_episode_libraries_first_seen_scan_run_id with top-level DROP INDEX CONCURRENTLY IF EXISTS statements. Keep each drop outside Goose StatementBegin/StatementEnd blocks, and ensure the indexes are recreated concurrently afterward.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In
`@migrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sql`:
- Around line 48-66: Replace the DO blocks that conditionally drop invalid
indexes for idx_media_files_first_seen_scan_run_id and
idx_episode_libraries_first_seen_scan_run_id with top-level DROP INDEX
CONCURRENTLY IF EXISTS statements. Keep each drop outside Goose
StatementBegin/StatementEnd blocks, and ensure the indexes are recreated
concurrently afterward.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f23bc089-183a-4e08-8732-02d97fdc3e40
📒 Files selected for processing (9)
internal/adminjob/direct_scan_run.gointernal/adminjob/item_refresh.gointernal/adminjob/item_refresh_test.gointernal/catalog/catalog_resolver.gointernal/catalog/recent_tv.gointernal/catalog/recent_tv_db_test.gomigrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sqlweb/src/components/GlobalSearch.test.tsxweb/src/components/GlobalSearch.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
- internal/catalog/catalog_resolver.go
- web/src/components/GlobalSearch.test.tsx
- internal/adminjob/item_refresh.go
- web/src/components/GlobalSearch.tsx
- internal/catalog/recent_tv_db_test.go
- internal/adminjob/direct_scan_run.go
- internal/catalog/recent_tv.go
Quick104
left a comment
There was a problem hiding this comment.
I reviewed the current head (0b330d7). Setting aside process and standards concerns, these functional issues should be addressed:
P1
-
Playable-target resolution ignores the profile's maximum playback quality (
internal/catalog/playable_targets.go:105-128). The resolver filters missing files, disabled folders, and library access, but never appliesAccess.MaxPlaybackQuality. Detail and playback enforce that limit later, so a profile capped at 1080p can receive a Play control andplay_content_idfor media whose only file is 4K, then reach a watch route with no allowed version. Please apply the same quality predicate used bycatalog.FileAllowedByAccessand add a resolver test for a quality-capped profile. -
Library-scoped section catalogs lose their library constraint during play-target enrichment (
internal/api/handlers/catalog.go:147). Forsource=section&scope=library, the parser stores the scope inCatalogRequest.LibraryID, while this call passes onlyreq.Query.LibraryIDs, which is empty for section sources. A series card can therefore select an episode from another accessible library. Please pass the effective source-library scope (includingreq.LibraryID) and cover a series present in multiple libraries. -
Keyboard search selection is no longer exposed to assistive technology (
web/src/components/GlobalSearch.tsx:273-301). The input'saria-activedescendantand the results' listbox/option semantics were removed, but ArrowUp/ArrowDown still update a visualselectedIndexon generic elements. Screen-reader users consequently receive no announcement of the selected result. Please restore a valid accessible composite/focus pattern while keeping the nested Play action valid, and add coverage for the resulting ARIA/focus behavior.
P2
-
Series/season resume selection bypasses SQLite-backed user progress (
internal/catalog/playable_targets.go:201-204). The resolver joins the PostgreSQLuser_watch_progresstable directly, so a supporteduserdb.backend=sqlitedeployment cannot use its progress when selecting an episode; an in-progress episode may be ignored. Please resolve progress through the configured user-store abstraction (ideally as a batched overlay) and add backend-conformance coverage. -
A crash before a direct scan starts can permanently block that scope (
internal/scanqueue/repository.go:315-334,517-533). Direct triggers are excluded from queue workers, and stale cleanup only fails direct runs inrunning. If the process dies afterCreatebut beforeStart, the run remainsacceptedindefinitely and the unique active-scope constraint rejects future refreshes. Please include stale accepted direct runs in recovery or make creation/start atomic, with a crash-window test. -
The migration's failed-build recovery can block catalog traffic (
migrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sql:48-88). Although the indexes are built concurrently, the recovery blocks use ordinaryDROP INDEX; retrying after an interrupted concurrent build can therefore wait for anACCESS EXCLUSIVElock on actively queried/ingested tables. Please move recovery to top-levelDROP INDEX CONCURRENTLY IF EXISTSstatements before the concurrent creates and validate the retry path.
|
@Quick104 Thanks for the careful review — all six findings are addressed in Highlights:
Validation passed: build, affected Go suites, 13 focused search tests, migration validation, frontend lint/format, local-path checks, and changed-line Go lint (0 issues). The new PostgreSQL-backed cases are committed for CI; this checkout did not have |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/scanqueue/repository_direct_runs_db_test.go (1)
85-99: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse
requested_atto makeacceptedDirectIDstale.
FailStaleDirectevaluatesCOALESCE(heartbeat_at, started_at, requested_at)for accepted rows. Keepstarted_atandheartbeat_atunset foracceptedDirectID, backdaterequested_atfor it, and backdatestarted_atandheartbeat_atonly fordirectIDandqueuedID.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/scanqueue/repository_direct_runs_db_test.go` around lines 85 - 99, The stale-run test setup must distinguish acceptedDirectID from started runs: update the SQL setup so started_at and heartbeat_at are backdated only for directID and queuedID, while acceptedDirectID keeps both unset and has requested_at backdated separately. Preserve the existing stale timestamp and FailStaleDirect coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@migrations/scan_run_provenance_test.go`:
- Around line 19-32: Update the regression checks around indexName in the
migration test to normalize SQL whitespace and match complete CREATE INDEX
CONCURRENTLY statements through their statement terminator, preventing similarly
named indexes from satisfying the assertion. Expand the ordinary-drop validation
to reject both DROP INDEX public.<indexName> and DROP INDEX IF EXISTS
public.<indexName> forms, while preserving the requirement that concurrent
cleanup precedes each create.
In `@web/src/components/GlobalSearch.tsx`:
- Around line 263-270: Update moveResultFocus so the modulo result is normalized
to a non-negative index before setSelectedIndex; preserve the empty-items
behavior and ensure ArrowUp with negative nextIndex wraps to the final result
for any non-empty items list.
---
Outside diff comments:
In `@internal/scanqueue/repository_direct_runs_db_test.go`:
- Around line 85-99: The stale-run test setup must distinguish acceptedDirectID
from started runs: update the SQL setup so started_at and heartbeat_at are
backdated only for directID and queuedID, while acceptedDirectID keeps both
unset and has requested_at backdated separately. Preserve the existing stale
timestamp and FailStaleDirect coverage.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 383cdafe-1034-401f-9f8f-4c7aaeb561e2
📒 Files selected for processing (12)
internal/api/handlers/catalog.gointernal/api/handlers/catalog_playable_targets_test.gointernal/api/handlers/items.gointernal/catalog/playable_targets.gointernal/catalog/playable_targets_db_test.gointernal/scanqueue/repository.gointernal/scanqueue/repository_direct_runs_db_test.gointernal/scanqueue/service.gomigrations/scan_run_provenance_test.gomigrations/sql/20260807094340_add_scan_run_provenance_to_media_availability.sqlweb/src/components/GlobalSearch.test.tsxweb/src/components/GlobalSearch.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
- internal/api/handlers/catalog.go
- internal/scanqueue/service.go
- internal/scanqueue/repository.go
- web/src/components/GlobalSearch.test.tsx
- internal/api/handlers/items.go
|
@coderabbitai Addressed the outside-diff stale accepted-run test feedback in |
|
Tip For best results, initiate chat on the files or code changes.
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
| FROM episodes e_play | ||
| WHERE page.target_type = 'series' | ||
| AND e_play.series_id = page.series_id | ||
| AND e_play.season_number = page.anchor_season_number |
There was a problem hiding this comment.
Recently-added TV play_content_id bypasses the profile playback-quality ceiling
The play_target LATERAL only checks el_play.media_folder_id = ANY($1) and mf_play.missing_since IS NULL. It never applies MaxPlaybackQuality, which PlayableTargetResolver deliberately does enforce (playable_targets.go, the CASE UPPER(BTRIM(mf.resolution)) rank clause).
Worse, this value then wins: catalog.go:222, items.go:923 and sections.go:1444 all only fall back to the resolver when item.PlayContentID is empty, so the enforced target is never used for TV recents.
Concretely: a profile capped at 1080p sees a series card whose Play button targets an episode that only exists as a 2160p file, and playback hard-fails at stream-token time.
Note the cache angle too — PlayContentID set here rides the process-global resolved-list cache, whose key (resolvedListCacheKey -> WriteAccessScopeCacheKey) excludes MaxPlaybackQuality. So making this value quality-dependent in the cached path would leak one profile's ceiling to another. The safe shape is to keep this as a profile-independent anchor hint and let the post-cache PlayableTargetResolver validate/resolve it per profile.
|
|
||
| requeued, err := s.repo.RequeueStaleRunning(ctx, time.Now().UTC().Add(-s.staleAfter)) | ||
| staleBefore := time.Now().UTC().Add(-s.staleAfter) | ||
| failed, err := s.repo.FailStaleDirect(ctx, staleBefore) |
There was a problem hiding this comment.
requeueStale() aborts the pre-existing stale-run requeue when the new FailStaleDirect errors
The new FailStaleDirect call returns on error, so a transient failure here disables RequeueStaleRunning entirely — behavior that worked before this PR.
A statement timeout or lock contention on scan_runs during a large scan is enough: requeueStale logs a warning and returns, and queue scan runs abandoned by a crashed worker are never requeued for as long as the error persists. The scan queue silently stalls.
Log and continue to RequeueStaleRunning rather than returning.
| return nil, nil, fmt.Errorf("create scan run: %w", err) | ||
| } | ||
| if !created { | ||
| return nil, nil, fmt.Errorf("scan scope already has active run %s", run.ID) |
There was a problem hiding this comment.
Admin item/library refresh now hard-fails whenever any active scan run covers the same scope
When scanqueue.Repository.Create reports created == false (the partial unique index idx_scan_runs_active_scope already has an accepted/running row for the same (media_folder_id, mode, path)), this returns a hard error. Before this PR the same call path just ran IngestSubtree.
Failure case: autoscan enqueues a subtree scan for /media/tv/Show (status accepted, not yet claimed). An admin clicks "Refresh item" on that show and gets scan scope: scan scope already has active run 01J…. Same for two concurrent refreshes of one item, or a retry while an earlier direct run is still inside the 2-minute stale window.
A reasonable fix keeps the old behavior: when the scope is already claimed, proceed with ingestion without owning a scan run (empty scanbatch run ID) and log it. Those files just get NULL provenance, i.e. the documented legacy/series-card path.
| } | ||
| progress := map[string]userstore.WatchProgress{} | ||
| if q.ProgressStore != nil && len(allCandidateIDs) > 0 { | ||
| progress, err = q.ProgressStore.ListProgressByMediaItems(ctx, q.ProfileID, allCandidateIDs) |
There was a problem hiding this comment.
Unbounded candidate fan-out becomes one bind parameter per episode
Resolve returns one row per (card, candidate episode) with no per-card cap, then hands the entire flattened list to ListProgressByMediaItems. The Postgres implementation (internal/userstore/pgstore/progress.go:650-656) emits one placeholder per ID.
Some callers reach BrowseFilters.MaxLimit of 1000. For 100 long-running series averaging 700 episodes, allCandidateIDs holds 70,000 IDs and the generated IN (...) exceeds Postgres' 65535 extended-protocol parameter limit — the request fails outright. Below that ceiling it still ships tens of thousands of rows and params on every list response.
At minimum: dedupe allCandidateIDs and chunk the progress lookup. Better: bound candidates per card in SQL (ROW_NUMBER() OVER (PARTITION BY ord …)) or push the ranking into SQL.
| .getElementById(`search-result-${selectedIndex}`) | ||
| ?.scrollIntoView({ block: "nearest" }); | ||
| const selectedResult = document.getElementById(`search-result-${selectedIndex}`); | ||
| selectedResult?.focus(); |
There was a problem hiding this comment.
Arrow-key selection steals DOM focus, so the user can no longer type to refine the query
The selection effect now calls selectedResult?.focus(), moving DOM focus off the search input onto a result <button>. A button accepts no text, and its onKeyDown handles only ArrowUp/ArrowDown.
Repro: type bre, press ArrowDown once. selectedIndex becomes 0, focus moves to #search-result-0, the input blurs. Now type aking — nothing happens; the keystrokes go to the button and are discarded. The useEffect at line 236 that resets selectedIndex on query change can never fire, because query can no longer change.
The previous aria-activedescendant virtual-focus combobox pattern is the standard here and keeps the Play control independently reachable via Tab.
| } | ||
| inputs = append(inputs, catalog.PlayableTargetInput{ContentID: item.ContentID, Type: item.Type}) | ||
| } | ||
| resolvedTargets, err := h.fetcher.ResolvePlayableTargets(r.Context(), catalog.PlayableTargetQuery{ |
There was a problem hiding this comment.
Section play targets ignore watch progress (no ProgressStore passed)
This PlayableTargetQuery omits ProgressStore, even though SectionHandler.StoreProvider is right there. preferredPlayableTarget then sees an empty progress map, ranks every candidate 1, and returns the lowest-numbered available episode.
So a profile watched through S03E05 gets "resume S03E05" from the series card on /api/v1/catalog (which does pass the store via resolvePlayableTargetInputs) and "play S01E01" from the identical card in a Home rail. Two surfaces, two answers.
| if err := completeDirectScan(ctx, e.scanRuns, scanRun, ingestResult); err != nil { | ||
| return nil, fmt.Errorf("scan scope: %w", err) | ||
| } | ||
| e.publish(cache.EventScanComplete, strconv.Itoa(req.ScanFolderID)) |
There was a problem hiding this comment.
EventScanComplete now published before the metadata refresh
This publish moved from after refreshMetadata to immediately after the scan completes. With the new sections.InvalidateResolvedListCache subscriber wired to this event (cmd/silo/main.go:659), the generation can advance and a rail can rebuild from pre-refresh data.
That freshly-cached entry then holds stale title/poster/type for the full 15-minute resolvedListTTL, because EventMetadataUpdated (published one line later) is not wired to the invalidator.
Same ordering question applies to the new publish in library_refresh.go:435. Either restore the post-refresh ordering, or also invalidate on EventMetadataUpdated.
| return nil, false, fmt.Errorf("iterating TV recent libraries: %w", err) | ||
| } | ||
|
|
||
| if !explicitSeries { |
There was a problem hiding this comment.
A non-series filter_type is hijacked by TV event grouping
When explicitSeries is false the decision is made purely from library types, ignoring a configured filter_type of movie/episode/season.
A rail configured {"filter_type":"episode"} scoped to library 7 (type series) satisfies "every requested library is type series", so tvScoped is true and RecentTVRepository.List takes over — returning a mix of series cards (multi-episode and legacy events) and episode cards, ignoring the episode-only request. The old buildRecentlyAddedQuery path ran applyConfigTypeFilter and honored it.
Pass the actual FilterType through and bail out to the generic path for any non-empty, non-series value.
|
|
||
| overlaySummaries := h.listOverlaySummaries(r.Context(), result.Items, h.accessFilter(r)) | ||
| userStates := h.listItemUserStates(r, result.Items) | ||
| playTargets := h.listPlayableTargets(r, result.Items, req.Query.LibraryIDs, h.accessFilter(r)) |
There was a problem hiding this comment.
/browse never populates series_id, so the new episode heading link is dead there
writeCatalogBrowseResponse resolves play targets but builds responses through toItemListResponseWithOverlay -> itemListResponseShell, which never sets SeriesID. Only CatalogHandler.catalogItemResponses calls listEpisodeBrowseMetadata/applyEpisodeBrowseMetadata.
So an episode card rendered from a /browse response has item.series_id === undefined, and ItemCard.tsx:232 collapses headingHref to itemHref. Clicking the series title opens the episode's own detail page — silently diverging from the identical card fed by /api/v1/catalog.
| // cached entry never leaks one profile's state to another. | ||
| func resolvedListCacheKey(resolved ResolvedSection, libraryID *int, libraryIDs []int, filter catalog.AccessFilter) string { | ||
| var b strings.Builder | ||
| if resolved.SectionType == SectionRecentlyAdded { |
There was a problem hiding this comment.
Superseded cache generations are retained for the full 15-minute TTL
Advancing resolvedListGeneration only changes future keys. The entries it obsoletes stay in resolvedListCache until expiresAt (15 min) and are only swept opportunistically inside resolvedListSet, at most once per minute.
During a large multi-library rescan the generation advances every 30 s, so up to resolvedListTTL / resolvedListInvalidationInterval = 30 generations of every (library × access-scope) entry are alive at once. With 20 access scopes that is 600 live entries instead of 20 — a 30× memory multiplier that only decays once scanning stops.
InvalidateResolvedListCache should drop the keys it supersedes.
| SELECT series_id, 'series'::text, added_at, ''::text, series_id, NULL::integer, NULL::text | ||
| FROM series_without_episode_events | ||
| ), | ||
| deduplicated AS ( |
There was a problem hiding this comment.
The deduplicated CTE can never remove a row
episode_events is already GROUP BY e.series_id, el.first_seen_scan_run_id, so (target_id, target_type, event_id) is unique within it; and series_without_episode_events is disjoint from it by construction (its NOT EXISTS requires no present file, which episode_events requires).
Every row therefore has target_rank = 1. The window function adds a partition+sort over the whole event set on every Recently Added page load for no behavioral benefit, and a future reader has to re-derive the disjointness proof to know it is safe to touch. filtered can select straight from all_events.
| return resp | ||
| } | ||
|
|
||
| func sectionRequestLibraryIDs(r *http.Request) []int { |
There was a problem hiding this comment.
Library scope re-derived by sniffing r.URL.Path for "/library/"
Every caller of buildSectionsResponse already parsed a validated libraryID a few lines earlier (HandleLibrarySections at 643, HandleLibrarySectionItems at 665). Recovering it here by substring-matching the URL and re-parsing chi.URLParam(r, "id") is a second, weaker source of truth.
If the route is ever remounted (/libraries/{id}/sections) or the param renamed, play targets silently stop being library-scoped — no error, no failing test, no compile break. Pass libraryID down instead.
| return result | ||
| } | ||
|
|
||
| func sortedUniqueInts(values []int) []int { |
There was a problem hiding this comment.
Hand-rolled insertion sort and duplicate int-set helpers
sortedUniqueInts implements an insertion sort by hand where slices.Sort does the job, and intersectOptionalInts duplicates the package's existing intersectInts (internal/catalog/query_executor.go:510).
Four new int-set helpers land in a package that already has one, so the intersection semantics now live in two places and can drift.
| episodes, | ||
| h.items.getAggregateUserData(r, episodes), | ||
| ) | ||
| seasonResponses := []seasonResponse{resp} |
There was a problem hiding this comment.
Single season wrapped in a slice just to enrich it
Both single-season branches wrap one seasonResponse into a slice, call enrichSeasonPlayTargets, then unwrap seasonResponses[0] — the same three lines at 347-349 and 381-383.
A third single-season path means copying it again, and a reader has to verify seasonResponses[0] is still the same value. A resolveSeasonPlayTarget(r, seriesID, *seasonResponse) helper (or having the enricher take []*seasonResponse) removes both copies.
| items.length === 0 ? -1 : prev <= 0 ? items.length - 1 : prev - 1, | ||
| ); | ||
| moveResultFocus(selectedIndex < 0 ? items.length - 1 : selectedIndex - 1); | ||
| } else if (e.key === "Enter" && selectedIndex >= 0 && items[selectedIndex]) { |
There was a problem hiding this comment.
Unreachable Enter branch on the search input
This branch is guarded by selectedIndex >= 0, but selectedIndex only becomes non-negative through moveResultFocus, which immediately moves DOM focus to the result button. The input can therefore never receive an Enter event while the guard holds.
handlePickItem(items[selectedIndex].content_id) at line 312 is dead: Enter on a selected result is handled by the button's native click, and Enter with no selection falls through to form submission. It reads as a second implementation of result activation that no test can exercise.
(If finding #5 is fixed by restoring aria-activedescendant virtual focus, this branch becomes live again and should stay.)
Fifteen findings from review of this branch, plus follow-ups. Correctness: - Recently-added TV play targets bypassed the profile's playback-quality ceiling and outranked the profile-aware resolver. The SQL value is now a profile-independent anchor hint (PlayableTargetInput.PreferredContentID) that PlayableTargetResolver honors only when it clears the same file conditions as any other candidate. It cannot be filtered in place: the value rides the shared resolved-list cache, whose key excludes MaxPlaybackQuality. - Resolve is keyed by PlayableTargetInput.Key (type + content ID + hint), so two recently-added scan-run event cards for one series resolve separately. - Progress lookups are deduped and batched; candidates stay uncapped so a profile deep inside a long-running series still resumes correctly. - requeueStale no longer aborts RequeueStaleRunning when FailStaleDirect errors. - Admin item/library refresh no longer hard-fails when another scan run already covers the scope; it ingests without scan-run provenance instead. - EventScanComplete is published after the metadata refresh again, so cache invalidation cannot repopulate rails from pre-refresh data. - Section play targets pass a ProgressStore, matching the catalog endpoints. - A non-series filter_type no longer gets TV event grouping. - /browse populates series_id, so episode cards link to their series. - InvalidateResolvedListCache releases the entries it supersedes. - GlobalSearch keeps keyboard focus in the input via aria-activedescendant, so typing still refines the query after ArrowDown. The Play link is a sibling of the option, not a child: role="option" is children-presentational and would hide it from assistive technology. Cleanup: - Drop the dead deduplicated CTE from the recent-TV query. - Pass the library scope into buildSectionsResponse instead of re-deriving it from the URL path. - Reuse intersectInts and slices.Sort in recent_tv.go. - Add a single-season play-target helper. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
# Conflicts: # internal/adminjob/item_refresh_test.go # internal/api/handlers/catalog.go # internal/api/handlers/catalog_resources.go # internal/api/handlers/items.go # internal/api/handlers/sections.go # internal/models/media.go # internal/scanner/file_repo.go # internal/scanner/scanner.go # web/src/components/ContinueWatchingCard.tsx # web/src/components/ItemCard.tsx # web/src/components/SectionItemCard.tsx # web/src/pages/ItemDetail/SeasonCarousel.tsx
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
The leaf_targets CTE matched movie and episode files through a single CASE expression, which PostgreSQL cannot drive through either media_files index; every movie/episode card scanned the whole table (~10s per section request on a 1.8M-row dev catalog). Splitting the predicate into type-specific EXISTS branches restores index probes (10.1s -> 2.2ms for a 16-card page on the shared dev data). Co-Authored-By: Claude Fable 5 <[email protected]>
The recently-added TV query walked every episode-availability row for the requested libraries twice: once to aggregate (series, scan run) events and again inside the series-without-episodes anti-join. On the shared dev catalog (794K rows in the TV library) that cost ~4.7s per uncached request. Materialize the qualifying availability rows once and derive both the event aggregate and the anti-join from that CTE (4.7s -> 3.1s measured; result-identical on a 500-row page). Access and name-prefix conditions move from the availability scan to the event aggregate so the anti-join keeps seeing every series with any present episode file, preserving the original per-branch semantics. Co-Authored-By: Claude Fable 5 <[email protected]>
…lumns The single-pass shape still sorted every availability row (794K in the shared dev TV library) to aggregate 25.7K historical events per uncached request. Split the no-prefix path in two: a narrow MAX-only aggregate that PostgreSQL fuses into a parallel hash aggregate finds and ranks every event, then the expensive columns (episode counts, anchor episodes) are computed only for the requested page, driven from the page keys. rank() keeps added_at ties together so the fully tiebroken page ordering is unaffected. Measured 3.31s -> 1.99s on shared dev; result-identical on a 500-row page under a fixed snapshot. The name-prefix path keeps the single-pass shape: its per-episode title filter changes which rows belong to each event and cannot move past the aggregation. Co-Authored-By: Claude Fable 5 <[email protected]>
PostgreSQL rejects $limit + $offset when both bind parameters reach the expression untyped (operator is not unique: unknown + unknown); cast both to bigint. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Pushed four performance commits after testing this PR on the shared dev deployment (1.16M
Live results on shared dev (server-side Remaining discussion for this PR: the recent-TV query still makes one full pass over the library's availability rows per cache miss (irreducible for exact results in the current schema). Options if that matters at scale: a covering index ( Commands run: AI Disclosure
🤖 Generated with Claude Code |
What changed
/Items/Latestcompatibility through an explicit TV-grouping opt-out.Why
Recently Added previously linked every TV update to the series or season, making a newly arrived episode slower to reach. It also lacked a consistent direct-play interaction across media-card surfaces. This aligns TV additions with Plex-style behavior while preserving existing detail navigation and compatibility clients.
Reliability and architecture
Validation
Passed:
make buildinternal/scanqueue,internal/adminjob,internal/sections,internal/catalog,internal/scanner, and API handlersmake migrate-validatemake verify-local-pathsgolangci-lint run --new-from-rev=main(0 issues)pnpm run lint(0 errors; existing warnings only)pnpm run format:checkgit diff --checkRepository-wide baseline notes:
make test-web: 1,784 tests passed; 36 existing failures remain in appearance/localStorage and settings-realtime tests.make test-go: affected packages pass; existing Jellyfin compatibility process-lock/shared-database and playback-environment failures remain.make lint: the repository-wide baseline currently reports 303 pre-existing findings; changed-line lint reports none.Manual QA
Verified against an isolated PostgreSQL/Redis stack using real Home and catalog pages:
Risks
/api/v1fields.Review follow-up (Quick104)
Addressed all six functional findings from Quick104's review in
7c26f9ee:acceptedandrunning;Follow-up validation:
make build; affected Go package suites; 13 focused GlobalSearch tests;make migrate-validate;make verify-local-paths; frontend lint/format checks; and changed-linegolangci-lint(0 issues).CodeRabbit follow-up
Addressed CodeRabbit's follow-up review in
4a5fc686:requested_atwhile leavingstarted_atandheartbeat_atunset.Follow-up review found no material issues. Validation passed: affected Go suites, 13 focused GlobalSearch tests, TypeScript build, migration validation, frontend format checks, local-path checks, and changed-line Go lint (0 issues). ESLint reports 0 errors and one pre-existing warning.
AI Disclosure
Summary by CodeRabbit
New Features
Bug Fixes