Repository navigation
fix(access): preserve empty v1 group library policies - #2702
Conversation
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:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Major change: #1196 C1 (Server, build Suggested fix: Keep Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Quick104
left a comment
There was a problem hiding this comment.
Review of 3274e8b. The library_ids fix holds end to end: request copy, storage, resolver, catalog filter and response all keep null and [] apart, and jellycompat reads the same resolved scope. One finding, inline, on the sibling field in the same response function. I'm fixing it on this branch.
The v1 access-group response copied allowed_permissions with append([]string(nil), ...), so a group that allows no extra permissions came back as null. Saving that response stored NULL, which allows every assignable permission. Clone the slice so null and [] stay distinct, make the test store copy the same way, and drop the unused string Ptr helper that had the same collapse. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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:
|
|
The Evidence section's stated after-build ( Suggested fix: No diff; add this behavior to the linked evidence page. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
Review summaryReviewed head: The Addressed
RemainingNothing blocking. The description already covers the two operational notes: groups that the old code saved as NULL stay unrestricted until an administrator re-saves them, and replicas still on an old build keep the old behavior until the rollout finishes. Validated features#1196 C1 was validated through the web admin and Checks
Fit: 9/10 · Readiness: 9/10 — ready
Review by Claude Code ( |
Problem
A v1 access-group update with
library_ids: []grants members unrestricted library access. Reading an existing empty policy through v1 also returnsnull, for bothlibrary_idsandallowed_permissions, which widens the group when the response is saved back. Preserve empty lists so both paths deny every library, or every extra permission, as documented.Closes #2700
Related issue: N/A
Validation tasks: changes #1196 C1
Approach
Preserve the distinction between omitted, null, empty and populated library policies when copying v1 request and response values, and between null and empty permission policies in v1 responses. v1 responses now return
[]instead ofnullfor groups that allow no libraries or no extra permissions. Cover persistence, inherited scope, catalog filtering and GET/save behavior, with v2 controls. This is a critical fix to the frozen v1 bridge contract; no schema or capability changes are needed.Apple and Android need no companion change: neither current client manages access groups. Web admin uses v2, and Jellyfin already enforces empty policies through the shared resolver. The API documentation and user manual already describe the intended behavior.
Validation
365e3d436fc2fac8e8b3f4f6d42111ff1baeb48b.8b000c5e5: on a sandbox, v1 create, get and a read-then-save keep[]for both lists; null, populated and omitted controls are unchanged.TestAccessGroupPermissionPolicyRoundTripfails on the old permissions copy and passes now. Changed-line lint is clean; the focused handler and v2 tests pass.read:project.Evidence
Before build:
365e3d436fc2fac8e8b3f4f6d42111ff1baeb48b. After build:8b000c5e5. The evidence page contains the API and storage comparisons for both lists, negative controls, correlated request rows and test results.Evidence: https://evidence.siloserver.org/r/silo-server/issue-2700/
Risks
Roll out to every API replica; old replicas can still widen an empty policy. Existing NULL policies may be intentional or may have been widened by this bug, so the fix cannot safely repair them automatically. Administrators must review and re-save suspected affected policies.
Checklist
AI Disclosure
gpt-6.1-sol(xhigh);claude-opus-5-5(high).claude-opus-5-5(high) reviewed exact head3274e8b5e7f09bc21e879f95c67ed9a9c92ccd03, traced policy/storage/filtering and cleanup paths, and ran focused handler/v2 tests. It found no issues and posted nothing.claude-opus-5-5, xhigh) with a read-only Codex round (gpt-6.1-sol, xhigh) found that the response still turned an emptyallowed_permissionsintonull; fixed in8b000c5e5.Note
Preserve empty vs nil v1 access-group library policy slices
LibraryIDsorAllowedPermissionsslice stays distinct from a nil slice when converted to a pointer. ThePtrhelpers andtoAccessGroupResponsenow useslices.Clone, which copies the slice but keeps an empty slice non-nil.CreateandUpdatemethods to useslices.Cloneso tests preserve the same nil/empty distinction.library_idsvalues, plus a permission-policy round-trip test.TestAccessGroupUpdateLibraryPolicyDB, and registers it in db-contracts.txt. It verifies that omittedlibrary_idskeeps the existing restriction, null removes it, and an empty list denies all libraries.library_idslist now denies all libraries instead of being treated as unrestricted.Macroscope summarized 8b000c5.