Repository navigation
fix(collections): fill an import's item limit with titles its owner can access - #1874
Conversation
…an access A restricted profile's imported collection used its item limit on titles it couldn't see, and its sync summary counted them, so the collection stayed mostly empty and the summary revealed how many hidden titles the server holds. Sync now checks every matched title against the owner profile's access (allowed libraries and maturity limits, not its hidden libraries) before the limit applies, and counts titles outside that access as unmatched. The next sync follows the owner's current access. Scheduled syncs have no request, so the sync service resolves the owner with the same resolver as the request gates. It is wired in main.go before the task manager starts. If the owner's access can't be resolved, the sync records a failed status with a clear message and leaves the members as they were; it never falls back to the whole catalog. Related #1612 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…'s access Imports now match only titles the collection's owner can access, so the library_ids description no longer said what an omitted or chosen list does. Description-only change; the regenerated contract digest moves the system info fixture. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The sync refactor reworded two messages to satisfy ST1005. They are stored as a collection's sync status and returned to clients, so keep the wording users saw before and that library collections still use. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 424528ae6a
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| IsShared *bool `json:"is_shared,omitempty" nullable:"false" example:"false"` | ||
| PosterURL *string `json:"poster_url,omitempty" nullable:"false" doc:"A bundled template poster path or an image URL" example:""` | ||
| LibraryIDs *[]ID `json:"library_ids,omitempty" nullable:"false" doc:"Libraries the sync matches against; every library when omitted" example:"[\"1\"]"` | ||
| LibraryIDs *[]ID `json:"library_ids,omitempty" nullable:"false" doc:"Libraries the sync matches against, limited to the libraries the collection's owner can access; every library the owner can access when omitted" example:"[\"1\"]"` |
There was a problem hiding this comment.
Update the catalog API guide for owner-limited imports
This changes client-visible collection membership, item-limit, and sync-summary behavior, but only the generated OpenAPI description was updated; the collection import section in docs/catalog-api.md still does not document that imports are restricted by the owner's access. Update that API guide so the durable contract documentation matches the new behavior.
AGENTS.md reference: AGENTS.md:L146-L154
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Added a "Personal collection imports" section to docs/catalog-api.md (2e8822b, 4338412): imports keep only titles the owner can access, library_ids are limited to the owner's access, summaries count only accessible titles, and a sync whose owner access can't be resolved fails visibly and keeps existing members.
…r's access Imports now fill their item limit only with titles the collection's owner can access, and sync summaries and library_ids follow that access, but the API guide still described the old behavior. Record the owner-access rule, the hidden-library exception, and the failed-sync behavior that keeps existing members. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… limit Collection reads report item_count as the members the reading profile can see, so it can differ from items_matched; only the stored count returned with the import matches it. The owner limits now name access.unrated_content and require_advisory_age, and the section notes the bounded source window and that entries outside library_ids count as unmatched. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb8563b0bf
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if len(cfg.LibraryIDs) > 0 && s.libraryItems != nil { | ||
| inLibraries, err := s.libraryItems.GetItemsInFolders(ctx, ids, cfg.LibraryIDs) |
There was a problem hiding this comment.
Intersect selected libraries with the owner's allowlist
When an owner can access library A, library_ids selects inaccessible library B, and a title belongs to both, these two independent title-level checks retain it: EnsureAccessibleIDs succeeds through A while GetItemsInFolders succeeds through B. This violates the documented rule that selected libraries are limited to the owner's access and can occur after access restrictions change even if the original selection was valid. Intersect cfg.LibraryIDs with owner.AllowedLibraryIDs before checking membership so a title must belong to a library that is both selected and owner-accessible.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3071a8a. The chosen library_ids are narrowed to the owner's allowed libraries before GetItemsInFolders, so a title must sit in a library that is both chosen and owner-accessible. A new DB subtest puts a title in both libraries, allows the owner only the first and chooses only the second; it was imported before the fix and isn't now.
|
This PR adds the missing owner-access filtering for imported collections in the #1615 stack. Collections #193 S7 (Server/API) and #195 W7 (Web browser) are both recorded as “Not run: needs #1615”; once this stack is available, re-test owner/viewer-limited membership and counts, including imported collections. Do not treat these cases as passed. #195 W3 is already listed for the #1612 finding and has no recorded result to invalidate. The current
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
|
The current
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…ccess An import kept a title when the owner could reach it through one library and the collection's chosen libraries included it through another, so a chosen library the owner can't access still added titles. The chosen libraries are now narrowed to the owner's allowed libraries before the membership check. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Validation line updated to |
Brings in login-wide personal collection sharing (#1875), the scrobble lock fix (#1887), and the import owner-access fix (#1874). Conflict resolution keeps both sides: the capabilities test expects login_sharing and create_description, the fixture list keeps collection_order_foreign_id before this branch's appended cases, and the create-description DB test no longer sets the removed AllowedProfileIDs. The OpenAPI document, fixtures, and web types are regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #1615, #1612
Validation tasks: unblocks #193 S7
When a profile with content restrictions imports a personal collection from MDBList, TMDB or Trakt with an item limit, the sync fills the limit with the first titles on the list that the server has, whether or not that profile can open them. The profile then sees only a few of them, and later titles on the list that it could open are never reached. The sync summary ("Matched X of Y entries") also counts titles outside the profile's access, which tells a restricted profile how many of those the server has. This change limits an import's members to titles its owner profile can access, so the limit fills with titles the owner can open and the summary counts only those.
This is the import side of #1615's rule that a personal collection carries its owner's limits. It builds on the change this pull request is stacked on, which limits what other profiles see in a shared collection to what its owner can access.
Approach
cmd/silo/main.gobuilds the resolver next to the sync service, before the task manager starts scheduled syncs, with the same resolver choice the router makes. Nothing is cached between syncs, so the next scheduled or manual sync on any node follows a change to the owner's access. Existing imports change at their next sync./api/v2description oflibrary_idson the four import request schemas now says the owner's access limits it. Only the description changes;openapi.json, the web types and the system-info fixture digest are regenerated.Validation
gofmt,go vet ./...andmake lint-changedagainst the base branch: clean.make test-go: pass.usercollections,api,api/handlers,apiv2andcmd/silo: pass, exceptTestAdminSubtitleListPageDBandTestCatalogTransferPersistsJobsAndSignedLink, which fail the same way on the base branch (timezone comparisons). TheusercollectionsDB tests also pass under-race.make test-db-pins: every pin passes. No pin was added.verify-apiv2-openapi,verify-apiv2-contract(no change against the base orfeat/collections-revamp),verify-apiv2-fixtures,verify-apiv2-web-types,TestCommittedArtifactMatchesRouter,verify-route-inventory,verify-migration-ledger,verify-scenario-catalogs,verify-offline-routes,verify-settings-bindings-all,verify-playback-fixturesandverify-local-paths: pass.pnpm run lint(no errors),format:check,build,budget:checkandmake test-web: pass.main.go.Risks
/api/v2schema is unchanged apart from one field description. Shipped Apple and Android builds need no update./api/v1and/api/v2share the import and sync handlers, so imports created or synced through either change the same way.item_countand sync summary change with it.main.gowiring were lost, every import sync would fail the same visible way. No test catches that.Checklist
AI Disclosure
/api/v2description oflibrary_idson the import request schemas still said "every library when omitted". It now names the owner's access, and the generated artifacts are regenerated.main.go. Losing it fails closed (see Risks).Closes #1612. This pull request targets an integration branch, so it lists Personal collection imports fill the item limit with titles the creator can't see #1612 as related; the merge intomainneeds to close it.🤖 Generated with Claude Code
Note
Fill personal collection import item limits with owner-accessible titles
Wires an owner-access resolver into the personal collection sync service in main.go. When the policy system is available, it uses the policy viewer resolver with the configured unrated-content policy; otherwise it falls back to the legacy access resolver. The resolver is wrapped in a personal-collection access wrapper when the sync service is constructed. Behavioral Change: collection imports and scheduled syncs now filter titles by the owner's access profile instead of the previous resolver behavior.
Macroscope summarized 3071a8a.