Skip to content

feat(settings): let an administrator set the Next Up defaults for profiles - #2674

Merged
Quick104 merged 3 commits into
codex/silobot-2358-14366813from
feat/2661-next-up-admin-defaults
Oct 20, 2026
Merged

Quick104 merged 3 commits into
codex/silobot-2358-14366813from
feat/2661-next-up-admin-defaults

Conversation

@Quick104

@Quick104 Quick104 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #2661
Related issue: #2358
Validation tasks: none

An admin can't choose how Next Up works for the people on their server. Next up episodes and Show new episodes first can only be set per profile, so every profile that never opens Settings > Home Screen gets Silo's built-in values (With Continue Watching, off). An admin who wants a separate Next Up row, or new episodes first, has to change each profile by hand, and new profiles start from the built-in values again.

This lets an admin set server-wide defaults for both settings on Admin > Home Sections. Profiles without their own value follow them on Home, on library pages, and in Jellyfin apps' Next Up. A profile's own choice, including With Continue Watching or off, still wins, and Use server default on Settings > Home Screen returns a profile to inheriting.

Stacked on #2365, which adds the admin_default settings-contract field this uses. Review that one first; this PR's diff is against its branch.

Approach

  • Contract. ui.next_up_mode and ui.next_up_new_releases_first declare admin_default (manifest revision 22). The admin's values are the server settings defaults.ui.next_up_mode and defaults.ui.next_up_new_releases_first, written and validated through the existing admin settings API, as feat(settings): let an administrator set the default for title art #2365 does for title art. Effective reads keep reporting source: "default" for an inherited value.
  • Server. Next Up is decided on the server, while it builds the viewer's access scope on nearly every authenticated request, not in the settings-values handler feat(settings): let an administrator set the default for title art #2365 wired. So each node now has one shared snapshot of the admin's defaults (config.AdminDefaults), built in cmd/silo and passed to every resolver that reads these keys: the access and policy scope resolvers, home sections, progress sync, jellycompat's /Shows/NextUp ordering and scope resolvers, and the settings-values handler (which now shares it instead of feat(settings): let an administrator set the default for title art #2365's per-request read).
    • It reads every default in one query and serves a fresh snapshot without a lock. A loop refreshes it every half TTL whether or not anything reads it. At most one refresh runs at a time; a failed read keeps the last good snapshot and retries after a short delay.
    • An admin write reloads the writing node's snapshot before clients are told to re-read, and a read that started before the write can't publish over it. Other nodes reload on the admin settings_changed event, and the refresh loop covers a node that missed it.
  • Web.
    • Admin > Home Sections gets a "Next Up defaults for every profile" card under the rows. Each control saves as it changes, like the rows above it.
    • Settings > Home Screen says "Using the server default (…)" under a setting the profile hasn't chosen. Next up episodes' Reset becomes Use server default, and Show new episodes first gets the same button.
    • Home and library rows now refresh when either setting changes, and a Next up episodes change refetches an open Home's layout so the Next Up row appears or goes. Before, changing your own Next up episodes didn't refresh Home until it went stale.
    • Because the cross-node event and the client event travel separately, the web client re-reads a server-default change once more after the TTL.

The admin control sits on Home Sections rather than next to title art on Appearance, because that page already owns what every profile sees on Home.

Native apps need no change. Neither the iOS nor the Android app has a Next Up setting; both show the rows the server builds, so they follow the admin's default as soon as it is set.

Validation

  • Built and ran on a fresh dev sandbox from this branch's head:
    • With no admin default, both settings resolved to the built-in values from default, and Home had no Next Up row.
    • After the admin chose Separate row, the effective value read separate from default straight away, and the Home layout gained a next_up row after Continue Watching, which now held only in-progress titles.
    • A profile value of combined won (no Next Up row); deleting it went back to the admin's value.
    • The new-episodes default resolved true from default.
    • off, a string, and 1 were each rejected with 422.
  • On a fresh sandbox at the follow-up commit, Home open in one tab showed the Next Up row 31 ms after the admin chose Separate row in another tab, without a reload.
  • In the browser: the admin set both defaults on the new card, and a Settings > Home Screen tab already open in another window showed the inherited values without a reload. Home showed the separate Next Up row. The profile's own With Continue Watching put the episodes back in Continue Watching, and Use server default restored the admin's choice. Desktop and phone width, no console errors.
  • Go: tests for the touched packages pass, including race-detector runs of the snapshot's concurrency tests. make lint-changed reports 0 issues.
  • Web: tsc -b, eslint and prettier on changed files pass. The web suite passes except one PGS decoder test that timed out under full-suite load; it passes on its own and this change doesn't touch it.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/issue-2661/

Risks

  • Cross-node lag. On a multi-node server, a node other than the writer can serve the previous default for up to 10 seconds, and a client of that node can re-read inside that window. The web client re-reads once more after the TTL; docs/settings-api.md says the same for other clients.
  • Hot path and background work. The viewer scope now consults the snapshot on every request; a fresh snapshot costs an atomic load. Each node runs one indexed server_settings query every 5 seconds to keep it fresh, including on an idle single node.
  • Title art. feat(settings): let an administrator set the default for title art #2365's settings-values handler switches from a per-request read to the shared snapshot. On a single node, nothing changes, because writes reload it. On other nodes, title art follows the same 10-second bound.
  • /api/v1 bridge. v1 shares the resolver, so v1 clients also see an admin default once one is set. Nothing changes on a server that sets none.

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.

Follow-ups: none for silo-apple or silo-android (neither app has a Next Up setting). User manual: Silo-Server/siloserver.org#233, draft docs PR Silo-Server/siloserver.org#234.

AI Disclosure

  • Harness: Claude Code in T3 Code, running the /silo workflow
  • Tool(s): Claude Code subagents for code review; Codex through T3 Code for the cross-provider plan review; Playwright (capture-web) for browser captures
  • Model(s): claude-opus-5-5 (implementation and review), claude-sonnet-5-5 (review subagents), gpt-6.1-sol (plan review)
  • Involvement: Fully AI-generated; human verification pending
  • Adversarial review:
    • A cross-provider plan review (Codex gpt-6.1-sol) moved the design from a per-resolver cached read to one shared snapshot. It also asked that the snapshot reload in step with the settings event, and that Home and library rows refresh on both keys. All were adopted.
    • A multi-agent code review covered line-by-line, contract and clients, failure and scale, altitude, cleanup, and the v1.0 validation board. It found that concurrent requests could each start a refresh, that a read started before an admin write could publish over a failed reload, that refresh ran on the request path, and that other nodes' clients could re-read before their node reloaded. All are fixed and re-verified.
    • A background adversarial review (Codex gpt-6.1-sol, reviewed ae8cbcc) posted two findings. A Next up episodes change didn't refetch an open Home's layout. An idle node that missed the admin event refreshed only on the client's delayed re-read and returned the old snapshot to it. Both are fixed in 319662e.
    • A follow-up /silo review of 319662e (Claude Code subagents on claude-opus-5-5 and claude-sonnet-5-5, plus one Codex gpt-6.1-sol round with no findings) found four minor issues: flaky snapshot tests, the refresh loop polling on transcode and proxy nodes, an overstated staleness bound in the docs, and a duplicated web invalidation list. All four are fixed in 720da70.

🤖 Generated with Claude Code

Note

Add administrator-settable defaults for Next Up mode and release ordering

Adds server-wide Next Up defaults (ui.next_up_mode, ui.next_up_new_releases_first) that apply when a profile has no stored preference. Explicit profile choices always win.

  • New config.AdminDefaults shared per-node cache (admin_defaults.go): batch-loads all admin-default keys in one settings read, serves a 10-second snapshot, keeps stale values during failed refreshes with 5-second backoff, refreshes in the background, and reloads immediately on settings-changed events with generation fencing.
  • Admin UI card on Home Sections page (AdminNextUpDefaultsCard.tsx) saves each default as JSON text under its defaults. server key.
  • Profile Home Screen settings now label inherited values and offer a "Use server default" action that deletes the stored profile choice.
  • Web client refreshes effective values, Home, and library queries on admin-default changes, with a second refresh after 11 seconds to let the server snapshot settle.
  • Settings contract revision bumped 21 → 22; the two settings are marked adminDefault in the manifest and contract definitions.
  • Risk: NextUpMode and NextUpNewReleasesFirst resolvers, ResolveViewerPreferences/Strict, and ViewerResolver.Resolve gained a ServerSettings parameter — external callers of these signatures must pass nil or a provider. progresssync scope resolution now goes through the configured resolver instead of direct preference resolution.

Macroscope summarized 720da70.

…files

ui.next_up_mode and ui.next_up_new_releases_first declare admin_default
(manifest revision 22). Profiles without their own value follow the
administrator's choice on Home, library pages and Jellyfin /Shows/NextUp;
a profile's own value still wins.

One per-node config.AdminDefaults snapshot serves every resolver: one query
for all defaults, lock-free reads while fresh, one refresh at a time (in the
background once a snapshot exists), last good value on failure with a retry
delay. Admin writes reload it before the client event and fence off older
reads; other nodes reload on the admin settings_changed event, with a 10 s
TTL as the backstop.

Admin > Home Sections gets a card for both defaults; Settings > Home Screen
names the inherited value and offers Use server default for both settings.
Web Home and library rows now refresh when either Next Up setting changes,
and a server-default change is re-read once more after the server TTL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dcce98df-f771-49db-8217-df3571e851aa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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 size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. 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 stacked Base is another open PR; merge in stack order named in the body labels Oct 18, 2026

@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.

Adversarial review (gpt-6.1-sol, reviewed ae8cbcc)

Two verified findings, detailed inline.

AI disclosure: T3 Code through the Codex harness; model gpt-6.1-sol.

Comment thread web/src/hooks/queries/settingValues.ts Resolved
Comment thread internal/config/admin_defaults.go Resolved
…s layout

The admin defaults snapshot now refreshes every half TTL in the background,
so a node that missed another node's change event converges within the TTL
even while idle; before, the web client's delayed re-read only started the
refresh and got the old snapshot back.

A Next up episodes change now refetches a mounted Home's layout before its
rows reload, so switching to a separate row shows the Next Up row instead of
only removing the episodes from Continue Watching.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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.

Review of 319662e: four findings, all minor. I'm fixing each in a commit on this branch, so there's no need to change them yourself. A summary with scores follows once the fixes are pushed.

Comment thread internal/config/admin_defaults_test.go Resolved
Comment thread cmd/silo/main.go Resolved
Comment thread docs/architecture/settings-contract.md Resolved
Comment thread web/src/hooks/queries/settingValues.ts Resolved
… tests

- Start AdminDefaults.Run after the proxy/transcode return, so stream nodes
  that never resolve viewer settings stop querying server_settings every
  5 seconds.
- Wait for a refresh to publish before asserting on the snapshot in the
  AdminDefaults tests; the fake reader reports a read done before the
  snapshot is stored, which failed 3 of 900 runs under -race.
- Say the 10-second staleness bound holds while a node can read its
  settings.
- Reuse refreshForSettingChange in invalidateSettingValueQueries instead
  of a second copy of the same invalidations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104

Copy link
Copy Markdown
Contributor Author

Review summary

Reviewed 319662e; fixes pushed in 720da70.

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

Addressed

Four minor findings, each fixed in 720da70 and resolved in its thread:

  • Flaky tests. The new AdminDefaults tests asserted on the snapshot before the refresh had stored it. Under -race, 3 of 900 runs failed. The tests now wait for the refresh to publish, and 900 runs per test pass.
  • Polling on stream nodes. AdminDefaults.Run started on transcode and proxy nodes, which never resolve viewer settings, and queried server_settings every 5 seconds for nothing. It now starts only on nodes that serve the API.
  • Docs. The 10-second staleness bound holds only while a node can read its settings. Both docs now say so.
  • Cleanup. invalidateSettingValueQueries reuses refreshForSettingChange instead of keeping a second copy of the same invalidations.

Checked and not changed

  • Write paths. Every admin write path for defaults.* (single, bulk, clear, and the v2 writer, which shares the handler) reloads the writing node's snapshot before the client event goes out.
  • Shared instance. Every viewer resolver and sections fetcher that reads Next Up gets the shared instance. That includes the jellycompat /Shows/NextUp ordering and scope resolvers.
  • Cross-node ordering. The client event and the admin-channel reload travel on separate channels, so a client of another node can re-read before that node reloads. Only the web client refetches on that event, and it re-reads after the TTL. The Apple and Android apps don't refetch Home on user_settings.changed, so they pick the value up on their next load. If a third-party client ever depends on the event, the cleaner fix is on the server: reload the snapshot before relaying a scope: "default" event to local subscribers. That would also let the web client drop its 11-second re-read.
  • Opt-in wiring. Each resolver opts in to admin defaults with WithAdminDefaults. A future key that declares admin_default and is read through a resolver without it would get the contract default. The settings-contract doc says this, but nothing enforces it. Worth revisiting if more keys gain admin defaults.
  • Upgraded profiles. A profile whose household saved the legacy next_up_mode already has a profile-scope value from the retired-settings migration. It keeps that value and needs Use server default to follow the admin.

Remaining

  • This PR is stacked on feat(settings): let an administrator set the default for title art #2365, which has to merge first.
  • Multi-node propagation is verified by source and unit tests only, not on a multi-node deployment.
  • The fixes in 720da70 were verified with tests, go vet, and make lint-changed, not on a sandbox. They change no user-visible behavior, so the published evidence still matches.

Validated features

No passed case on the v1.0 board reaches this change. Person browsing (#1143) and server branding (#1227–#1229) share code paths, but their keys declare no admin_default, so they resolve as before. Validation tasks: none is correct.

User manual

Covered by Silo-Server/siloserver.org#233 and draft docs PR Silo-Server/siloserver.org#234. The fixes here don't change what they describe.

Apple and Android

Neither app has a Next Up setting, and both show the rows the server builds, so no app change is needed. Their copied settings-manifest test fixtures will pick up revision 22 on their next sync.

Scores

Cross-provider review: Codex (gpt-6.1-sol, one round on 319662e) reported no findings. The four findings above came from a multi-agent code review on Claude Opus 5.5 and Sonnet 5.5, each checked against the source and confirmed by test or trace.

@Quick104
Quick104 merged commit bec1a26 into codex/silobot-2358-14366813 Oct 20, 2026
28 checks passed
@Quick104
Quick104 deleted the feat/2661-next-up-admin-defaults branch October 20, 2026 01:10
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/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant