Skip to content

fix(profiles): let regular accounts manage household profiles - #595

Merged
Quick104 merged 1 commit into
mainfrom
fix/profile-manage-regular-accounts-592
Oct 17, 2026
Merged

Quick104 merged 1 commit into
mainfrom
fix/profile-manage-regular-accounts-592

Conversation

@Quick104

@Quick104 Quick104 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #592
Related issue: Silo-Server/silo-server#1179
Validation tasks: changes #332 C1; changes #333 C1

On an account that isn't a server admin, the phone and TV profile pickers show no Manage button and no Add tile. The picker is the only way into the create and edit screens, so a regular household can't add, edit or delete a profile from Android at all.

Both pickers decided this from the account role (role == "admin"), a gate from #263, when only admin accounts could manage without a selected profile. Since Silo-Server/silo-server#2019, the server lets the account's primary profile manage the household, verified with its PIN, whatever the role. #493 already made Manage act as the primary profile but kept the admin check.

Approach

The pickers now show Manage and the Add tile whenever the household has a primary profile, using the same householdPrimary() lookup that entering manage mode already uses. The account role no longer matters. Everything after that is unchanged: the primary's PIN is asked for when it has one, its proof is held only while managing, the device's selected profile stays as it was, and server refusals show their message.

ProfileSelectionAdminGateTest and TvProfileSelectionAdminGateTest become ProfileSelectionManageGateTest and TvProfileSelectionManageGateTest, with three cases each: a regular account's household with a primary can manage and enter manage mode, a failed account lookup doesn't hide management, and a household with no primary can't manage, even on an admin account.

Decisions for review

  • The gate is "the household has a primary profile". householdPrimary() is the profile marked primary, or the only profile when there is just one. The server marks one primary on every account that has profiles (migration 094 and a unique index). A household with no profiles shows neither Manage nor Add. Before, an admin saw the Add tile there, but tapping it only raised "Couldn't find the primary profile needed to manage profiles." The Apple apps show the Add tile on every account and raise the same error on tap. The issue asked for "every account that has a primary profile", so I hid it instead of copying Apple.
  • The account role is no longer read for this at all, admin accounts included. Since fix(profiles): manage household profiles as the primary profile #493, Manage acts as the primary on admin accounts too, so the role added nothing.
  • Older servers. A server from before fix(access): give household and admin powers only to the primary profile silo-server#2019 refuses a regular account's profile changes with 403. The picker now offers Manage there, and the attempt shows that server message instead of the buttons being hidden.

Validation

  • Reproduced on a disposable Silo dev deployment built from server main (685344a9f), using a synthetic regular (role: user) account whose only profile is a primary with a PIN. Before (main, b5bf8599), the phone and TV pickers show the profile, Change server and Sign out only.
  • After the fix, on an Android 16 phone emulator and an Android 16 TV emulator against the same server, Manage and the Add tile appear. On each device, I verified the primary's PIN, created a profile, edited it and deleted it. The server log shows verifyProfilePIN 200, createProfile 201, updateProfile 200 and deleteProfile 204 for each walk. The primary profile has no Delete button.
  • A server refusal still shows its message. With the account's profile limit set to 1, Create on the phone got a 409 and the form showed "This account has reached its profile limit (1)".
  • Focused tests: the 3 new cases in each gate test pass. All 3 fail on main's view models, each for the intended reason.
  • Gate: ./gradlew testDebugUnitTest: pass. Lint (:android-shared:lintDebug :androidApp:lintDebug :androidTvApp:lintDebug :androidApp:lintVitalRelease :androidTvApp:lintVitalRelease): no new issues against the baseline. :androidApp:assembleDebug and :androidTvApp:assembleDebug pass. The two supply-chain scripts couldn't run locally because the build host has no ruby. This diff touches no build or workflow files, and CI runs them.

Evidence: https://evidence.siloserver.org/r/silo-android/issue-592/

Risks

  • Regular accounts can now reach create, edit and delete. The server still authorizes every call from the verified primary, so the client gate only decides what's shown.
  • When the primary profile has no PIN, anyone at the picker can open Manage. That was already true on admin accounts, and in the web and Apple apps; the server treats an unprotected primary that way.

Follow-ups

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code, running in T3 Code (SiloBot task requested by a maintainer)
  • Tool(s): Claude Code, GitHub CLI, agent-device, adb
  • Model(s): claude-opus-5-5 (wrote the code); claude-sonnet-5-5 (one review finder)
  • Involvement: Fully AI-generated. The agent reproduced the bug and verified the fix on emulators against a disposable server with synthetic data. No human has run it yet.
  • Adversarial review: the plan round was skipped as a mechanical fix: a few lines where the root cause sits, with nothing added. A code review by three Claude finder subagents (claude-opus-5-5, claude-sonnet-5-5) found no defect to fix; its two optional notes are under Follow-ups and Decisions for review. A background cross-provider review by Codex (gpt-6.1-sol, xhigh) of 3023e99 found nothing to report.

🤖 Generated with Claude Code

The phone and TV pickers showed Manage and the Add profile tile only to
admin accounts. Since silo-server#2019 the server lets the account's
verified primary profile manage the household whatever the role, and
Manage already acts as the primary (#493), so the role check left
regular households with no way to add, edit or delete a profile.

Show both whenever the household has a primary profile. The manage gate
tests become ManageGate tests covering a regular account, a failed
account lookup and a household without a primary.

Closes #592

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 15, 2026
@silo-kody

silo-kody Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 30c244c9-bdb4-4781-814e-0f5551b34bd2
📥 Commits

Reviewing files that changed from the base of the PR and between a4dd216 and 3023e99.

📒 Files selected for processing: 6
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/profiles/ProfileSelectionScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/profiles/ProfileSelectionViewModel.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/profiles/ProfileSelectionManageGateTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/profiles/TvProfileSelectionScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/profiles/TvProfileSelectionViewModel.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/profiles/TvProfileSelectionManageGateTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Phone and TV profile management eligibility now depends on whether the household has a primary profile, rather than whether the signed-in account is an admin. The tests cover households with and without a primary profile, including when the account lookup fails.

Changes: Profile management

Layer / File(s) Summary
Primary-profile management gate
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/profiles/*, androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/profiles/*, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/profiles/*, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/profiles/*
Phone and TV view models allow management when the household has a primary profile and end household management when it does not. When management is unavailable, manage mode and pending deletion are cleared. Screen descriptions and tests reflect the updated eligibility rule.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: rhainland

Merge Risk: ⚪ Minimal · up to 3023e

The change appears ready to merge after normal checks; no actionable risk remains from the reviewed behavior.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 27.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Issue #592 is the active directly linked issue. Both phone and TV view models now derive canManageProfiles from householdPrimary(), not from the account role. They end management and clear managem…
Out of Scope Changes check Passed The changes stay within issue #592. They update the two profile-selection view models, related screen comments, and the two gate test classes. The test changes directly verify the new primary-profile …
Title check Passed The title clearly and concisely describes the main change: allowing regular accounts to manage household profiles.
Description check Passed The description is directly related to the changeset. It explains the problem, implementation, validation, risks, and follow-ups.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@silo-triage silo-triage Bot added bug Something isn't working impact: usability Core flow broken or severely blocked priority: P1 Core-path bug; painful workaround — next after P0 triaged High-confidence review completed; does not mean fixed, validated, or accepted for release. labels Oct 15, 2026
@Quick104
Quick104 merged commit 62be1a2 into main Oct 17, 2026
13 of 15 checks passed
@Quick104
Quick104 deleted the fix/profile-manage-regular-accounts-592 branch October 17, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working impact: usability Core flow broken or severely blocked priority: P1 Core-path bug; painful workaround — next after P0 size/M 50–199 added + deleted lines (all files); change volume, not priority. triaged High-confidence review completed; does not mean fixed, validated, or accepted for release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Regular accounts can't add, edit or delete profiles in the Android apps

1 participant