Skip to content

feat(api): manage another account's profile avatars, allowances and home cards - #5873

Merged
Quick104 merged 3 commits into
mainfrom
feat/admin-profile-api-household
Dec 5, 2026
Merged

Quick104 merged 3 commits into
mainfrom
feat/admin-profile-api-household

Conversation

@Quick104

@Quick104 Quick104 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

Other clients: N/A (no client-visible change: these are new admin operations that no client calls yet)

Administrators can already list, create and edit an account's profiles through /api/v2/admin/users/{id}/profiles, but they cannot manage what belongs to one of those profiles without signing in as it. A tool holding an admin API key has no way to change a child profile's avatar, allow it a title above its rating limit, or bring back a home card it dismissed.

This is the first of five stacked pull requests that add admin operations under /api/v2/admin/users/{id}/profiles/{profile_id}/.... Each operation acts on one profile of another account, uses that profile's access and per-profile state, and answers what the profile's own route answers. This pull request adds the shared target handling and the avatar, title allowance and home dismissal operations.

Stack, merged in order; each pull request is based on the one before it:

  1. feat(api): manage another account's profile avatars, allowances and home cards #5873: avatars, title allowances, home cards and the shared target handling (this pull request)
  2. feat(api): read and change another account's settings as an administrator #5874: settings, navigation shortcuts and plugin settings
  3. feat(api): browse the catalog and libraries as another account's profile #5875: catalog and library reads
  4. feat(api): manage another account's profile collections as an administrator #5876: personal and server collections
  5. feat(api): preview and check another account's profile page layout #5877: page layout preview, baseline and reference checks

Approach

  • adminProfileTarget resolves the account and profile from the path, plus the profile's viewer scope without its PIN, and passes them to the service explicitly. The request's claims, profile and scope are never swapped, so audit records and rate limits still name the administrator.
  • Reads are open to every acting administrator, like the other /admin/users reads. Writes apply the Owner rules (auth.CheckOwnerTarget): only the server Owner may change the Owner's account or another admin account. Writes are audited and keep the demo write guard. A scoped admin:users key does not reach these routes.
  • Cursors and ETags are bound to the account, the profile and the profile's access policy, so a validator or cursor from the profile's own routes, from another profile, or from before an access change is refused.
  • Allowances take the account in place of the household manager: no manager check or PIN. A title must be in the account's libraries (404 otherwise) and reachable by the profile (422 no_library_access). Copying a collection's titles keeps unrated titles when the server allows unrated content.
  • Home dismissals get dismiss, restore and a list of what currently hides the profile's Continue Watching and Next Up cards.
  • getAdminAccountCapabilities gains profile_avatar_writes, title_allowances and home_dismissals. Each flag is true only when every service its operations call is configured, so a flag never promises a 503.

The profile's own routes behave as before. docs/admin-users-api.md describes the shared rules and these operations.

Validation

  • Go build, go vet, gofmt and make lint-changed: clean.
  • go test for internal/api, internal/api/handlers and internal/apiv2 against a Postgres test database: pass.
  • Contract checks on this branch (verify-apiv2-openapi, -web-types, -fixtures, -contract, verify-route-inventory, verify-size-ratchet, TestCommittedArtifactMatchesRouter): pass; the contract only adds operations and capability fields.
  • The full gate from CONTRIBUTING ran on the top of the stack, which contains this branch: Go build, gofmt, go mod tidy -diff, go vet ./..., make lint-changed, make lint-router-recovery and make test-go pass. Web install, lint, format check, build and bundle budget pass. make test-web passed 3775 of 3777 tests; the two that timed out under load (AdminCollections.select.test.tsx, rangeReader.test.ts, neither touched here) pass when run again. Every verify target passes except verify-actionlint and verify-shellcheck, which did not run: actionlint 1.7.12 and ShellCheck 0.11.0 are not installed on the test host, and the stack changes no workflow or shell script.
  • End-to-end API script against a local sandbox built from the top of the stack: 227 of 227 checks pass, 23 of them on this pull request's operations; the rest are the shared setup, Owner-rule and audit-log checks.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/admin-profile-api-household/

Risks

  • New admin surface. Any administrator can read another account's allowances and dismissals, as other /admin/users reads already allow. Writes to the Owner's account or another admin's account are refused unless the actor is the Owner.
  • No migration and no change to the profile's own routes.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code, running in T3 Code
  • Tool(s): Claude Code, with T3 Code delegated sessions for the implementation and Claude Code subagents for a readability pass
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, not yet human verified
  • Adversarial review: a separate Claude Code session reviewed the whole set of operations before it was split into this stack. Its findings for this part were fixed here: capability flags that promised operations whose services were not configured, an avatar flag that ignored a missing avatar store, collection copies that dropped unrated titles, and an unverified profile that answered 500 instead of 403. After the split, this pull request had a maintainer review with a cross-provider round (gpt-6.2-sol, claude-opus-5-5 and gemini-4-neon, each at medium effort). Its fixes are in the second commit: contract text that promised 501 and ETag checks the routes don't have, and Next Up wording in the dismissal list.

🤖 Generated with Claude Code

Note

Add admin API operations for another account's profile avatars, allowances, and home cards

  • Adds administrator v2 API routes for managing another account: profile avatar upload/delete, title and collection allowances, home dismissals, plugin settings (with secret values withheld), filtered and batch setting-value writes, and effective-settings reads.
  • Adds shared target resolvers in admin_account_target.go: writes to protected owner/admin accounts are blocked via auth.CheckOwnerTarget, and catalog checks use the target account/profile scope rather than the administrator's own scope.
  • Storage: ListAdminSettingValuesPage now takes an AdminSettingValueFilter (scope, profile, keys) in both the SQLite and Postgres stores, with cursor scope now including the filter; plugin config writes use a transactional read-validate-write Replace path.
  • Regenerates the OpenAPI contract and TS client in openapi.json and schema.ts, including 7 new required capability booleans.
  • Behavioral Change: administrator setting writes and deletes now return field-specific validation problems instead of generic failures, and cursors for filtered setting lists differ from prior unfiltered cursor scopes. UserConfigStore.Set delegates to Replace, which may retain undeclared stored keys depending on options.

Macroscope summarized 3d48828.

…ome cards

Add admin operations under /api/v2/admin/users/{id}/profiles/{profile_id}
that act on one profile of another account with that profile's access:
avatar upload and removal, allowed titles and collections, the title
allowance overview for every profile, and home card dismissals with a list
of the current ones. Reads are open to every administrator; writes follow
the Owner rules and are audited. The request identity is never swapped.

New capability flags: profile_avatar_writes, title_allowances,
home_dismissals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added the size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. label Dec 5, 2026
@silo-kody

silo-kody Bot commented Dec 5, 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 ❌

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T19:43:28.958774Z 3d48828 New commits
🔒 Security Review ✅ Completed 2026-12-05T19:46:04.316719Z 3d48828 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The change adds administrator APIs to manage another account’s profile avatars, title and collection allowances, and home dismissals. It adds account and profile target resolution, capability reporting, access-scoped handler behavior, API contracts, route registration, tests, and client mappings. The generated v2 schema also revises declarations across other API areas.

Changes: Administrator profile management

Layer / File(s) Summary
Account targets and capability contracts
internal/apiv2/admin_account_target.go, internal/apiv2/admin_accounts.go, internal/api/handlers/access_filter.go, contracts/api/v2/fixtures/admin_account_capabilities.json, contracts/api/v2/openapi.json, web/src/api/v2/schema.ts, internal/apiv2/admin_account_household_test.go, internal/apiv2/admin_account_target_test.go
Account and profile target resolution applies access and write-owner checks. Capability flags and API contracts describe the profile operations. Tests cover target access and capability availability.
Profile title and collection allowances
internal/apiv2/admin_account_title_allowances.go, internal/api/handlers/title_allowances.go, internal/apiv2/cursor.go, internal/apiv2/title_allowances.go, internal/api/handlers/title_allowances_admin_test.go, internal/apiv2/document.go
Administrator operations list, add, remove, and copy titles or collections. Account-level access determines title visibility and collection validation. Tests cover administrator access and collection copying.
Profile avatar management
internal/apiv2/admin_account_profiles.go, internal/apiv2/profiles.go, internal/api/handlers/profiles.go, internal/apiv2/pilot_fakes_test.go, contracts/api/v2/openapi.json
Administrator routes upload and delete profile avatars through the shared avatar handler. Avatar-write capability reporting depends on whether an avatar store is configured.
Profile home dismissals
internal/apiv2/admin_account_home_dismissals.go, internal/api/handlers/home_dismissals.go, internal/apiv2/home.go, internal/api/handlers/home_dismissals_admin_test.go, internal/apiv2/admin_account_home_dismissals_test.go, contracts/api/v2/openapi.json
Administrator routes list, dismiss, and restore home items. Listing filters stale Continue Watching entries and inactive series drops, then sorts results. Tests cover access filters, listing behavior, and endpoint responses.
Route and client integration
docs/admin-users-api.md, internal/api/testdata/media_routes.txt, internal/apiv2/document.go, internal/apiv2/router_test.go, web/src/api/v2/operations.ts
Route fixtures, registration, documentation, and client operation mappings expose the administrator profile operations. The router leak check also covers profile-scoped home routes.

Generated API declaration updates

Layer / File(s) Summary
Existing operation declarations
contracts/api/v2/openapi.json, web/src/api/v2/schema.ts
OpenAPI operation declarations change or move parameters, response schemas, and documented outcomes for existing operations. The generated client schema also revises declarations across numerous API areas.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant AdminClient
  participant Registry
  participant adminTarget
  participant HomeDismissalHandler
  AdminClient->>Registry: PUT profile home dismissal
  Registry->>adminTarget: Resolve writable profile and access scope
  adminTarget-->>Registry: Return target and catalog filter
  Registry->>HomeDismissalHandler: DismissHomeItem with scoped access filter
Loading

Suggested labels: enhancement, go, api-v2, javascript

Suggested reviewers: rhainland, darthshadow

Merge Risk: Low · up to 9e87d

The new admin profile routes look sound on access control, but several published contract details are wrong. Unsupported allowance stores return a retryable error, allowance refusals lose their specific codes, and two home-dismissal operations are marked safe to retry automatically when a delayed retry can re-hide or restore a series. The docs also promise stale-validator rejection that is not implemented. These should be corrected before the contract is relied on by clients.

Security architecture risk: Moderate · up to 9e87d

The new routes keep the administrator’s identity and apply the server Owner’s protections before changing another account’s profile. Two recovery risks remain: retrying a home dismissal can reverse the profile’s newer activity, and clearing an avatar can race with a replacement and delete the newly uploaded image.

Retained concerns

  • Minor · reliability · observed: The new administrator home mutations declare natural retry safety but do not distinguish replaying an earlier decision from making a new one. A delayed PUT after the profile resumes watching refreshes the drop and hides the show again; a delayed DELETE can erase a newer drop. The administrator and the profile can act independently, and WatchSync can propagate the replayed state to the profile’s enabled providers. The self-service route already had these semantics; the PR newly exposes the retry contract to independent admin clients. Make the admin contract non-retryable after an uncertain response unless replay can be tied to the original operation or state version.
  • Trivial · reliability · inferred: An administrator clearing an avatar and an account holder replacing it can operate on the same object keys. If the clear removes the reference, the replacement writes its objects and publishes its reference, and the clear then deletes the profile’s objects, the profile can point at an image that no longer exists. The same interleaving was possible between two self-service requests before this PR; the new route adds an independent writer. Marking the clear non-retryable helps with delayed retries but cannot stop cleanup from an already-running request. Scope cleanup to the cleared version or serialize replacement and cleanup per profile.

View findings in the submitted review

Security review details

Security Blast Radius

  • observed — The unit of a profile mutation is one account and profile, but an acting administrator can address ordinary accounts across the server. Reads are not restricted by the Owner-target rule. Writes to the Owner’s account or another administrator’s account require the server Owner; a series-drop write can also affect the target profile’s configured provider connections.

Trust Boundaries and Controls

  • observed — The API class gate authenticates and checks acting-admin authority before operation input processing. For avatar upload, the target-specific Owner rule runs inside the typed handler, after multipart binding but before image processing or avatar storage writes. The service then looks up the profile in the resolved account’s store before writing.

Dependencies

  • observed — The new home routes reuse the dismissal service. With database-backed series drops and a WatchSync dispatcher wired, the service saves local state before dispatching by target account and profile. WatchSync selects that profile’s enabled connections and rechecks the provider account and sync setting before sending.

Data and control flow

  • observed — Administrative allowance checks distinguish the target account’s library access from the target profile’s library reachability. Collection copies also apply the creator’s content access before persisting eligible titles; an ongoing collection allowance separately requires a manual collection created by the account’s primary profile.

Resilience and Maintainability Implications

  • observed — A successful admin home mutation confirms the local handler completed, not that a linked provider acknowledged the change. Restore can remove the series drop before legacy per-card cleanup fails, skipping immediate dispatch. The dismissal list reflects local records, not outstanding provider work. WatchSync has a separate scheduled reconciliation path for enabled connections; a local read cannot establish that it ran or what the provider accepted.
  • observed — Avatar replacement writes objects before updating the profile reference; a reference-update failure does not roll back those writes. Clear updates the reference first and ignores object-deletion errors. The admin route inherits these limits: an error does not establish that nothing changed, and a successful clear does not establish that storage cleanup completed.

Rollout and rollback

  • inferred — Automation should check the capability flags before calling the new routes. API v2 checks the administrator and write-target authority at request time; WatchSync checks the target’s connection again when sending. Removing or rolling back the routes stops this entrypoint but does not undo saved allowances, dismissals, avatars, or provider changes. An operator reversing an action must inspect and correct the affected profile state and, where applicable, check the linked provider separately.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(api): manage another account's profile avatars, allowances and home cards" matches the main change. The changeset adds admin API operations under /api/v2/admin/users/{id}/profiles/{pro…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is related to the changeset. It explains that the PR adds admin API operations under /api/v2/admin/users/{id}/profiles/{profile_id}/ for managing a profile's avatar, title allowances, …
Full details: Title check

Explanation

The title "feat(api): manage another account's profile avatars, allowances and home cards" matches the main change. The changeset adds admin API operations under /api/v2/admin/users/{id}/profiles/{profile_id}/ for profile avatars, title allowances, and home dismissals. The title is specific and describes the primary change, so it passes.

Full details: Description check

Explanation

The description is related to the changeset. It explains that the PR adds admin API operations under /api/v2/admin/users/{id}/profiles/{profile_id}/ for managing a profile's avatar, title allowances, and home-card dismissals, and it lists the shared target handling, capability flags, validation, and risks. It is detailed and specific, so it is not vague or off-topic.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1793ce90-5a28-4eb7-bee2-e908e031733f
Commits

Reviewing files that changed from the base of the PR and between cdf344f and 9e87d80.

Files selected for processing: 27

  • contracts/api/v2/fixtures/admin_account_capabilities.json
  • contracts/api/v2/openapi.json
  • docs/admin-users-api.md
  • internal/api/handlers/access_filter.go
  • internal/api/handlers/home_dismissals.go
  • internal/api/handlers/home_dismissals_admin_test.go
  • internal/api/handlers/profiles.go
  • internal/api/handlers/title_allowances.go
  • internal/api/handlers/title_allowances_admin_test.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_account_home_dismissals.go
  • internal/apiv2/admin_account_home_dismissals_test.go
  • internal/apiv2/admin_account_household_test.go
  • internal/apiv2/admin_account_profiles.go
  • internal/apiv2/admin_account_target.go
  • internal/apiv2/admin_account_target_test.go
  • internal/apiv2/admin_account_title_allowances.go
  • internal/apiv2/admin_accounts.go
  • internal/apiv2/cursor.go
  • internal/apiv2/document.go
  • internal/apiv2/home.go
  • internal/apiv2/pilot_fakes_test.go
  • internal/apiv2/profiles.go
  • internal/apiv2/router_test.go
  • internal/apiv2/title_allowances.go
  • web/src/api/v2/operations.ts
  • web/src/api/v2/schema.ts

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

@coderabbitai coderabbitai Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase enhancement New feature or request go Pull requests that update go code javascript Pull requests that update javascript code labels Dec 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments

Minor 8
  1. Mark the home dismissal PUT as non-retryable.
  2. Qualify when playback ends a series drop.
  3. Preserve the documented allowance refusal codes.
  4. Replaying an undismiss after a newer drop can restore the wrong state.
  5. Return capability_unsupported for an unsupported allowance store.
  6. Preserve the documented unsupported-backend response.
  7. Remove the unsupported ETag and 412 guarantee.
  8. The new administrator home mutations declare natural retry safety but do not distinguish replaying an earlier decision from making a new one. A delayed PUT after the profile resumes watching refreshes the drop and hides the show again; a delayed DELETE can erase a newer drop. The administrator and the profile can act independently, and WatchSync can propagate the replayed state to the profile’s enabled providers. The self-service route already had these semantics; the PR newly exposes the retry contract to independent admin clients. Make the admin contract non-retryable after an uncertain response unless replay can be tied to the original operation or state version.
Trivial 1
  1. An administrator clearing an avatar and an account holder replacing it can operate on the same object keys. If the clear removes the reference, the replacement writes its objects and publishes its reference, and the clear then deletes the profile’s objects, the profile can point at an image that no longer exists. The same interleaving was possible between two self-service requests before this PR; the new route adds an independent writer. Marking the clear non-retryable helps with delayed retries but cannot stop cleanup from an already-running request. Scope cleanup to the cleared version or serialize replacement and cleanup per profile.
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1793ce90-5a28-4eb7-bee2-e908e031733f
Commits

Reviewing files that changed from the base of the PR and between cdf344f and 9e87d80.

Files selected for processing: 27

  • contracts/api/v2/fixtures/admin_account_capabilities.json
  • contracts/api/v2/openapi.json
  • docs/admin-users-api.md
  • internal/api/handlers/access_filter.go
  • internal/api/handlers/home_dismissals.go
  • internal/api/handlers/home_dismissals_admin_test.go
  • internal/api/handlers/profiles.go
  • internal/api/handlers/title_allowances.go
  • internal/api/handlers/title_allowances_admin_test.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_account_home_dismissals.go
  • internal/apiv2/admin_account_home_dismissals_test.go
  • internal/apiv2/admin_account_household_test.go
  • internal/apiv2/admin_account_profiles.go
  • internal/apiv2/admin_account_target.go
  • internal/apiv2/admin_account_target_test.go
  • internal/apiv2/admin_account_title_allowances.go
  • internal/apiv2/admin_accounts.go
  • internal/apiv2/cursor.go
  • internal/apiv2/document.go
  • internal/apiv2/home.go
  • internal/apiv2/pilot_fakes_test.go
  • internal/apiv2/profiles.go
  • internal/apiv2/router_test.go
  • internal/apiv2/title_allowances.go
  • web/src/api/v2/operations.ts
  • web/src/api/v2/schema.ts

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

Comment thread docs/admin-users-api.md Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments

Minor 3
  1. Preserve the documented unsupported-backend response.
  2. Remove the unsupported ETag and 412 guarantee.
  3. The new administrator home mutations declare natural retry safety but do not distinguish replaying an earlier decision from making a new one. A delayed PUT after the profile resumes watching refreshes the drop and hides the show again; a delayed DELETE can erase a newer drop. The administrator and the profile can act independently, and WatchSync can propagate the replayed state to the profile’s enabled providers. The self-service route already had these semantics; the PR newly exposes the retry contract to independent admin clients. Make the admin contract non-retryable after an uncertain response unless replay can be tied to the original operation or state version.
Trivial 1
  1. An administrator clearing an avatar and an account holder replacing it can operate on the same object keys. If the clear removes the reference, the replacement writes its objects and publishes its reference, and the clear then deletes the profile’s objects, the profile can point at an image that no longer exists. The same interleaving was possible between two self-service requests before this PR; the new route adds an independent writer. Marking the clear non-retryable helps with delayed retries but cannot stop cleanup from an already-running request. Scope cleanup to the cleared version or serialize replacement and cleanup per profile.
Outside diff 5
  1. Qualify when playback ends a series drop.
    contracts/api/v2/openapi.json, lines 23751 · 🎯 Functional Correctness · ⚡ Quick win
    A deployment can keep watch state in SQLite while using PostgreSQL for catalog and series-drop data. The drop query checks PostgreSQL watch progress, so playing another episode on that deployment does not restore the show. The schema field and the PUT and list descriptions should distinguish this case from PostgreSQL-backed watch state. Explicit undo works in both cases.
    Also applies to: 160998-160998
  2. Preserve the documented allowance refusal codes.
    contracts/api/v2/openapi.json, lines 159190 · 🗄️ Data Integrity & Integration · ⚡ Quick win
    If the account can see a movie but the target profile cannot reach its library, the handler returns no_library_access. The admin write callback passes it to serviceProblem, which returns a generic 422 validation_failed. The same mapper also drops no_maturity_limits and collection_not_live, so clients cannot distinguish these failures by the codes documented here. Map the allowance errors explicitly at the v2 boundary and keep successful writes at 204.
    Also applies to: 160065-160065
  3. Replaying an undismiss after a newer drop can restore the wrong state.
    contracts/api/v2/openapi.json, lines 160994 · 🗄️ Data Integrity & Integration · ⚡ Quick win
    The admin undismiss operation is declared natural_idempotent. That declaration says a replay is safe. The operation has no version input, and its handler deletes the dismissal row and undrops the series by key. If the first DELETE succeeds, the response is lost, and the profile drops the same series again, a delayed replay removes the newer drop. A replay before any new drop is a no-op, so the failure needs an intervening drop.
    The repository's rule for this pattern is non_retryable. Change the declaration at internal/apiv2/admin_account_home_dismissals.go:112 to that strategy, then regenerate contracts/api/v2/openapi.json. Editing the generated artifact alone does not fix the declaration.
  4. Mark the home dismissal PUT as non-retryable.
    contracts/api/v2/openapi.json, lines 161230 · 🗄️ Data Integrity & Integration · ⚡ Quick win
    If the first PUT drops a series but its response is lost, the profile can watch an episode and end the drop before the client retries. The series branch does not check the original progress stamp. It writes a new dropped_at, which makes the series disappear again. Even without intervening playback, the repeat refreshes the timestamp and dispatches another event. Mark dismissAdminUserProfileHomeItem as non_retryable at registration and regenerate OpenAPI. A deliberate new dismissal should still refresh the drop.
  5. Return capability_unsupported for an unsupported allowance store.
    web/src/api/v2/schema.ts, lines 15199 · 🗄️ Data Integrity & Integration · ⚡ Quick win
    On a SQLite deployment, the router leaves TitleAllowances unset. An admin allowance request then returns 503 dependency_unavailable with Retry-After: 30, not the documented 501 capability_unsupported. The response tells clients to retry a feature the configured store cannot support.
    Return and declare 501 for the unsupported-store case, and keep 503 for temporary failures. Regenerate OpenAPI and the web types from the corrected operation declarations.
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1793ce90-5a28-4eb7-bee2-e908e031733f
Commits

Reviewing files that changed from the base of the PR and between cdf344f and 9e87d80.

Files selected for processing: 27

  • contracts/api/v2/fixtures/admin_account_capabilities.json
  • contracts/api/v2/openapi.json
  • docs/admin-users-api.md
  • internal/api/handlers/access_filter.go
  • internal/api/handlers/home_dismissals.go
  • internal/api/handlers/home_dismissals_admin_test.go
  • internal/api/handlers/profiles.go
  • internal/api/handlers/title_allowances.go
  • internal/api/handlers/title_allowances_admin_test.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_account_home_dismissals.go
  • internal/apiv2/admin_account_home_dismissals_test.go
  • internal/apiv2/admin_account_household_test.go
  • internal/apiv2/admin_account_profiles.go
  • internal/apiv2/admin_account_target.go
  • internal/apiv2/admin_account_target_test.go
  • internal/apiv2/admin_account_title_allowances.go
  • internal/apiv2/admin_accounts.go
  • internal/apiv2/cursor.go
  • internal/apiv2/document.go
  • internal/apiv2/home.go
  • internal/apiv2/pilot_fakes_test.go
  • internal/apiv2/profiles.go
  • internal/apiv2/router_test.go
  • internal/apiv2/title_allowances.go
  • web/src/api/v2/operations.ts
  • web/src/api/v2/schema.ts

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

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude Code (claude-opus-5-5)

Review of head 9e87d80. The new routes keep the administrator's identity and check the target. A profile from another account answers 404 before any service runs, avatar and allowance services only look in the addressed account's store, and writes apply the Owner rule. The profile's own routes behave as before: the shared code was extracted without changing those paths. The findings below are mostly contract text that says something the code doesn't do. I'm fixing the first five in a commit on this branch, so there's no need to change them yourself. The last one predates this PR and goes to a separate fix.

Comment thread docs/admin-users-api.md Resolved
Comment thread docs/admin-users-api.md Resolved
Comment thread internal/apiv2/admin_accounts.go Resolved
Comment thread internal/apiv2/router_test.go Resolved
entries, cards, err := reg.deps.TitleAllowances.ListAllowedTitles(ctx, actor, t.ProfileID, after, in.Limit+1)
if err != nil {
return nil, serviceProblem(err)
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low, predates this PR, more reachable now: allowance writes lock accounts in two steps. changeAllowancesCount (internal/userstore/pgstore/allowances.go) takes KEY SHARE on the audit actors, then NO KEY UPDATE on the target account. That breaks the single id order auditmutation.ActorIDs asks for. Before this PR the actor differed from the target only under impersonation. On these routes they always differ. Example trigger: the Owner writes an allowance on admin A's profile while transferring ownership to A, with A's id lower than the Owner's. The transfer holds A and waits on the Owner; the allowance write holds the Owner and waits on A. Postgres aborts one of them with a deadlock error.

The repair is in pgstore, outside this PR's lines: lock the target and the actors one row at a time in id order, each in its own mode. I'm handling it in a separate PR rather than on this branch.

The allowance docs promised 501 capability_unsupported where the routes
answer 503 and the flag is false. The shared rules promised ETag checks no
route in this set has. The dismissal list described every stored Next Up
row as hiding a card, though one hides it only while that episode is the
show's next one. Also name the list in the home_dismissals flag and narrow
the contract leak check to the {profile_id}/home/ segment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Dec 5, 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 ❌

@Quick104

Quick104 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Claude Code (claude-opus-5-5)

Review summary

Fit: 8/10 · Readiness: 8/10 — conditional (assuming CI is green)

Reviewed head: 879e9f01f9 (the PR's 9e87d80 plus one review commit).

The routes are sound on access control. Each one resolves the account and profile from the path, answers 404 for a profile of another account before any service runs, and keeps the administrator as the request's identity. Writes apply the Owner rule. Comparing the contract as JSON, the generated files only add 9 paths and 3 capability fields; the large line counts come from the text diff realigning. The profile's own routes are unchanged: the shared code was extracted, and the household path takes the same branches as before.

Fixed on this branch (879e9f0)

  • The allowance docs and the title_allowances field doc promised 501 capability_unsupported. Without the PostgreSQL user store, the flag is false and the routes answer 503. They now say so.
  • The shared rules promised ETag checks and 412s, but no route in this PR has an ETag. The rule now covers cursors and the ETags of routes that return one.
  • The dismissal list described every stored Next Up row as hiding a card. A per-card row hides its card only while that episode is still the show's next one. The operation description, the handler comment and the docs now say that.
  • The home_dismissals flag doc now names listAdminUserProfileHomeDismissals.
  • The contract leak check strips only {profile_id}/home/, not every }/home/.

Verified with go test ./internal/apiv2/, the allowance and dismissal handler tests, and verify-apiv2-openapi, -web-types, -fixtures, -contract and verify-local-paths.

Handled outside this PR

These two were already on main and get their own PRs:

  • serviceProblem turns the allowance refusals no_maturity_limits, no_library_access and collection_not_live into a plain 422 validation_failed. The household routes already promise those codes, and this PR repeats the promise. fix(api): name the reason a title allowance is refused #5885 fixes it for the household routes with an allowance mapper, allowanceProblem, that keeps the 422 and adds a field error carrying the code. Whichever of the two merges second should switch this PR's allowance callbacks from serviceProblem to allowanceProblem, pointing the profile's errors at path.profile_id. Until then, these routes send a plain validation_failed, as the household routes do on main.
  • Allowance writes lock the audit actors and then the target account in two steps, not in one id order. When an administrator changes another account with a lower id, that can deadlock with a concurrent ownership transfer. Main already reaches it through the admin profile create and update routes, and these routes would reach it on every allowance write. Fixed in fix(api): lock the changed account and audit actors in one id order #5882.

For the maintainers

  • Retry safety of the admin dismiss and undismiss. They are declared naturally idempotent, matching dismissHomeItem and undismissHomeItem. A delayed replay can re-drop a show the profile has resumed, or remove a newer drop, as it already can on the profile's own routes from a second device. Changing it here alone would make the two routes disagree.
  • Copying another profile's private collection. An administrator can copy the titles of any personal collection on the account, including one its creator hasn't shared. The docs say so; the household manager can't do this.
  • Avatar clear racing an upload. A clear and a concurrent upload can leave a profile pointing at deleted objects. This was already possible between two of the account's own devices; these routes add a second writer.
  • The dismissal list is not paged. Rows are few in practice: one per dropped show, plus only the Continue Watching cards still held. Adding a cursor later is additive.
  • No series-drop wording change. The bot's note that a drop doesn't end on playback when watch state is in SQLite describes the existing drop behavior. These routes don't change it.

Checks

  • Validated features: no passed case on the v1.0 board reaches this code, so Validation tasks: none is correct. The shared helpers this PR touches (avatar upload, dismissal command, allowance access) keep their old behavior when no admin is acting.
  • User manual: unaffected. No manual page covers these routes; the API reference comes from the contract.
  • Other clients: none. These are admin operations no client calls yet.
  • Tests: the new tests call code this PR adds, so none could fail on the base. The behavior evidence is the PR's own end-to-end run on a sandbox. I didn't repeat it live, which is what holds Readiness at 8.
  • Council (round 1, head 9e87d80): Sol (gpt-6.2-sol, medium) 6/10; Opus (claude-opus-5-5, medium) 8/10; Gemini (gemini-4-neon, medium) 8/10. The fixes above changed only text and the test scrub, so there was no second round.

Why these scores. Fit 8: the routes sit on the existing /admin/users boundary, reuse the profile's own services, and are capability-flagged. Being new admin surface, they can't score higher in this release. Readiness 8: the defects introduced here are fixed and the remaining risks predate the PR. What's missing is a live check of the final head in this review.

…ator (#5874)

* feat(api): read and change another account's settings as an administrator

Add admin operations for one account's settings: effective settings for
the account or one of its profiles, an all-or-nothing batch write of up to
200 values, scope/profile/key filters on the settings list, adding or
removing one navigation shortcut of a profile, and the account's plugin
settings. Plugin secrets are never returned: reads list which secrets are
set, and a write keeps or clears them inside the store transaction.

A setting identity member the key's scope does not use is refused with 422
at that member instead of silently writing the broader value. Saving a
profile's own plugin settings now answers 500, not 422, when the store
fails.

New capability flags: settings_effective, settings_batch,
settings_filters, navigation_shortcuts, plugin_settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api): keep undeclared plugin values on an administrator's write

An administrator's plugin settings write deleted every stored value the
current schema no longer declares. The admin read withholds those values
because one may be a credential under a renamed key, so the write removed
data the administrator was never shown. The admin write now keeps them;
the account's own save is unchanged.

Also: the plugin write's description names the checks it runs, the batch
all-or-nothing test checks every entry of a refused batch, and the
profile's own settings handlers reuse the converters the admin operations
added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Dec 5, 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 ❌

@Quick104
Quick104 merged commit d55d6ea into main Dec 5, 2026
20 checks passed
@Quick104
Quick104 deleted the feat/admin-profile-api-household branch December 5, 2026 20:13
Quick104 added a commit that referenced this pull request Dec 5, 2026
Main took #5873 and #5874 as one squash commit, so the merge applies main's
changes since the settings branch tip (387d3c1) onto this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase enhancement New feature or request go Pull requests that update go code javascript Pull requests that update javascript code size/XXXL 3000+ added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant