Skip to content

feat(requests): give admin accounts unlimited media requests - #5926

Open
Rhainland wants to merge 1 commit into
Silo-Server:mainfrom
Rhainland:feat/admin-unlimited-requests
Open

Rhainland wants to merge 1 commit into
Silo-Server:mainfrom
Rhainland:feat/admin-unlimited-requests

Conversation

@Rhainland

@Rhainland Rhainland commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A (idea: Discussion #5925)
Validation tasks: changes #1202 C1; changes #1203 C1

Other clients: Apple N/A (no client change; titles stay requestable for admins because the server decides); Android N/A (same); Roku N/A (same)

Server admins hit the same media request quota as every other account. With the default of 5 requests per 7 days, an admin who has made five requests can't request another title until the window passes, unless someone has set that admin's own account limit to unlimited. This change exempts admin accounts from the quota, for direct requests and watchlist requests alike, and the web admin now shows their limit as unlimited.

Approach

requests.LayeredPolicy resolves an account's server, group and account request settings, and both readers of request authority use it: live requests (resolvePolicy) and the backup restore check (requestsWider). It now takes the account's admin role and marks an admin's policy unlimited after the layers are applied. Every path that checks the quota reads that policy: request creation, watchlist requests, a title's request state, and the admin usage view.

Only the quota changes. Requests turned off server-wide, the account's requests switch, an account-level blocked mode, approval, and duplicate checks still apply to admins.

The web admin mirrors the server's resolution in resolveRequestTerms, which now reports an admin account's limit as unlimited. When editing an admin account's Requests card, the limit field is hidden because no limit applies. A saved account limit stays in the database and applies again if the account stops being an admin. The change adds no UI strings.

This changes two validated cases on purpose. #1202 C1 ("Enforce request limits") and #1203 C1 ("configure per-user limits") still hold for every account except admins. Their results don't say whether the limited accounts were admins; a re-test that uses an admin account will now see no limit, and the web admin no longer offers a limit for admin accounts.

Validation

  • Go: a table test in internal/requests checks that an admin's policy is unlimited under server, group and account quotas, and that an account block still blocks an admin. It fails without the change.
  • Full pre-PR gate from CONTRIBUTING.md: all passed. verify-actionlint, verify-shellcheck and verify-prometheus-rules were not run because no workflow, script or rule changed.
  • Web admin, by hand: ran this branch and origin/main against fresh databases with requests on and the default quota, signed in as the admin, and compared the Requests card, its editor, and the Overview tab at desktop and phone width (captures below).
  • Code review: the dual review described under AI Disclosure.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-5926/

Surface and build: web admin (Admin → Users → admin account), desktop 1440 px and phone 390 px. Before: origin/main at 835131f. After: this branch at 4a823a1.

Risks

An admin's saved account limit no longer has any effect while the account is an admin. Admins who relied on a quota to slow down their own requests lose that; the requests switch and approval remain for that. No migration or API contract change.

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 (in T3 Code)
  • Tool(s): Claude Code, Codex CLI, Playwright
  • Model(s): claude-opus-5-5 (implementation and review), gpt-6.2-sol (review via Codex CLI)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: two independent reviews (claude-opus-5-5 and gpt-6.2-sol) of the branch diff on correctness, standards and spec, then of the later editor change. Fixed: the web admin still showed a quota for admins; the architecture doc described the old rule; the editor offered a limit for admins that no longer applied. Dismissed: separate backup and request-creation tests (the behavior is covered once, through LayeredPolicy), a parameter struct for LayeredPolicy (two callers), and a role change made mid-edit from another device.

Note

Give admin accounts unlimited media requests

  • Admin users now bypass all quota layers (server, group, account) and receive unlimited request policies in both backend and web resolution. Blocking and approval rules still apply.
  • LayeredPolicy in service.go takes an admin flag and sets the policy's unlimited flag; the live resolver skips the request-count store for admins.
  • resolveRequestTerms in requestAccess.ts accepts a role and replaces the resolved quota with an unlimited one for admins. The admin editor hides quota inputs via the new showLimit prop on RequestLimitFields.
  • Adds table-driven tests in group_limits_test.go covering server, group, account quotas and account-level blocking for admins.
  • Behavioral Change: admin usage is not counted toward quotas; account-level block modes still block admins. Backup request-policy evaluation in credentials_authority.go mirrors the new behavior.

Macroscope summarized 4a823a1.

Server admins no longer hit the server, group, or account request quota.
LayeredPolicy marks an admin's policy unlimited, so request creation,
watchlist requests, title request state, the admin usage view and the
backup authority check all agree. An account block, the requests switch
and approval still apply to admins.

The web admin shows an admin account's limit as unlimited and hides the
limit field when editing one, since no limit applies.
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Dec 6, 2026
@silo-kody

silo-kody Bot commented Dec 6, 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 Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Admin request policies now use unlimited quotas across backend and web resolution. Existing blocking and approval behavior remains. Admin user screens hide quota controls, and the architecture documentation describes the policy.

Changes: Admin Request Policy

Layer / File(s) Summary
Backend request policy
internal/requests/group_limits.go, internal/requests/service.go, internal/requests/group_limits_test.go, internal/backup/credentials_authority.go, docs/architecture/media-requests.md
The backend passes admin status into layered policy resolution and marks admin policies as unlimited without clearing blocks. Tests cover server, group, and account quotas, plus account blocks. The documentation describes the quota exemption and retained blocking rules.
Web request terms and admin controls
web/src/lib/requestAccess.ts, web/src/pages/admin-users/detail/access/RequestsCard.tsx, web/src/components/admin/RequestLimitFields.tsx
Web request-term resolution sets admin quotas to unlimited and preserves approval resolution. Admin user screens pass the role into resolution and hide quota fields while retaining approval controls.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested labels: enhancement

Suggested reviewers: quick104

Merge Risk: Minimal · up to 4a823

Server admins are exempted from request quotas while request switches, blocks and approval rules still apply. No concrete merge-blocking risk was found in the changed backend policy, the web resolver or the admin editor.

Security architecture risk: Low · up to 4a823

Removing the quota for server admins is intentional, including for automatic watchlist requests. Server-wide disablement, the account requests switch, explicit blocks, approval, and duplicate checks still apply. The remaining risk is narrow: a request already in flight can use an admin exemption it read just before the account was demoted.

Retained concerns

  • Trivial · security · inferred: A demotion does not fence a create that already resolved the account as an admin. If the role change commits after that read but before the request write, the repository can still accept the create without checking the reinstated quota. At the merge base, an admin with a finite quota still had that quota checked in the write transaction. Fresh policy reads enforce the post-demotion terms, and the queued watchlist loop rereads policy for each candidate, so the exposure is limited to already-resolved creates, not the rest of the queue.

View findings in the submitted review

Security review details

Security Blast Radius

  • inferred — An eligible server-admin account can create more distinct direct or watchlist requests than its old quota allowed. If auto-approval is enabled, more requests can reach fulfillment without manual approval. That volume increase is inherent in the intended exemption; it does not grant quota relief to other accounts or remove duplicate protection.

Security Findings and Attack Paths

  • inferred — A formerly capped admin can have a create admitted under the old role if demotion overlaps the interval between policy resolution and persistence. Session revocation in the inspected demotion path does not revalidate a create that has already passed policy resolution. There is no new path here for an account already read as non-admin to select unlimited status.

Trust Boundaries and Controls

  • observed — The subject account’s server-side user record, not submitted media fields or the web editor, determines the exemption. The create path separately gates profile access and content eligibility, and the layered quota override does not clear request blocks or change approval.

Public contracts

  • observed — The request-usage API reports the subject account’s effective unlimited policy rather than a finite usage allowance for admins. The Go policy resolver now requires callers to supply admin status.

Dependencies

  • observed — Backup credential carry uses the same request resolver as live enforcement. It compares a repeatable-read snapshot of live credentials and their authority with staged restored authority, after preserving stricter switches and before writing carried credentials. It compares against that snapshot, not a fresh live read at cutover.

Data and control flow

  • observed — The service resolves the caller account’s terms, checks enablement and blocking, and chooses pending or approved status. The repository commits the request and its events before the service dispatches an auto-approved request. Unlimited status removes the quota check, not those other steps.

Resilience and Maintainability Implications

  • inferred — After demotion, fresh policy reads resume counting qualifying requests in the applicable window, including rows created while the account was exempt. The exemption skips enforcement and usage calculation while active; it does not erase request history or give the account a clean quota window on demotion. This recovery does not stop a write already admitted under the old policy.

Rollout and rollback

  • inferred — Operators who used a finite or zero quota to constrain an admin must use the account requests switch to stop that account, or server-wide disablement to stop requests globally. The request service checks those controls during creation; the upgrade does not turn a zero quota into a block. Returning to merge-base code restores quota enforcement but does not undo requests already committed or sent for fulfillment.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(requests): give admin accounts unlimited media requests" matches the main change: admin accounts are exempted from the media request quota via LayeredPolicy and the web admin shows the…
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 specific and related to the changeset. It explains that server admin accounts are now exempt from the media request quota, and it names the changed code paths. It covers the Layered…
Full details: Title check

Explanation

The title "feat(requests): give admin accounts unlimited media requests" matches the main change: admin accounts are exempted from the media request quota via LayeredPolicy and the web admin shows their limit as unlimited. It is specific and conventional, and it does not describe anything absent from the changeset.

Full details: Description check

Explanation

The description is specific and related to the changeset. It explains that server admin accounts are now exempt from the media request quota, and it names the changed code paths. It covers the LayeredPolicy admin flag, resolveRequestTerms with a role, the showLimit prop in the admin editor, the table tests in internal/requests, and the backup restore check. It also states the behavior that still applies to admins: blocking, approval, and the requests switches. It includes validation steps, evidence, risks, and the effect on validated test cases.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@silo-triage silo-triage Bot added enhancement New feature or request go Pull requests that update go code javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish labels Dec 6, 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

Trivial 1
  1. A demotion does not fence a create that already resolved the account as an admin. If the role change commits after that read but before the request write, the repository can still accept the create without checking the reinstated quota. At the merge base, an admin with a finite quota still had that quota checked in the write transaction. Fresh policy reads enforce the post-demotion terms, and the queued watchlist loop rereads policy for each candidate, so the exposure is limited to already-resolved creates, not the rest of the queue.
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: a71ac767-93c6-4ea6-ab8d-89e258e3f463
Commits

Reviewing files that changed from the base of the PR and between 835131f and 4a823a1.

Files selected for processing: 8

  • docs/architecture/media-requests.md
  • internal/backup/credentials_authority.go
  • internal/requests/group_limits.go
  • internal/requests/group_limits_test.go
  • internal/requests/service.go
  • web/src/components/admin/RequestLimitFields.tsx
  • web/src/lib/requestAccess.ts
  • web/src/pages/admin-users/detail/access/RequestsCard.tsx

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

@Rhainland

Copy link
Copy Markdown
Contributor Author

Re CodeRabbit's trivial note on a demotion racing an in-flight create: leaving this as is. The same window already exists for any account whose limit changes from "No limit" to a custom one mid-create; at most that one request skips the quota, and every later request reads the new policy. Fencing it would mean re-reading the role inside the write transaction, which is more than a one-request window warrants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant