Repository navigation
feat(admin): let admins edit one profile's home section order - #2043
Conversation
Admins can read, replace and reset a single profile's page-layout
overrides under /api/v2/admin/users/{id}/profiles/{profile_id}/sections,
with the same shapes as /api/v2/profile/sections. A profile that is not
the account's answers 404, writes are audited like admin setting writes,
and admin account capabilities advertise profile_sections.
The Preferences tab shows the selected profile's Home sections with reorder, show/hide and reset to default, gated on the profile_sections capability. The drag list and override builder are shared with the Home screen settings page.
An administrator's save ran the recipe gate with the administrator's role, so it could add an admin-only recipe section to a regular account's profile. That profile re-saves its whole layout on every change, so each of its later saves would then fail with 403 until an administrator removed the section. Run the gate with the owning account's role instead.
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⚙️ Run configuration
📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThis change adds administrator API operations and interface controls to read, replace, and reset a specific account profile’s section layout. It adds the ChangesAdministrator profile section layouts
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Admin as Admin preferences
participant ProfileHomeSections
participant ProfileSectionHooks as Admin profile-section hooks
participant AdminProfileRoutes as Admin profile-section API
participant SectionHandler
Admin->>ProfileHomeSections: Open selected profile preferences
ProfileHomeSections->>ProfileSectionHooks: Load profile settings and overrides
ProfileSectionHooks->>AdminProfileRoutes: GET settings and overrides
AdminProfileRoutes->>SectionHandler: Resolve profile layout and overrides
SectionHandler-->>ProfileHomeSections: Return profile section data
ProfileHomeSections->>ProfileSectionHooks: Save layout or reset overrides
ProfileSectionHooks->>AdminProfileRoutes: PUT overrides or DELETE overrides
AdminProfileRoutes->>SectionHandler: Save or reset addressed profile
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable issue is established for this revision; it is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 38.81% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 67 functions across 28 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
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 |
|
Evidence: FAIL The Evidence section is still the placeholder ("publishing to the evidence site; the link follows"), but this PR has a user-visible web change: a new Home sections card in Admin > Users > Preferences, and Settings > Home Screen now renders through the shared To pass, please add an Evidence link that shows:
Grok commenting on Quick's behalf. |
|
Note Grok commenting on Quick's behalf. Evidence: FAIL (placeholder). The Evidence section says "publishing to the evidence site; the link follows", but there's no artifact yet, and this PR has user-visible web UI changes. Please add one of these to the Evidence section:
Either way, it needs to cover:
|
|
Evidence is missing: the Evidence section says the link will follow, but contains no published link or captures.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
Validation impact
The current Suggested fix: Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Saving or resetting a profile's Home layout from Admin > Users now also invalidates the sections queries, so an administrator who edits their own profile does not see the old layout on Home.
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:
|
|
Evidence is published: https://evidence.siloserver.org/r/silo-server/pr-2043/ Before is origin/main 47a2998; after is an integration build of the #1219 branches on the same main, with this PR's code as of 2f61619. The review fix in 9850fdc refreshes the acting profile's Home after an admin edit; these captures edit another profile, so they're unaffected.
|
Quick104
left a comment
There was a problem hiding this comment.
Review of 9850fdc. I found three low-severity defects and no blockers. The authorization checks hold up: admin-only class, unknown account 404, profile ownership through the account's own store, and reset scoped to one profile. The contract change is additive. The findings are on the lines below, and I'm pushing fixes for all three to this branch. A summary comment with scores follows.
…brary access The admin profile-sections operations ran the profile route's library check, which reads the acting administrator's library scope. An administrator who had hidden a library for their own browsing got 404 for another profile's layout on that library page. The admin operations now require only that the library exists and is enabled; the profile's own routes keep the viewer check. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…y a save failed The save and reset hooks captured the admin authority during render, which throws when no profile context is set; they now capture it inside the mutation, as the query hooks do. A refused save's toast now shows the server's reason from the problem's first error instead of "see errors". Co-Authored-By: Claude Opus 5.5 (1M context) <[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 link and described desktop and phone captures cover the admin card states, the target profile's changed layout, an unchanged second profile, and the Settings > Home Screen refactor. The described evidence does not include a recording:
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
Review summaryFit: 9/10 · Readiness: 8/10 — conditional (reviewed head Addressed in this reviewI found three low-severity defects in
Each fix has a regression test that failed on the previous head. The focused Go tests ( Checked and fine
Remaining, not blocking
ValidationI couldn't read the validation board, so I couldn't check which passed cases this reaches. #1221 C1 is recorded as Not run on the task, so it isn't an unblock of a passed case. The User manualThe manual's "Curate the home screen" page ( Apps and JellyfinThe change is server and web admin only. Administration lives in web admin, so Apple and Android need no change. Jellyfin has no equivalent admin view, so jellycompat is unaffected. Scores
AI disclosure: reviewed by Claude Code (claude-opus-5-5) with Claude subagents, plus a read-only review round by Codex (gpt-6.1-sol). Fix commits written by claude-opus-5-5. |
|
Added the requested recording of keyboard drag reorder, hiding a row, and the reset confirmation through the default layout. Corrected the validation line to changes #1221 C1, and filed the manual update as Silo-Server/siloserver.org#119. Earlier desktop/phone comparisons remain available in the evidence page’s version history. |
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
Related issue: #1219
Validation tasks: changes #1221 C1
An admin can't see or fix one profile's home screen layout.
/api/v2/profile/sectionsonly acts on the caller's own profile, and the admin section routes change the server-wide layout or reset every profile at once. The only way to fix one person's rows was to sign in as them with View as user and then enter the profile's PIN. #1219 AC4 requires an admin to correct a profile's home section order.Admins can now read, reorder, hide and reset one profile's home sections from Admin > Users > Preferences.
Approach
/api/v2/admin/users/{id}/profiles/{profile_id}/sections: list, the resolved settings view, replace and reset. They use the same shapes as/api/v2/profile/sections, and both now share the same service code.profile_sections.Most of the diff is generated OpenAPI and fixture output.
Validation
Go handler and API tests cover:
Web tests cover the card and capability gating. Contract, lint, typecheck and build checks pass.
Tested by hand on a local server: an admin reordered and hid rows on another profile, and that profile's home page and Settings > Home Screen showed the change. Other profiles were unchanged.
Added the drag-reorder, hide, and reset-confirmation recording to the evidence page. Manual follow-up: Silo-Server/siloserver.org#119.
Evidence: https://evidence.siloserver.org/r/silo-server/pr-2043/
Evidence
Risks
Checklist
AI Disclosure
Note
Add admin API and UI to edit a profile's home section order
profile_sectionscapability flag in admin_accounts.goProfileHomeSectionsin ProfileHomeSections.tsx shows a sortable section list with visibility toggles, reset, and save via new admin hooks in profileSections.tsHomeScreenSettingsinto sectionOverrides.ts, and drag-and-drop rendering moved into the newSectionOrderListcomponentresolveProfileSectionSettingsfor admin requests returns sections hidden by the addressed account's library access, and admin saves use the target account's role rather than the admin's own — checkrequireAccountPageandsaveProfileOverridesin sections_account_profile.goMacroscope summarized 9a5564c.