Repository navigation
fix(jellycompat): resolve smart-collection BoxSet children at read time - #161
Conversation
Browsing into a smart (live-query) collection via /Items?ParentId={boxsetId}
returned 0 children while the BoxSet's ChildCount showed a non-zero count:
handleBoxSetChildren only read materialized library_collection_items via
ListItems, which is empty for smart collections whose membership is a query
evaluated at read time. Confirmed live — smart "Directed by ..." collections
returned TotalRecordCount 0 while materialized collections returned their items.
Branch handleBoxSetChildren on catalog.IsLiveQueryType: smart collections
resolve their members through the query executor (mirroring the web API's
loadLiveCollectionItems — Normalize/Validate/ApplySmartCollectionItemLimit,
library-scope intersection, access-filtered Preview), then feed the resulting
content IDs into the same hydration path as stored collections. A malformed or
invalid query definition degrades to an empty page (never a 500).
Hoist the duplicated intersectCollectionLibraryIDs helper into
catalog.IntersectCollectionLibraryIDs so the web and compat resolvers share one
implementation.
Adds smart_boxset_test.go (smart children resolve in query order, library-scope
intersection reaches the executor, malformed-query and no-executor degrade to
empty).
|
Warning Review limit reached
More reviews will be available in 57 minutes and 7 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
✨ 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 |
…me (#161) Browsing into a smart (live-query) collection via /Items?ParentId={boxsetId} returned 0 children while the BoxSet's ChildCount showed a non-zero count: handleBoxSetChildren only read materialized library_collection_items via ListItems, which is empty for smart collections whose membership is a query evaluated at read time. Confirmed live — smart "Directed by ..." collections returned TotalRecordCount 0 while materialized collections returned their items. Branch handleBoxSetChildren on catalog.IsLiveQueryType: smart collections resolve their members through the query executor (mirroring the web API's loadLiveCollectionItems — Normalize/Validate/ApplySmartCollectionItemLimit, library-scope intersection, access-filtered Preview), then feed the resulting content IDs into the same hydration path as stored collections. A malformed or invalid query definition degrades to an empty page (never a 500). Hoist the duplicated intersectCollectionLibraryIDs helper into catalog.IntersectCollectionLibraryIDs so the web and compat resolvers share one implementation. Adds smart_boxset_test.go (smart children resolve in query order, library-scope intersection reaches the executor, malformed-query and no-executor degrade to empty).
Problem
Browsing into a smart (live-query) collection via
/Items?ParentId={boxsetId}returned 0 children even though the BoxSet'sChildCountshowed a non-zero count (e.g. a "Directed by Quentin Tarantino" collection reporting 14 items but listing none).handleBoxSetChildrenresolved members only from the materializedlibrary_collection_itemstable (ListItems). Smart collections store no rows there — their membership is a query evaluated at read time — soListItemsreturned empty whileChildCount(the stored item count) stayed non-zero.Confirmed live against a production deployment: smart "Directed by …" collections returned
TotalRecordCount: 0when browsed, while materialized collections (e.g. IMDb Top 250) returned their items correctly.Approach
handleBoxSetChildrenoncatalog.IsLiveQueryType(collection.CollectionType):smartCollectionContentIDs, mirroring the web API'sloadLiveCollectionItems:Normalize→ValidateWithOptions(false,false)→ApplySmartCollectionItemLimit→ library-scope intersection → access-filteredPreview(limit=1 probe, then limit=total). The resolved content IDs feed the same hydration/paging path as stored collections, preserving the smart query's order.ListItemspath.intersectCollectionLibraryIDshelper intocatalog.IntersectCollectionLibraryIDsso the web handler and the compat resolver share one implementation (the repo guidelines flag cross-file duplication).Testing
smart_boxset_test.go: smart children resolve in the query's order via an injected executor; the query'slibrary_idsare intersected with the collection's bound libraries before the executor runs; malformed-query and no-executor cases degrade to an empty page without consulting/▶ crashing.go test ./internal/jellycompat/... ./internal/catalog/...,go vet(jellycompat + catalog + api/handlers),go build ./..., andgofmtare clean, run in a libvips-capable container.Compat
Additive. Materialized-collection browsing is unchanged; the web API's behavior is unchanged (same algorithm, now via the shared catalog helper).
AI use
Implemented with AI assistance; the diff was reviewed in a separate pass and the tests were run in a Docker toolchain before submitting.