Repository navigation
feat(catalog): remove smart collection item limit cap - #340
Conversation
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8dcf6ce72
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const ( | ||
| DefaultSmartCollectionItemLimit = 100 | ||
| MaxSmartCollectionItemLimit = 500 | ||
| MaxSmartCollectionItemLimit = 50000 |
There was a problem hiding this comment.
Bound unpaginated smart collection expansion
When a smart collection is configured with a limit above the old 500 cap, this new cap also applies to unpaginated expansion paths: I checked HandleGetLibraryCollectionItems → loadLiveCollectionItems in internal/api/handlers/library_collections.go, which counts the live query and then reruns Preview(..., total) before returning one browseResponse with every item. A 10k–50k member collection is still paged in the catalog browse path, but this endpoint now materializes and serializes tens of thousands of rows per request instead of at most 500, which can create latency/memory spikes when admins or clients fetch collection items directly. Please keep the membership cap separate from unpaginated response caps or add pagination/bounding on these expansion paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch — we audited both first-party clients for exactly this:
- silo-apple (iOS/tvOS) already resolves library collection items through the paginated catalog endpoint (
/api/v1/catalog?source=library_collectionwithoffset/limit), so it was never exposed to unbounded expansion here. - silo-android (mobile + TV) was affected: its collection detail screens called
GET /api/v1/library/{id}/collections/{collection_id}/itemswith no pagination. The Android app has been updated to match the Apple client and use the paginated catalog endpoint instead.
With that, no first-party client depends on full unpaginated expansion from this endpoint anymore, and bounding it (or adding limit/offset params) can land as a follow-up without breaking clients. We kept it out of this PR to keep the change minimal.
f8dcf6c to
b1b792d
Compare
MaxSmartCollectionItemLimit silently clamped every smart collection to 500 items, and an unset limit defaulted to 100. On servers with large libraries this truncates collections with no indication to the admin — a per-language smart collection (original_language is fr) has 10,625 real matches and showed under 1% of them. Remove the cap and make an unset limit resolve the full result set: the default becomes a large sentinel so every consumer's int plumbing (SQL LIMIT) keeps working. An explicit positive limit in the query definition is still honored as-is — membership size is an admin decision, and every read path that serves collection items either paginates in SQL or scales with the actual collection size. Co-Authored-By: Claude Fable 5 <[email protected]>
b1b792d to
b8d8f5d
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
The Jellyfin BoxSet children path resolved a smart (live-query) collection's entire membership and sliced one page locally. With the item cap removed (smart collection membership is now uncapped, an admin decision), a large collection browsed from a Jellyfin client materialized tens of thousands of rows per request — latency and memory scaling with collection size. For the default browse (no explicit SortBy), page the smart query directly in SQL via QueryExecutor.PreviewPage(offset, limit), hydrating only the requested page. Per-request work is now proportional to page size, not collection size. TotalRecordCount still reports true membership (the count query caps at the query's item limit), and past-the-end pages preserve the real total. Shared query prep is extracted into prepareSmartCollectionQuery, used by both the new paged path and the existing full-resolution path (still used by the explicit-sort allowlist branch, whose output is already SQL-paginated). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* feat(catalog): remove smart collection item limit cap MaxSmartCollectionItemLimit silently clamped every smart collection to 500 items, and an unset limit defaulted to 100. On servers with large libraries this truncates collections with no indication to the admin — a per-language smart collection (original_language is fr) has 10,625 real matches and showed under 1% of them. Remove the cap and make an unset limit resolve the full result set: the default becomes a large sentinel so every consumer's int plumbing (SQL LIMIT) keeps working. An explicit positive limit in the query definition is still honored as-is — membership size is an admin decision, and every read path that serves collection items either paginates in SQL or scales with the actual collection size. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(jellycompat): page smart collection browse in SQL The Jellyfin BoxSet children path resolved a smart (live-query) collection's entire membership and sliced one page locally. With the item cap removed (smart collection membership is now uncapped, an admin decision), a large collection browsed from a Jellyfin client materialized tens of thousands of rows per request — latency and memory scaling with collection size. For the default browse (no explicit SortBy), page the smart query directly in SQL via QueryExecutor.PreviewPage(offset, limit), hydrating only the requested page. Per-request work is now proportional to page size, not collection size. TotalRecordCount still reports true membership (the count query caps at the query's item limit), and past-the-end pages preserve the real total. Shared query prep is extracted into prepareSmartCollectionQuery, used by both the new paged path and the existing full-resolution path (still used by the explicit-sort allowlist branch, whose output is already SQL-paginated). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: rxwatcher <[email protected]>
The web editors rewrote saved smart collections without saying so. They defaulted the item limit to 100 and capped it at 500, although the server has left smart collections uncapped since Silo-Server#340 and stores a 10,000,000 sentinel for "no limit", so saving any uncapped collection cut it to 500. The Guided view rebuilds the definition from its own form state, so a toolbar sort or media change, or any Guided edit, dropped the rules it cannot show: negated rules, OR groups, repeated actor or director rules. A blank Max items field now means no limit and is left out on save, and an explicit limit passes through unchanged. A definition that Guided cannot reproduce opens in Advanced with Guided switched off and a short note, the toolbar changes only the sort and media scope, and the Filters count includes every rule. The wizard lets a collection with no matches continue to Details, and the Advanced Media Scope lists Movies & Series and Manga. Collections that earlier saves already truncated stay truncated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Motivation
MaxSmartCollectionItemLimitsilently clamps every smart collection's query definition to 500 items (ApplySmartCollectionItemLimit), and an unset limit defaults to 100. On servers with large libraries this truncates collections with no indication to the admin — a per-language smart collection (original_language is fr) on our server has 10,625 real matches, so it showed under 1% of them, cut off mid-alphabet.Change
Remove the cap entirely, and make an unset limit resolve the full result set (the default becomes a large sentinel so every consumer's int plumbing / SQL LIMIT keeps working). An explicit positive
limitin the query definition is still honored as-is: membership size is an admin decision, and every read path that serves collection items either paginates in SQL or scales with the actual collection size rather than this value.Validation
Running on prod (2026-07-08) via a hotfix image with all 50 language collections unstamped — they resolve their full membership.
go build/go vet/go test ./internal/catalog/pass. Rebased onto current main.Companion PR from the same incident: #347 (Meilisearch task-wait timeout).
AI-use disclosure
Updated with Claude Code (Claude Fable 5); prod-validated.
🤖 Generated with Claude Code