Skip to content

feat(collections): add profile-scoped display filters - #191

Merged
Quick104 merged 9 commits into
mainfrom
codex/profile-scoped-collection-filters
Jun 24, 2026
Merged

Quick104 merged 9 commits into
mainfrom
codex/profile-scoped-collection-filters

Conversation

@Quick104

@Quick104 Quick104 commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add user collection display filters for watch state (all, unwatched, watched) and media type (all, movie, series).
  • Apply exact-list user collection filters at read time in catalog and Home/section fetches, preserving source order and applying pagination/section limits after filtering.
  • Add compact filter controls to imported and manual user collection editors, plus a /collections/capabilities endpoint for client feature detection.
  • Harden MDBList URL normalization so page URLs, JSON URLs, trailing slashes, and repeated /json suffixes resolve consistently across user and server collection sync.

Part of approved V1 collection filter scope.

Details

This keeps synced collection membership unchanged and filters only the displayed results for the active profile. The shared filtering helper batches watched-state resolution, treats completed progress or completed history as watched, and requires all available child episodes to be complete before series/seasons count as watched.

Existing collections default to watch_filter="all" and media_filter="all", so existing behavior is preserved until a user opts into a display filter.

Imported collection editing now updates source_config.library_ids through the dedicated update field instead of writing imported library scope back into query_definition, keeping imported collections as exact synced lists.

Validation

  • GOWORK=off go test ./internal/userstore ./internal/catalog ./internal/sections ./internal/api/handlers ./internal/collectionutil ./internal/usercollections
  • cd web && pnpm exec tsc -b --noEmit
  • cd web && pnpm exec eslint . --quiet

Notes / Follow-up

  • Server/admin collection browse-time watch filtering is not included here; this PR keeps the approved V1 scope focused on user-owned collection display filters.
  • Private MDBList external-list sync still needs a follow-up to reuse the existing user MDBList watch-provider API key during collection sync.

AI Use

Implemented with assistance from Codex.

Summary by CodeRabbit

  • New Features

    • Added collection “Display” filters (Watch state and Content type) for manual and imported user collections, including persisted settings.
    • Added a collections capabilities endpoint to advertise supported display filter fields and presets.
    • Improved catalog browsing/search for library/user collection sources with overlay-aware behavior and source-order handling in the UI.
  • Bug Fixes

    • Collection create/update flows now validate, normalize, and correctly serialize display filters (including shared imports).
    • Library/user collection listings are more accurately scoped for the active profile.
    • MDBList imports now normalize and retry multiple candidate JSON endpoints; Static video streams and Simkl history export are more reliable.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds display_query_definition support for personal collections across storage, API, catalog resolution, sections, and web UI. Also updates collection capabilities, collection-source overlay handling, MDBList URL fallback, Simkl history export, MDBList progress parsing, manual sync retries, and static playback handling.

Changes

Personal collection display filters

Layer / File(s) Summary
Schema and persistence
migrations/sql/20260623184858_user_collection_display_filters.sql, migrations/sql/20260624124430_add_user_collection_display_query_definition.sql, internal/userstore/types.go, internal/userstore/collection_filters.go, internal/userstore/progress_helpers.go, internal/userstore/pgstore/collections.go
Adds display-query fields to collection types, migration storage, and Postgres read/write paths.
Display query normalization
internal/catalog/display_query_filter.go, internal/catalog/display_query_filter_test.go
Adds display-query fragment normalization and item filtering helpers, with tests for validation and Postgres-backed filtering.
Collection API and profile scoping
internal/api/handlers/collections.go, internal/api/handlers/user_collection_imports.go, internal/api/router.go, internal/usercollections/listing.go, internal/api/handlers/library_collections.go
Adds collection capabilities, request/response fields, import handling, profile-scoped listing, and collection-source update handling.
Catalog overlays and watched SQL
internal/catalog/catalog_parser.go, internal/catalog/catalog_parser_test.go, internal/catalog/catalog_resolver.go, internal/catalog/query_builder.go, internal/catalog/query_builder_test.go
Allows collection overlays in request parsing, resolves collection sources through display filtering, and rewrites watched SQL generation.
Sections filtering
internal/sections/fetcher.go, internal/sections/user_collection_limit_test.go
Changes section fetching for smart and exact collections to apply display-query filtering and preserve full totals before limiting.
Frontend filter contracts
web/src/api/types.ts, web/src/lib/collectionDisplayFilters.ts, web/src/lib/collectionDisplayFilters.test.ts, web/src/hooks/queries/collections.ts
Adds display-query types, shared conversion helpers, and the capabilities query hook used by collection UI flows.
Frontend collection and catalog UI
web/src/components/collections/CollectionBuilder.tsx, web/src/components/CollectionTemplateGallery/UserCollectionTemplateConfigForm.tsx, web/src/pages/ImportedCollectionEditor.tsx, web/src/pages/userCollectionsShared.tsx, web/src/pages/Collections.test.tsx, web/src/components/catalog/CatalogFilterBar.tsx, web/src/components/catalog/CatalogFiltersPanel.tsx, web/src/components/catalog/CatalogFiltersPanel.test.tsx, web/src/pages/Catalog.tsx, web/src/pages/catalogSearchParams.ts, web/src/pages/catalogSearchParams.test.ts
Updates collection builders, import editors, catalog overlays, and serialization tests to use display_query_definition and source-order state.

MDBList URL normalization

Layer / File(s) Summary
Shared MDBList helpers
internal/collectionutil/mdblist.go, internal/collectionutil/mdblist_test.go, internal/usercollections/types.go, internal/usercollections/types_test.go, internal/usercollections/sync.go, internal/catalog/library_collection_service.go
Adds shared MDBList URL canonicalization, candidate generation, and fallback fetch helpers, then rewires usercollections and library collection sync to use them.

Watchsync provider fixes

Layer / File(s) Summary
MDBList progress parser
internal/watchsync/providers/mdblist/provider.go
Changes MDBList playback parsing to accept numeric strings with optional percent signs and maps the parsed progress into the watchsync result shape.
Simkl playback and history export
internal/watchsync/providers/simkl/provider.go, internal/watchsync/providers/simkl/provider_test.go
Switches Simkl playback fetches to plural endpoints and changes history export to map typed not_found responses back to local history IDs per item.
Manual sync timeout retry
internal/watchsync/service.go
Replaces the single active-sync check with a loop that finalizes timed-out runs before creating a new manual sync run.

Static direct-play bypass

Layer / File(s) Summary
Static=true bypasses direct-play rejection
internal/jellycompat/streams.go, internal/jellycompat/playback_static_directplay_test.go
Introduces a static request flag, gates remux and error handling on that flag, and verifies static playback succeeds even when the negotiated source cannot direct play.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • Silo-Server/silo-server#1: Both PRs modify internal/api/handlers/collections.go’s response shaping, including the collection JSON output.
  • Silo-Server/silo-server#157: Both PRs touch the case-insensitive Static query handling in internal/jellycompat/streams.go.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: profile-scoped display filters for collections.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/profile-scoped-collection-filters

Comment @coderabbitai help to get the list of available commands.

@Quick104
Quick104 marked this pull request as ready for review June 23, 2026 19:50
@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Jun 23, 2026
Address code-review feedback on the profile-scoped display filters
without changing behavior:

- Widen CompletedHistoryItemMap to accept ProgressCompletionStore and
  drop the duplicate completedHistoryItemMapForProgress copy.
- Extract the duplicated MDBList candidate retry loop into a generic
  collectionutil.FetchMDBListWithFallback helper, used by both the user
  and library collection syncers, and cover it with unit tests.
- Reuse validateOptionalLibraryIDs in HandleUpdateCollection instead of
  an inline positive-ID loop.
- Import the shared COLLECTION_{WATCH,MEDIA}_FILTER_OPTIONS in the
  template config form rather than redefining them locally.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
internal/userstore/collection_filters.go (1)

18-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid exporting mutable filter-value slices directly.

These exported []string globals can be mutated by callers at runtime. Prefer immutable backing storage and expose a copy-returning accessor to keep filter capabilities stable.

🤖 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/userstore/collection_filters.go` around lines 18 - 28, The exported
variables CollectionWatchFilterValues and CollectionMediaFilterValues are
mutable slices that can be modified by callers at runtime, compromising filter
stability. Refactor by making these slice variables unexported (lowercase names)
to prevent direct mutation, then create public accessor functions that return
copies of the filter values instead of exposing the original slices. This
ensures callers can read the filter options without being able to modify them.
internal/userstore/pgstore/collections.go (1)

59-68: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Align create-time invalid filter handling with update-time validation.

Create currently coerces invalid filter values to "all", while update rejects invalid values. Keeping both paths strict for invalid non-empty input improves correctness and surfaces caller bugs earlier.

Proposed adjustment
 if value, ok := userstore.NormalizeCollectionWatchFilter(input.WatchFilter); ok {
 	input.WatchFilter = value
 } else {
-	input.WatchFilter = userstore.CollectionWatchFilterAll
+	return nil, fmt.Errorf("invalid watch filter %q", input.WatchFilter)
 }
 if value, ok := userstore.NormalizeCollectionMediaFilter(input.MediaFilter); ok {
 	input.MediaFilter = value
 } else {
-	input.MediaFilter = userstore.CollectionMediaFilterAll
+	return nil, fmt.Errorf("invalid media filter %q", input.MediaFilter)
 }
🤖 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/userstore/pgstore/collections.go` around lines 59 - 68, The
create-time filter validation currently coerces invalid filter values to "all"
when NormalizeCollectionWatchFilter and NormalizeCollectionMediaFilter return
false, whereas update-time validation rejects invalid values outright. To align
both paths and improve correctness, remove the fallback logic that sets
input.WatchFilter and input.MediaFilter to CollectionWatchFilterAll and
CollectionMediaFilterAll respectively when normalization fails. Instead, return
an error when either normalization function returns false for non-empty input
values, making the create-time path strict like the update-time validation.
internal/userstore/progress_helpers.go (1)

174-193: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Deduplicate the completed-history map logic to avoid drift.

This helper duplicates the mapping flow already present in CompletedHistoryItemMap. Extract one shared private mapper over a minimal interface and keep both call sites thin.

🤖 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/userstore/progress_helpers.go` around lines 174 - 193, The loop that
converts completed history items into a map keyed by MediaItemID in the
completedHistoryItemMapForProgress function duplicates logic already present in
CompletedHistoryItemMap. Extract this shared mapping logic into a private helper
function that accepts a minimal interface (the items slice) and returns the
constructed map, then have both completedHistoryItemMapForProgress and
CompletedHistoryItemMap call this shared helper instead of duplicating the
iteration and map-building code. This will prevent logic drift and make the code
more maintainable.
internal/catalog/user_collection_display_filters_test.go (1)

83-133: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add explicit season-path watch-filter coverage.

userCollectionPlayedMap has dedicated season logic, but this suite only validates movies and series. Add one season test (fully complete vs partially complete episodes) to lock that branch and prevent regressions.

Proposed test shape
+func TestFilterUserCollectionDisplayItemsSeasonRequiresAllEpisodesComplete(t *testing.T) {
+	items := []*models.MediaItem{
+		{ContentID: "season-a", Type: "season"},
+		{ContentID: "season-b", Type: "season"},
+	}
+	store := &displayFilterProgressStore{
+		progressByProfile: map[string]map[string]userstore.WatchProgress{
+			"profile-a": {
+				"episode-a1": {ProfileID: "profile-a", MediaItemID: "episode-a1", Completed: true},
+				"episode-a2": {ProfileID: "profile-a", MediaItemID: "episode-a2", Completed: true},
+				"episode-b1": {ProfileID: "profile-a", MediaItemID: "episode-b1", Completed: true},
+			},
+		},
+	}
+	episodes := &displayFilterEpisodeLister{
+		seasons: map[string][]*models.Episode{
+			"season-a": {{ContentID: "episode-a1"}, {ContentID: "episode-a2"}},
+			"season-b": {{ContentID: "episode-b1"}, {ContentID: "episode-b2"}},
+		},
+	}
+
+	watched, err := FilterUserCollectionDisplayItems(context.Background(), store, items, UserCollectionDisplayFilterOptions{
+		ProfileID: "profile-a", WatchFilter: userstore.CollectionWatchFilterWatched, EpisodeLister: episodes,
+	})
+	if err != nil {
+		t.Fatalf("FilterUserCollectionDisplayItems(watched seasons): %v", err)
+	}
+	if ids := mediaItemIDs(watched); !reflect.DeepEqual(ids, []string{"season-a"}) {
+		t.Fatalf("watched season IDs = %#v, want only fully complete season", ids)
+	}
+}
🤖 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/user_collection_display_filters_test.go` around lines 83 -
133, Add a new test function to cover the season-path watch-filter logic that
currently lacks explicit coverage. Create a test similar to
TestFilterUserCollectionDisplayItemsSeriesRequiresAllEpisodesComplete but for
season items instead of series, with media items of type "season", episodes
mapped to those seasons, and validation that the watched filter returns only
seasons with all episodes completed while the unwatched filter returns seasons
with at least one incomplete episode.
web/src/components/CollectionTemplateGallery/UserCollectionTemplateConfigForm.tsx (1)

63-74: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consolidate duplicated filter option constants into the shared utility.

Line 63 and Line 69 redefine watch/content options that are already centralized in web/src/lib/collectionDisplayFilters.ts, which creates drift risk across forms.

♻️ Proposed refactor
 import type {
   ImportUserMDBListCollectionRequest,
   ImportUserTMDBCollectionRequest,
   ImportUserTraktCollectionRequest,
   UserCollectionMediaFilter,
   UserCollectionSyncSchedule,
   UserCollectionWatchFilter,
 } from "`@/api/types`";
+import {
+  COLLECTION_MEDIA_FILTER_OPTIONS,
+  COLLECTION_WATCH_FILTER_OPTIONS,
+} from "`@/lib/collectionDisplayFilters`";
@@
-const WATCH_FILTER_OPTIONS: Array<{ value: UserCollectionWatchFilter; label: string }> = [
-  { value: "all", label: "All" },
-  { value: "unwatched", label: "Unwatched" },
-  { value: "watched", label: "Watched" },
-];
-
-const MEDIA_FILTER_OPTIONS: Array<{ value: UserCollectionMediaFilter; label: string }> = [
-  { value: "all", label: "All" },
-  { value: "movie", label: "Movies" },
-  { value: "series", label: "Shows" },
-];
@@
-              {WATCH_FILTER_OPTIONS.map((option) => (
+              {COLLECTION_WATCH_FILTER_OPTIONS.map((option) => (
@@
-              {MEDIA_FILTER_OPTIONS.map((option) => (
+              {COLLECTION_MEDIA_FILTER_OPTIONS.map((option) => (

As per coding guidelines, keep shared utilities in web/src/lib or web/src/utils.

🤖 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
`@web/src/components/CollectionTemplateGallery/UserCollectionTemplateConfigForm.tsx`
around lines 63 - 74, The constants WATCH_FILTER_OPTIONS and
MEDIA_FILTER_OPTIONS are defined locally in UserCollectionTemplateConfigForm but
duplicate existing definitions in web/src/lib/collectionDisplayFilters.ts.
Remove the local definitions of both WATCH_FILTER_OPTIONS and
MEDIA_FILTER_OPTIONS from this file and import them instead from the shared
collectionDisplayFilters utility module. Update any references in the component
to use the imported versions.

Source: Coding guidelines

🤖 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 `@web/src/pages/ImportedCollectionEditor.tsx`:
- Around line 1061-1075: The readSourceConfigLibraryIDs function applies
sanitization filters to library IDs extracted from source_config (checking that
they are numbers, finite, positive, and then truncating them while
deduplicating), but the fallback return statement on line 1073 returns
collection.query_definition.library_ids directly without applying the same
sanitization. Apply the same filtering and mapping logic (checking for valid
positive finite numbers, truncating, and deduplicating with Set) to the fallback
library IDs from collection.query_definition.library_ids before returning them
to ensure consistency and prevent invalid IDs from being saved.

---

Nitpick comments:
In `@internal/catalog/user_collection_display_filters_test.go`:
- Around line 83-133: Add a new test function to cover the season-path
watch-filter logic that currently lacks explicit coverage. Create a test similar
to TestFilterUserCollectionDisplayItemsSeriesRequiresAllEpisodesComplete but for
season items instead of series, with media items of type "season", episodes
mapped to those seasons, and validation that the watched filter returns only
seasons with all episodes completed while the unwatched filter returns seasons
with at least one incomplete episode.

In `@internal/userstore/collection_filters.go`:
- Around line 18-28: The exported variables CollectionWatchFilterValues and
CollectionMediaFilterValues are mutable slices that can be modified by callers
at runtime, compromising filter stability. Refactor by making these slice
variables unexported (lowercase names) to prevent direct mutation, then create
public accessor functions that return copies of the filter values instead of
exposing the original slices. This ensures callers can read the filter options
without being able to modify them.

In `@internal/userstore/pgstore/collections.go`:
- Around line 59-68: The create-time filter validation currently coerces invalid
filter values to "all" when NormalizeCollectionWatchFilter and
NormalizeCollectionMediaFilter return false, whereas update-time validation
rejects invalid values outright. To align both paths and improve correctness,
remove the fallback logic that sets input.WatchFilter and input.MediaFilter to
CollectionWatchFilterAll and CollectionMediaFilterAll respectively when
normalization fails. Instead, return an error when either normalization function
returns false for non-empty input values, making the create-time path strict
like the update-time validation.

In `@internal/userstore/progress_helpers.go`:
- Around line 174-193: The loop that converts completed history items into a map
keyed by MediaItemID in the completedHistoryItemMapForProgress function
duplicates logic already present in CompletedHistoryItemMap. Extract this shared
mapping logic into a private helper function that accepts a minimal interface
(the items slice) and returns the constructed map, then have both
completedHistoryItemMapForProgress and CompletedHistoryItemMap call this shared
helper instead of duplicating the iteration and map-building code. This will
prevent logic drift and make the code more maintainable.

In
`@web/src/components/CollectionTemplateGallery/UserCollectionTemplateConfigForm.tsx`:
- Around line 63-74: The constants WATCH_FILTER_OPTIONS and MEDIA_FILTER_OPTIONS
are defined locally in UserCollectionTemplateConfigForm but duplicate existing
definitions in web/src/lib/collectionDisplayFilters.ts. Remove the local
definitions of both WATCH_FILTER_OPTIONS and MEDIA_FILTER_OPTIONS from this file
and import them instead from the shared collectionDisplayFilters utility module.
Update any references in the component to use the imported versions.
🪄 Autofix (Beta)

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: 731a5ae6-6cb7-42d8-b575-7cd0026dd371

📥 Commits

Reviewing files that changed from the base of the PR and between 67d0e0f and ec5b930.

📒 Files selected for processing (30)
  • internal/api/handlers/collections.go
  • internal/api/handlers/library_collections.go
  • internal/api/handlers/user_collection_imports.go
  • internal/api/router.go
  • internal/catalog/catalog_resolver.go
  • internal/catalog/library_collection_service.go
  • internal/catalog/user_collection_display_filters.go
  • internal/catalog/user_collection_display_filters_test.go
  • internal/collectionutil/mdblist.go
  • internal/collectionutil/mdblist_test.go
  • internal/sections/fetcher.go
  • internal/sections/user_collection_limit_test.go
  • internal/usercollections/listing.go
  • internal/usercollections/sync.go
  • internal/usercollections/types.go
  • internal/usercollections/types_test.go
  • internal/userstore/collection_filters.go
  • internal/userstore/collection_filters_test.go
  • internal/userstore/pgstore/collections.go
  • internal/userstore/progress_helpers.go
  • internal/userstore/types.go
  • migrations/sql/20260623184858_user_collection_display_filters.sql
  • web/src/api/types.ts
  • web/src/components/CollectionTemplateGallery/UserCollectionTemplateConfigForm.tsx
  • web/src/components/collections/CollectionBuilder.tsx
  • web/src/hooks/queries/collections.ts
  • web/src/lib/collectionDisplayFilters.ts
  • web/src/pages/Collections.test.tsx
  • web/src/pages/ImportedCollectionEditor.tsx
  • web/src/pages/userCollectionsShared.tsx

Quick104 and others added 3 commits June 23, 2026 16:08
readSourceConfigLibraryIDs validated source_config.library_ids (finite,
positive, truncated, deduplicated) but returned the query_definition
fallback raw, so legacy rows could surface zero/negative/duplicate IDs
that the backend now rejects on save. Extract a shared sanitizer and
apply it to both paths.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
internal/sections/fetcher.go (1)

1318-1335: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply display_query_definition to smart collection sections.

This branch returns fetchFiltered before collection.DisplayQueryDefinition is evaluated, so smart user collections ignore display filters in Home/section reads. Apply the display filter before the section limit/total calculation, matching the exact collection path below.

🤖 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/fetcher.go` around lines 1318 - 1335, The smart collection
path in fetcher.go returns from fetchFiltered before
collection.DisplayQueryDefinition is applied, so the display filter is being
skipped for Home/section reads. Update the isSmartType branch in the fetcher
logic to evaluate and apply collection.DisplayQueryDefinition before building
the synthetic ResolvedSection and before the fetchFiltered call, matching the
exact collection path behavior used for non-smart collections.
internal/api/handlers/collections.go (1)

39-61: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Keep the legacy filter API additive.

These structs expose only display_query_definition. If this replaces existing watch_filter / media_filter request or response fields, existing /api/v1 clients silently lose their filters. Keep compatibility fields mapped to/from display_query_definition, or use the deprecation/sunset flow first. Based on learnings, API changes under /api/v1 are additive-only: do not rename or remove response fields, change field types, or repurpose status codes.

Also applies to: 71-91

🤖 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/collections.go` around lines 39 - 61, The collection
request structs currently surface only display_query_definition, which risks
breaking existing /api/v1 clients that still send or read watch_filter and
media_filter. Update createCollectionRequest and updateCollectionRequest to
remain additive by keeping the legacy filter fields mapped to and from
display_query_definition, or preserve the old fields alongside the new one until
a deprecation/sunset flow is in place. Verify the collection handler flow in
internal/api/handlers/collections.go continues to accept and emit the legacy
filter API symbols without renaming, removing, or changing their types.

Source: Learnings

internal/catalog/catalog_resolver.go (1)

503-520: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply display filters for live user collections without overlays.

FilterCollectionItemsByDisplayQuery only runs inside catalogRequestHasOverlay(req). A smart/live user collection opened without overlay params still returns resolveQuerySource directly, so its stored display_query_definition is ignored. Route the live branch through base-items → display-filter → resolveExactOrderedMediaItems whenever collection.DisplayQueryDefinition is non-empty.

🤖 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 503 - 520, The live
collection path in catalogResolver currently skips the stored display query
unless catalogRequestHasOverlay(req) is true, so collections with
collection.DisplayQueryDefinition set can bypass filtering. Update the branch in
resolveQuerySource/resolveExactOrderedMediaItems flow so that non-empty
display_query_definition also routes through resolveCollectionQueryBaseItems,
FilterCollectionItemsByDisplayQuery, and resolveExactOrderedMediaItems even
without overlay params, while preserving the existing overlay behavior for req.
web/src/pages/ImportedCollectionEditor.tsx (1)

313-349: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Populate these selects from collection capabilities, not local constants.

These controls are still driven by hardcoded option arrays even though this feature added /collections/capabilities for server-side feature detection. That means a newer client can offer unsupported presets against an older server, or miss newly advertised presets during partial rollouts. Please source the watch/content options from CollectionCapabilitiesResponse here instead of assuming the local enum set is always valid. Based on learnings, "For new features, expose capability endpoints for feature detection instead of relying on version sniffing."

🤖 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 `@web/src/pages/ImportedCollectionEditor.tsx` around lines 313 - 349, The
watch/content selects in ImportedCollectionEditor are still using hardcoded
option lists instead of server-provided capabilities. Update the component to
derive these options from CollectionCapabilitiesResponse and use the
capabilities data when rendering the SelectItem entries, so the UI only shows
presets supported by the current server. Keep the existing
ImportedCollectionEditor select wiring, but replace
COLLECTION_WATCH_FILTER_OPTIONS and COLLECTION_MEDIA_FILTER_OPTIONS with
capability-driven data fetched for the collection.

Source: Learnings

🧹 Nitpick comments (2)
internal/jellycompat/playback_static_directplay_test.go (1)

136-137: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add lowercase static=true coverage for the case-insensitive query path.

This test only exercises Static=true, but the handler explicitly supports lowercase keys for real clients. Add a second assertion/subtest for static=true to prevent regressions.

Suggested test tweak
-	rawQuery := "Static=true&PlaySessionId=play-1&MediaSourceId=" + url.QueryEscape(sourceID)
-	rec := serveStaticStream(handler, encodedID, rawQuery)
-
-	if rec.Code != 200 {
-		t.Fatalf("expected status 200; got %d, body=%s", rec.Code, rec.Body.String())
-	}
-	if got := rec.Body.String(); got != body {
-		t.Errorf("expected file content %q; got %q", body, got)
-	}
+	queries := []string{
+		"Static=true&PlaySessionId=play-1&MediaSourceId=" + url.QueryEscape(sourceID),
+		"static=true&PlaySessionId=play-1&MediaSourceId=" + url.QueryEscape(sourceID),
+	}
+	for _, rawQuery := range queries {
+		rec := serveStaticStream(handler, encodedID, rawQuery)
+		if rec.Code != 200 {
+			t.Fatalf("query %q: expected status 200; got %d, body=%s", rawQuery, rec.Code, rec.Body.String())
+		}
+		if got := rec.Body.String(); got != body {
+			t.Errorf("query %q: expected file content %q; got %q", rawQuery, body, got)
+		}
+	}
🤖 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/jellycompat/playback_static_directplay_test.go` around lines 136 -
137, Add coverage for the case-insensitive query parsing in the static direct
play test by extending the existing serveStaticStream-based assertion in
playback_static_directplay_test.go to also exercise the lowercase static=true
form. Update the playback_static_directplay_test logic near the current
Static=true request setup so it verifies both variants, preferably as a second
subtest or assertion alongside the existing one, using the same handler path and
encodedID/sourceID flow.
internal/catalog/display_query_filter_test.go (1)

9-74: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Add coverage for FilterCollectionItemsByDisplayQuery.

This suite only exercises normalization. The new executor-backed path still needs a regression test for the PR’s key contract: empty fragments are a no-op, matching items keep source order, and filtering happens against the provided candidate IDs rather than a broader catalog result set.

Based on learnings, this path should stay predictable under load and future refactors.

🤖 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/display_query_filter_test.go` around lines 9 - 74, Add a
regression test for FilterCollectionItemsByDisplayQuery to cover the
executor-backed path, not just NormalizeDisplayQueryFragment. Verify that empty
or blank fragments return the input unchanged, that matching items are returned
in the same order as the source slice, and that filtering is applied only to the
provided candidate IDs rather than any wider catalog set. Use the existing
NormalizeDisplayQueryFragment and FilterCollectionItemsByDisplayQuery symbols to
locate the test insertion point.

Source: Learnings

🤖 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/catalog/display_query_filter.go`:
- Around line 96-107: The display filter validator currently accepts any
non-empty string for the `displayFilterFieldType` case in
`validateDisplayFilterValue`, which allows unsupported `type` values to pass.
Update that branch to explicitly allow only the advertised presets (`all`,
`movie`, `series`) and return an error for anything else, keeping the existing
`watched` validation unchanged. Use the existing `validateDisplayFilterValue`
and `displayFilterFieldType` symbols to locate the logic.

In `@internal/userstore/pgstore/collections.go`:
- Around line 44-53: CreateCollection is returning input.DisplayQueryDefinition
verbatim instead of the persisted shape, so whitespace-only values diverge from
what displayQueryDefinitionArg stores and what GetCollection/ListCollections
later read. Update CreateCollection to normalize the returned
DisplayQueryDefinition using the same trimming/empty-to-empty-or-nil logic used
by displayQueryDefinitionArg, and keep the create response consistent with the
stored display_query_definition value.

In `@internal/watchsync/providers/mdblist/provider.go`:
- Around line 594-600: The percentage parsing in the MDBList decoder is trimming
the `%` before whitespace, so values like “45% ” still reach strconv.ParseFloat
with a trailing percent and fail. Update the normalization in the relevant
parsing path in the provider’s percentage decode logic to trim whitespace first
and then remove the optional `%`, keeping the tolerant behavior for
whitespace-padded percentage strings.

In `@internal/watchsync/service.go`:
- Around line 198-199: The manual sync active-run check currently treats a zero
StartedAt as valid and returns early, which prevents stale legacy rows from
reaching the retry/cleanup path. Update the branch in the watchsync service’s
manual-sync flow so only non-zero StartedAt values within manualSyncTimeout
return active; if StartedAt is zero, let the code continue to the stale/failure
handling below. Use the existing active run handling around manualSyncTimeout
and the cleanup/retry path to keep the behavior consistent.

In `@web/src/api/types.ts`:
- Around line 1273-1274: Introduce a dedicated DisplayQueryDefinition type for
the filter-only display_query_definition payload instead of reusing
QueryDefinition. Update the relevant API type declarations in types.ts and any
related references in collectionDisplayFilters.ts and Collections.test.tsx so
omitted execution fields like library_ids and sort are no longer assumed or cast
away. Use the new DisplayQueryDefinition symbol wherever the display query
fragment is modeled so callers can only rely on the filter fields that actually
exist.

In `@web/src/pages/Catalog.tsx`:
- Around line 266-268: The personalized overlay controls are being restricted to
collection sources only, which removes them from existing overlay-capable
sources. Update the `Catalog` page logic around `allowPersonalizedFilters` and
`allowPersonalizedSorts` so it expands support to collections without dropping
the current source set (`query`, `favorites`, `watchlist`, `history`, `person`),
and adjust the guard used near `isCollectionSource` accordingly.

---

Outside diff comments:
In `@internal/api/handlers/collections.go`:
- Around line 39-61: The collection request structs currently surface only
display_query_definition, which risks breaking existing /api/v1 clients that
still send or read watch_filter and media_filter. Update createCollectionRequest
and updateCollectionRequest to remain additive by keeping the legacy filter
fields mapped to and from display_query_definition, or preserve the old fields
alongside the new one until a deprecation/sunset flow is in place. Verify the
collection handler flow in internal/api/handlers/collections.go continues to
accept and emit the legacy filter API symbols without renaming, removing, or
changing their types.

In `@internal/catalog/catalog_resolver.go`:
- Around line 503-520: The live collection path in catalogResolver currently
skips the stored display query unless catalogRequestHasOverlay(req) is true, so
collections with collection.DisplayQueryDefinition set can bypass filtering.
Update the branch in resolveQuerySource/resolveExactOrderedMediaItems flow so
that non-empty display_query_definition also routes through
resolveCollectionQueryBaseItems, FilterCollectionItemsByDisplayQuery, and
resolveExactOrderedMediaItems even without overlay params, while preserving the
existing overlay behavior for req.

In `@internal/sections/fetcher.go`:
- Around line 1318-1335: The smart collection path in fetcher.go returns from
fetchFiltered before collection.DisplayQueryDefinition is applied, so the
display filter is being skipped for Home/section reads. Update the isSmartType
branch in the fetcher logic to evaluate and apply
collection.DisplayQueryDefinition before building the synthetic ResolvedSection
and before the fetchFiltered call, matching the exact collection path behavior
used for non-smart collections.

In `@web/src/pages/ImportedCollectionEditor.tsx`:
- Around line 313-349: The watch/content selects in ImportedCollectionEditor are
still using hardcoded option lists instead of server-provided capabilities.
Update the component to derive these options from CollectionCapabilitiesResponse
and use the capabilities data when rendering the SelectItem entries, so the UI
only shows presets supported by the current server. Keep the existing
ImportedCollectionEditor select wiring, but replace
COLLECTION_WATCH_FILTER_OPTIONS and COLLECTION_MEDIA_FILTER_OPTIONS with
capability-driven data fetched for the collection.

---

Nitpick comments:
In `@internal/catalog/display_query_filter_test.go`:
- Around line 9-74: Add a regression test for
FilterCollectionItemsByDisplayQuery to cover the executor-backed path, not just
NormalizeDisplayQueryFragment. Verify that empty or blank fragments return the
input unchanged, that matching items are returned in the same order as the
source slice, and that filtering is applied only to the provided candidate IDs
rather than any wider catalog set. Use the existing
NormalizeDisplayQueryFragment and FilterCollectionItemsByDisplayQuery symbols to
locate the test insertion point.

In `@internal/jellycompat/playback_static_directplay_test.go`:
- Around line 136-137: Add coverage for the case-insensitive query parsing in
the static direct play test by extending the existing serveStaticStream-based
assertion in playback_static_directplay_test.go to also exercise the lowercase
static=true form. Update the playback_static_directplay_test logic near the
current Static=true request setup so it verifies both variants, preferably as a
second subtest or assertion alongside the existing one, using the same handler
path and encodedID/sourceID flow.
🪄 Autofix (Beta)

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: 5dde0dcb-74ce-4ee2-a908-315c961a5825

📥 Commits

Reviewing files that changed from the base of the PR and between 663f36d and 3e1f1c4.

📒 Files selected for processing (36)
  • AGENTS.md
  • docs/superpowers/plans/2026-06-23-personal-collection-catalog-filter-standardization.md
  • docs/superpowers/specs/2026-06-23-personal-collection-catalog-filter-standardization-design.md
  • internal/api/handlers/collections.go
  • internal/api/handlers/user_collection_imports.go
  • internal/catalog/catalog_parser.go
  • internal/catalog/catalog_parser_test.go
  • internal/catalog/catalog_resolver.go
  • internal/catalog/display_query_filter.go
  • internal/catalog/display_query_filter_test.go
  • internal/catalog/query_builder.go
  • internal/catalog/query_builder_test.go
  • internal/jellycompat/playback_static_directplay_test.go
  • internal/jellycompat/streams.go
  • internal/sections/fetcher.go
  • internal/userstore/collection_filters.go
  • internal/userstore/pgstore/collections.go
  • internal/userstore/types.go
  • internal/watchsync/providers/mdblist/provider.go
  • internal/watchsync/providers/simkl/provider.go
  • internal/watchsync/providers/simkl/provider_test.go
  • internal/watchsync/service.go
  • migrations/sql/20260624124430_add_user_collection_display_query_definition.sql
  • web/src/api/types.ts
  • web/src/components/CollectionTemplateGallery/UserCollectionTemplateConfigForm.tsx
  • web/src/components/catalog/CatalogFiltersPanel.test.tsx
  • web/src/components/catalog/CatalogFiltersPanel.tsx
  • web/src/components/collections/CollectionBuilder.tsx
  • web/src/lib/collectionDisplayFilters.test.ts
  • web/src/lib/collectionDisplayFilters.ts
  • web/src/pages/Catalog.tsx
  • web/src/pages/Collections.test.tsx
  • web/src/pages/ImportedCollectionEditor.tsx
  • web/src/pages/catalogSearchParams.test.ts
  • web/src/pages/catalogSearchParams.ts
  • web/src/pages/userCollectionsShared.tsx
✅ Files skipped from review due to trivial changes (2)
  • migrations/sql/20260624124430_add_user_collection_display_query_definition.sql
  • AGENTS.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/components/CollectionTemplateGallery/UserCollectionTemplateConfigForm.tsx

Comment thread internal/watchsync/service.go Resolved
Comment thread web/src/api/types.ts Resolved
Comment thread web/src/pages/Catalog.tsx Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
web/src/pages/catalogSearchParams.ts (1)

290-297: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Redundant collection-source block.

After removing the early return, this block no longer does anything unique: collection_id is already set unconditionally at Lines 299-301, and title at Lines 305-307. For library_collection/user_collection both keys are written twice. Dropping this block keeps behavior identical and removes the duplicate writes.

♻️ Proposed cleanup
-  if (state.source === "library_collection" || state.source === "user_collection") {
-    if (state.collection_id) {
-      params.set("collection_id", state.collection_id);
-    }
-    if (state.title) {
-      params.set("title", state.title);
-    }
-  }
-
   if (state.collection_id) {
     params.set("collection_id", state.collection_id);
   }

Based on learnings: "avoid duplicated logic across files, and do not solve new functionality with local one-off shortcuts."

🤖 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 `@web/src/pages/catalogSearchParams.ts` around lines 290 - 297, Remove the
redundant collection-source branch in catalogSearchParams because it now
duplicates the unconditional parameter writes for collection_id and title.
Update the logic around the source handling in the catalogSearchParams builder
so the library_collection/user_collection case no longer sets those params a
second time, keeping the existing unconditional assignments as the single source
of truth.

Source: Learnings

🤖 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.

Nitpick comments:
In `@web/src/pages/catalogSearchParams.ts`:
- Around line 290-297: Remove the redundant collection-source branch in
catalogSearchParams because it now duplicates the unconditional parameter writes
for collection_id and title. Update the logic around the source handling in the
catalogSearchParams builder so the library_collection/user_collection case no
longer sets those params a second time, keeping the existing unconditional
assignments as the single source of truth.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7cc2b807-fb5d-4a2c-987c-00dab3f76cae

📥 Commits

Reviewing files that changed from the base of the PR and between 3e1f1c4 and 9ffbf92.

📒 Files selected for processing (5)
  • web/src/components/catalog/CatalogFilterBar.tsx
  • web/src/components/catalog/CatalogFiltersPanel.tsx
  • web/src/hooks/queries/catalog.ts
  • web/src/hooks/queries/keys.ts
  • web/src/pages/catalogSearchParams.ts
✅ Files skipped from review due to trivial changes (1)
  • web/src/hooks/queries/catalog.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/watchsync/service.go (1)

201-217: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Skip cooldown after recovering a timed-out active run.

After completeSyncRun stamps the stale run with CompletedAt = s.now(), the subsequent latest-run cooldown check can treat that just-failed timeout as a fresh sync and return SyncCooldownError instead of creating the retry run.

Suggested fix
+	recoveredTimedOutRun := false
 	for {
 		active, ok, err := s.repo.GetActiveSyncRun(ctx, conn.ID)
 		if err != nil {
 			return ManualSyncResult{}, err
@@
 		active.Error = "watch provider sync timed out before completion"
 		if _, err := s.completeSyncRun(ctx, active); err != nil {
 			return ManualSyncResult{}, err
 		}
+		recoveredTimedOutRun = true
 	}
 
-	if latest, ok, err := s.repo.GetLatestSyncRun(ctx, conn.ID); err != nil {
+	if !recoveredTimedOutRun {
+		if latest, ok, err := s.repo.GetLatestSyncRun(ctx, conn.ID); err != nil {
-		return ManualSyncResult{}, err
-	} else if ok {
-		reference := latest.StartedAt
-		if latest.CompletedAt != nil {
-			reference = *latest.CompletedAt
-		}
-		if retryAfter := retryAfterSeconds(s.now(), reference, manualSyncCooldown); retryAfter > 0 {
-			return ManualSyncResult{}, SyncCooldownError{RetryAfterSeconds: retryAfter}
+			return ManualSyncResult{}, err
+		} else if ok {
+			reference := latest.StartedAt
+			if latest.CompletedAt != nil {
+				reference = *latest.CompletedAt
+			}
+			if retryAfter := retryAfterSeconds(s.now(), reference, manualSyncCooldown); retryAfter > 0 {
+				return ManualSyncResult{}, SyncCooldownError{RetryAfterSeconds: retryAfter}
+			}
 		}
 	}
🤖 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/watchsync/service.go` around lines 201 - 217, The cooldown check in
s.completeSyncRun/s.repo.GetLatestSyncRun is treating the newly stamped
timed-out run as the latest sync and blocking the retry. Update the manual-sync
flow in internal/watchsync/service.go to skip the retryAfterSeconds check when
the current request is recovering an active run that was just marked failed by
completeSyncRun, using the existing active/latest run state to distinguish that
case. Make the bypass logic local to the timeout-recovery path so normal
cooldown behavior still applies for all other syncs.
🧹 Nitpick comments (1)
internal/sections/fetcher.go (1)

1345-1346: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Skip the unused count query here.

Preview forces a total count, but this path discards it and computes the displayed total after applying the display filter. Use PreviewPage(..., false) to avoid an extra count query per smart collection section.

⚡ Proposed change
-		items, _, err := executor.Preview(ctx, qd, filter, limit)
+		items, _, _, err := executor.PreviewPage(ctx, qd, filter, limit, 0, false)
Based on learnings, “Prioritize performance first, then reliability, and keep behavior predictable under load and during failures.”
🤖 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/fetcher.go` around lines 1345 - 1346, The smart collection
preview path is still invoking the count-producing executor method even though
the total is discarded, which adds an unnecessary query. Update the fetch logic
in the code that builds `catalog.QueryExecutor` and calls `Preview` so it uses
`PreviewPage(..., false)` instead, keeping the existing item retrieval and
display-filter behavior while skipping the unused count query.

Source: Learnings

🤖 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/sections/fetcher.go`:
- Around line 2204-2205: The single-library branch currently overwrites
def.LibraryIDs instead of narrowing the existing scope, unlike the multi-library
branch. Update the logic around the libraryID switch case in the fetcher flow so
it intersects the requested single library with any preexisting def.LibraryIDs,
and leaves the scope empty when there is no overlap. Use def.LibraryIDs and
libraryID as the key symbols to adjust this behavior consistently with the
multi-library handling.

---

Outside diff comments:
In `@internal/watchsync/service.go`:
- Around line 201-217: The cooldown check in
s.completeSyncRun/s.repo.GetLatestSyncRun is treating the newly stamped
timed-out run as the latest sync and blocking the retry. Update the manual-sync
flow in internal/watchsync/service.go to skip the retryAfterSeconds check when
the current request is recovering an active run that was just marked failed by
completeSyncRun, using the existing active/latest run state to distinguish that
case. Make the bypass logic local to the timeout-recovery path so normal
cooldown behavior still applies for all other syncs.

---

Nitpick comments:
In `@internal/sections/fetcher.go`:
- Around line 1345-1346: The smart collection preview path is still invoking the
count-producing executor method even though the total is discarded, which adds
an unnecessary query. Update the fetch logic in the code that builds
`catalog.QueryExecutor` and calls `Preview` so it uses `PreviewPage(..., false)`
instead, keeping the existing item retrieval and display-filter behavior while
skipping the unused count query.
🪄 Autofix (Beta)

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: d15cc45b-1def-418a-9f5e-500172759be2

📥 Commits

Reviewing files that changed from the base of the PR and between 9ffbf92 and 6c6e672.

📒 Files selected for processing (16)
  • internal/catalog/catalog_resolver.go
  • internal/catalog/display_query_filter.go
  • internal/catalog/display_query_filter_test.go
  • internal/jellycompat/playback_static_directplay_test.go
  • internal/sections/fetcher.go
  • internal/userstore/pgstore/collections.go
  • internal/watchsync/providers/mdblist/provider.go
  • internal/watchsync/service.go
  • web/src/api/types.ts
  • web/src/components/collections/CollectionBuilder.tsx
  • web/src/lib/collectionDisplayFilters.test.ts
  • web/src/lib/collectionDisplayFilters.ts
  • web/src/pages/Catalog.tsx
  • web/src/pages/Collections.test.tsx
  • web/src/pages/ImportedCollectionEditor.tsx
  • web/src/pages/catalogSearchParams.ts
💤 Files with no reviewable changes (1)
  • web/src/pages/catalogSearchParams.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • internal/jellycompat/playback_static_directplay_test.go
  • web/src/components/collections/CollectionBuilder.tsx
  • web/src/pages/Catalog.tsx
  • web/src/pages/Collections.test.tsx
  • internal/watchsync/providers/mdblist/provider.go
  • web/src/lib/collectionDisplayFilters.test.ts
  • internal/userstore/pgstore/collections.go
  • internal/catalog/display_query_filter.go
  • web/src/pages/ImportedCollectionEditor.tsx
  • internal/catalog/catalog_resolver.go

Comment thread internal/sections/fetcher.go Resolved
@Quick104
Quick104 merged commit 70d67fb into main Jun 24, 2026
1 check passed
@Quick104
Quick104 deleted the codex/profile-scoped-collection-filters branch June 24, 2026 15:03
Quick104 added a commit to RXWatcher/silo-server that referenced this pull request Jul 10, 2026
* feat(collections): add profile-scoped display filters

* refactor(collections): dedup display-filter helpers per review

Address code-review feedback on the profile-scoped display filters
without changing behavior:

- Widen CompletedHistoryItemMap to accept ProgressCompletionStore and
  drop the duplicate completedHistoryItemMapForProgress copy.
- Extract the duplicated MDBList candidate retry loop into a generic
  collectionutil.FetchMDBListWithFallback helper, used by both the user
  and library collection syncers, and cover it with unit tests.
- Reuse validateOptionalLibraryIDs in HandleUpdateCollection instead of
  an inline positive-ID loop.
- Import the shared COLLECTION_{WATCH,MEDIA}_FILTER_OPTIONS in the
  template config form rather than redefining them locally.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(collections): sanitize query_definition library_ids fallback

readSourceConfigLibraryIDs validated source_config.library_ids (finite,
positive, truncated, deduplicated) but returned the query_definition
fallback raw, so legacy rows could surface zero/negative/duplicate IDs
that the backend now rejects on save. Extract a shared sanitizer and
apply it to both paths.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(docs): This makes the agents annoying to work with

* Improve playback session handling

* Support collection source order in catalog filters

* fix(collections): address display filter review feedback

* refactor(catalog): remove duplicate collection query params

* Hide episode media scope for collection overlays

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
@zZebrahz zZebrahz mentioned this pull request Oct 12, 2026
10 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0 Silo v1 scope - auto-adds to the Silo v1 project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant