Repository navigation
fix(access): let Settings → Libraries show a restricted profile's hidden libraries - #2058
Conversation
…den libraries When an account or profile is limited to certain libraries, the viewer scope subtracts the profile's hidden libraries (ui.disabled_library_ids) from the allowed set, and GET /user/libraries listed only that set. Hiding a library therefore removed it from Settings → Libraries with no switch left to show it again. The scope policy now also reports hidden_library_ids: the profile's own hidden libraries that the account limit, profile limit, and any custom override would otherwise allow. The legacy resolver computes the same set, and both carry it on access.Scope.HiddenLibraryIDs, which grants nothing. GET /api/v2/user/libraries gains an opt-in include_hidden parameter, advertised by supports_include_hidden, that adds those libraries to a restricted scope's list. Only the web settings page sends it; the default response, the frozen v1 route, navigation, and content reads are unchanged, so the Apple and Android apps, which don't read the hide setting, keep their current behavior. The web now refetches the library lists when ui.disabled_library_ids changes locally or over the realtime channel, so the sidebar shows an unhidden library right away. Closes #2055 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughRestricted scopes now track profile-hidden libraries separately from allowed libraries. The v2 library-list API can optionally include them, and the web Settings → Libraries page requests them so their visibility controls remain available. ChangesProfile-hidden library discovery
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant LibrarySettings
participant useAvailableUserLibraries
participant UserLibrariesAPI
participant ListUserLibraries
LibrarySettings->>useAvailableUserLibraries: request includeHidden
useAvailableUserLibraries->>UserLibrariesAPI: GET with include_hidden=true
UserLibrariesAPI->>ListUserLibraries: pass IncludeHidden
ListUserLibraries->>ListUserLibraries: append hidden IDs for restricted scope
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change adds an opt-in include_hidden option so hidden libraries stay visible in settings. The default response is unchanged. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❓ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 18 files. (2 skipped: 1 unsupported, 1 too large.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
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. |
|
The Evidence link identifies Settings → Libraries at desktop and phone widths, but does not identify evidence for the other visible effect: enabling a hidden library restores it in navigation immediately. Please add a short recording of that toggle-to-navigation flow covering desktop and phone widths. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce6608431c
ℹ️ 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".
💡 Codex ReviewBefore landing this client-visible library API change, file or complete the corresponding Apple and Android work. The commit message says those parity issues are only drafted and not filed, so this change does not meet the repository requirement that cross-client follow-up be handled or filed. AGENTS.md reference: AGENTS.md:L146-L152 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
The evidence page already has a recording of the switch-to-navigation flow on desktop ( |
This comment has been minimized.
This comment has been minimized.
Conflict resolution: - internal/userdb: main took SQLite schema v30 for the profile PIN revision (#2020). The login-wide sharing migration moves to v31, so a store already at main's v30 still runs it. - internal/catalog, internal/sections: main's fail-closed library scope (#1953, #2005, #2006) and this branch fixed the same empty-scope bug. The executor and section fetcher keep main's AccessFilter.LibraryScope; library collections keep this branch's ResolveLibraryCollectionMembership, which already returns nothing when the saved libraries miss the collection's own. main's scope test now exercises that resolver. narrowLibraryScope no longer needs the helper main removed. - internal/policy: main's hidden-library output (#2058) and this branch's ContentAccessOnly input both declared `hidden`; the input side is renamed. - Home sections (#2043): the admin per-profile card keeps main's row list but saves with this branch's override builder and a baseline, so like Settings > Home Screen it stores only what changed and untouched rows keep following the server. main's duplicate lib/sectionOverrides.ts is dropped; EditableSectionRows stays for that card and labels rows with rowKindLabel. Settings > Home Screen keeps this branch's page. - apiv2: keep both sides' services and fixtures; the admin profile section settings fixture gains default_title. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Closes #2055
Related issue: N/A
Validation tasks: none
When an account or profile is limited to certain libraries, hiding one of those libraries in Settings → Libraries removes it from that page entirely. The page counts only what's left ("5 of 5 libraries visible"), the hidden library has no switch to turn back on, and "Show all" is disabled. To the user the library looks deleted. A user on a real server ran into this with an anime library. Profiles without a library limit are not affected.
The cause is server-side. For a library-limited scope, both viewer resolvers subtract the profile's hidden libraries (
ui.disabled_library_ids) fromAllowedLibraryIDs, andGET /user/librarieslists exactly that set. The settings page draws from that list.Approach
GET /api/v2/user/librariesgets an opt-ininclude_hiddenparameter, advertised assupports_include_hiddenon its capability response. Only the web Settings → Libraries page sends it. The default v2 response, the frozen/api/v1/user/libraries, navigation, and content reads are unchanged. That matters because Apple and Android don't readui.disabled_library_ids. For a limited profile they rely on the server leaving hidden libraries out, so changing the default would put an empty library in their navigation.To know which libraries to add back, the viewer scope now reports them. The scope policy (
scope.rego) emitshidden_library_ids: the profile's own hidden libraries that the account limit, the profile limit, and any custom override would otherwise allow. The legacy Go resolver computes the same set, and both put it onaccess.Scope.HiddenLibraryIDs. That field grants nothing; only the opt-in list reads it. It comes from the request's single scope evaluation, so there's no second resolve and no extra database read.Because the web's navigation list and the settings list are now separate queries, a change to
ui.disabled_library_ids(saved on this device, or announced over the realtime channel) invalidates the library lists. Otherwise the sidebar would keep the old list after unhiding.Two alternatives a reviewer might ask about:
DisabledLibraryIDsfor limited profiles, as unrestricted scopes already do. Not done because it would change content filtering for limited profiles and overlaps with [bug] Hiding a library hides titles that are also in a visible library #2011.Validation
main: with the profile limited to two libraries, hiding one removed it from/api/v2/user/librariesand from Settings → Libraries.internal/access,internal/policy(including the vendor Rego tests and the Go/Rego parity matrix),internal/api/handlers(including the database-backed list test),internal/apiv2,internal/api, andinternal/progresssyncpass. New cases cover the hidden set from both resolvers, a custom override that hides a library the profile also hid, an override that restricts an unrestricted base, and the opt-in and v1 paths.verify-apiv2-openapi,verify-apiv2-web-types,verify-apiv2-contract,verify-apiv2-fixtures,verify-route-inventory, andverify-migration-ledger.verify-local-pathspasses.src/hooks/queries, the settings page, and the realtime provider;tsc; eslint; prettier; and the changed-lines Go lint pass.read:project). Of the validation issues found by search, User management / access groups / invites — Server #1196 C1 (enforcing inherited library policy) is reachable. What a profile can browse, search, or play is unchanged, so that case is unaffected.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/issue-2055/
Surface and build: web app Settings → Libraries, desktop and phone width, dev sandbox before (
mainat fca2720) and after (this branch).Risks
/api/v2/user/librariesgains an optional query parameter and the capability response gains a field, both additive. The v1 bridge is unchanged.hidden_library_idsoutput. Custom scope overrides are unaffected: their output keys are read as before, and the new set can only shrink under an override's allowlist and disabled list.Scope.HiddenLibraryIDsis kept out of the access fingerprint, so socket tickets and progress snapshots hash as before.AllowedLibraryIDs.Follow-ups: Apple and Android ignore
ui.disabled_library_ids, so a profile without a library limit still sees its hidden libraries in their navigation (an existing gap, unchanged here). Tracked in Silo-Server/silo-apple#691 and Silo-Server/silo-android#515. User manual: unaffected; it doesn't describe hiding libraries.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Add
include_hiddento Settings → Libraries so hidden libraries can be reshownHiddenLibraryIDsfield onaccess.Scope, kept out of the access allowlist and the scope fingerprint. Policy rules (scope.rego) compute these IDs as the intersection of allowed and profile-disabled libraries, including under custom overrides.GET /api/v2/user/librariesaccepts aninclude_hiddenquery flag, and the capabilities response advertisessupports_include_hidden. The web LibrarySettings.tsx page opts in so hidden libraries appear with switches to re-show them; all other callers default to off.UI_DISABLED_LIBRARY_IDSsetting (writes and realtime events) now invalidate cached library queries, handled in settingValues.ts.includeHidden=falsein libraries.go, and unrestricted scopes are unchanged. One test expectation in scope_test.rego (test_unrestricting_override_keeps_profile_hidden_libraries_it_allows) appears inconsistent with themerged_hiddenrule, which returns an empty list when the merged result is unrestricted.Macroscope summarized 9d4906f.