Repository navigation
fix(notifications): require household authority for Discord changes - #2756
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:
|
|
Evidence covers the web settings change, but not the API authorization change. The v1 and v2 handlers now reject secondary-profile writes; the linked page is described as UI captures only. Please add before-and-after response excerpts for the same secondary-profile request showing the prior success and the new Suggested fix: No diff; add the matching API response excerpts under Evidence. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
All relevant task results are 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 a8650cb89. The approach is right: Discord delivery covers every profile on the account, so changing where it goes belongs to the household manager, and this reuses the existing primary-profile and PIN rule on both API versions instead of adding a new one. I reproduced the defect on a sandbox built from the base commit (a secondary profile could change the mode, unlink, and start a new link on both /api/v1 and /api/v2) and will check the fixed build the same way.
Two low-severity findings, both inline. I'm fixing both in commits on this branch, so there's no need to change anything yourself.
A Codex (gpt-6.1-sol) adversarial round found no defects.
…scord Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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:
|
Review summaryReviewed head: The fix holds up. Discord delivery covers every profile on an account, so re-linking, unlinking, or changing its mode is household management, and this PR applies the existing household-manager rule ( FindingsBoth were low severity and are fixed on this branch:
A Codex ( VerificationOn a disposable sandbox, using the same database for both builds:
The Other feedback
Validated features#1234 (Notifications — Server) C1 and #1235 (Notifications — Web) C1 and C2 are all Clients, Jellyfin compatibility, and docs
VerdictFit: 9/10 · Readiness: 9/10 — ready
Review by Claude Code ( |
Problem
Closes #2752
Related issue: N/A
Validation tasks: changes #1234 C1; changes #1235 C1-C2
A secondary household profile could change the account-wide Discord destination or delivery mode. This applies the existing household-manager and PIN rules to link initiation, unlinking and mode changes on both native API versions.
Approach
Both versions use the existing household authorization through a shared handler dependency. Account admin status does not grant a secondary profile household authority. Documented profile-less exceptions remain, and reads and account-wide delivery keep their existing behavior.
The web settings page disables these controls for secondary or unresolved profiles and explains how to switch to the primary profile. The API contract documentation records the restriction and the critical v1 bridge fix.
Validation
/api/v1and/api/v2. On the PR head those requests return v1403 forbiddenor v2403 permission_denied; primary profiles still succeed, a PIN-locked primary succeeds only with a verifiedX-Profile-Token, and a profile-less admin session succeeds until a profile on the household has a limit. Reads are unchanged. No OAuth exchange or message delivery was performed; the Discord credentials were placeholders.internal/api/handlersandinternal/apiv2packages pass in full, plus theinternal/apipackage;make verify-apiv2-openapi verify-apiv2-web-types verify-apiv2-fixtures verify-route-inventoryis current andmake lint-changedreports no issues.tsc -bpass.ci / Go testfailure wasTestAdminDefaultChangeReachesEveryViewer, which failed on main too and is fixed by fix(events): deliver administrator default changes to every viewer #2754; main is merged into this branch.Evidence
Before-and-after captures of the Discord settings group for a secondary profile (linked and unlinked, desktop and phone) and for the primary profile, plus the API responses for every caller above on both builds.
Evidence: https://evidence.siloserver.org/r/silo-server/issue-2752/
Risks
Secondary profiles now receive the existing permission errors when attempting these account-wide writes; locked primary profiles require verification. Existing OAuth state lifetime and callback revocation behavior are outside this change.
Apple and Android source contain no callers for these Discord management endpoints, and jellycompat exposes no equivalent surface. User manual: Silo-Server/siloserver.org#265, draft docs PR Silo-Server/siloserver.org#266. The draft waits for this code PR; its local captures are retained while evidence publication for the dotted repository name is blocked.
Checklist
AI Disclosure
gpt-6.1-sol(implementation and independent source reviews);claude-opus-5-5(approach review, adversarial reviews, and the two review fixes).claude-opus-5-5background review ata8650cb89found no verified defects. A laterclaude-opus-5-5review in Claude Code, with agpt-6.1-sol(Codex) adversarial round that found nothing, reported two low-severity findings; it fixed both on this branch (the shared household admission helper and the OpenAPI descriptions) and ran the sandbox check above.Note
Require household-manager authority for Discord notification mutations
mayManageHouseholdOfin household.go, which resolves the user's store from an account ID and fails closed on missing wiring. The v2 guardrequireDiscordNotificationManagementin notification_channels.go applies the same rule at the registry level, withNotificationDiscordManagementas an optional dependency onapiv2.Dependencies.PUT /api/v1/notifications/discord-preferences,DELETE /api/v1/notifications/discord-link, andPOST /api/v1/notifications/discord/link/init, plus their v2 equivalents, previously allowed any authenticated caller and now require household-manager (primary profile with PIN) authority; missing management wiring returns an error instead of proceeding.Macroscope summarized 0d1b767.