Skip to content

feat(config): set backups, Discord, MDBList and more from the environment - #4665

Merged
Quick104 merged 4 commits into
mainfrom
feat/env-settings-more
Nov 20, 2026
Merged

Quick104 merged 4 commits into
mainfrom
feat/env-settings-more

Conversation

@Quick104

@Quick104 Quick104 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Discussion: #4653 (configuring Silo entirely from the deployment)
Validation tasks: none

Other clients: Apple N/A (no admin settings screen); Android N/A (no admin settings screen); Roku N/A (no admin settings screen)

A deployment kept in Compose, Kubernetes or NixOS files still needed the web admin for several common server settings. This change lets thirteen more be set from environment variables, through the table #4498 added: the nightly backup schedule and contents, the Discord application, the MDBList key, the Meilisearch index, the web media origin, the prepared-download budget and realtime library monitoring.

Approach

New rows in internal/config/env_settings.go, all stored for the cluster like the existing ones:

Variable Setting
SILO_WEB_MEDIA_URL server.web_media_url (no web admin field)
SILO_MEILISEARCH_INDEX catalog.search.meilisearch.index
SILO_MDBLIST_API_KEY mdblist.api_key
SILO_DISCORD_CLIENT_ID, SILO_DISCORD_CLIENT_SECRET, SILO_DISCORD_BOT_TOKEN discord.*
SILO_DOWNLOAD_ARTIFACT_MAX_BYTES download.artifact_max_bytes
SILO_SCANNER_REALTIME_MONITORING scanner.realtime_monitoring
SILO_BACKUP_ENABLED, _TIME, _KEEP, _INCLUDE_SUBTITLES, _INCLUDE_INTRO_FINGERPRINTS backup.*

Each passes the checks an admin save runs, and an admin save of it is refused while the variable is set. None of these settings has a save hook or a dedicated write route that the table would bypass. Settings with one stay out: the Jellyfin web install, the backup destination and its S3 credentials, and Simkl and IntroDB, which plugins now serve.

The backup taken before migrations runs before startup stores the environment's values, so it reads SILO_BACKUP_ENABLED directly, on API servers and in silo --migrate-only. Otherwise SILO_BACKUP_ENABLED=false, added in the same deploy as an upgrade, would not skip that backup. The other SILO_BACKUP_* values wait for startup, so a lower SILO_BACKUP_KEEP can't rotate copies away before the migrations succeed.

Web admin shows each field read-only with the variable's name, as it does for the existing variables:

  • LimitField gains the managedByEnv prop the other fields have.
  • A disabled secret field no longer tells the admin to type a replacement.
  • The MDBList tile and the Discord card hide Save when the environment sets everything they would save.
  • The Discord card leaves env-set keys out of its saves and its clear action, which the server would refuse.

Validation

  • Go: build, gofmt, go vet, make lint-changed, and the handlers, config and cmd/silo tests pass. CI runs the full gate.
  • Web: typecheck and production build, eslint, prettier, and the settings component and page tests pass.
  • New tests:
    • the thirteen variables are read and checked as an admin save checks them, and an invalid value stops startup naming its variable (fails on main, where they are ignored);
    • the backup taken before migrations reads SILO_BACKUP_ENABLED over the stored value, and keeps the stored retention.
  • Live, before: a dev deployment ran with all thirteen variables set. On main they were ignored: managed_by_env_vars listed only Redis, and every field stayed editable with stored defaults.
  • Live, after: on this branch all thirteen are listed with their variables and stored, the three secrets encrypted, and an admin save returns 422. Each field shows read-only with the variable's name at desktop and phone widths, including a disabled toggle that is on and a Discord card where only the client ID comes from the environment.
  • Not checked live: the Meilisearch index field in the web admin, which shows only when Meilisearch is the search provider (its value and lock were checked through the API), and the backup before migrations, which unit tests cover.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/env-settings-more/

Surface and build: web admin Backups, Downloads, Library, Providers and Notifications pages, and the admin settings API, captured at 44b3641a. Later commits change nothing those captures show: the hidden replace hint limited to env-set secrets, the backup before migrations, Discord and MDBList drafts typed before the environment took their key, and the index field when the settings status can't be read.

Risks

  • Stored for the cluster. Like the existing stored variables, these values are written for every server, and every API server should have the same ones; the last to start wins.
  • Lock is per server. A server started without the variable accepts an admin save of that key.
  • Removing a variable leaves its last value stored and editable.
  • Selective restore. Restoring a page that holds a key the environment sets fails for the whole page. This already happens on main for the existing variables, and a separate change fixes it for all of them.

User manual: Silo-Server/siloserver.org#406 now lists the new variables and the pages they touch; the variable table itself is in the open docs PR Silo-Server/siloserver.org#440.

Follow-ups (pre-existing on main, found in review): the backup task's schedule can drift from backup.time through the task editor or a missed event, and the shared settings form submits a draft for a field the environment took over mid-edit. Each has its own change in progress.

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.

Council review

Rounds: 2, last reviewed c7622a0

Member Round 1 Round 2
Sol (gpt-6.2-sol, xhigh) 6/10 8/10
Opus (claude-opus-5-5, high) 9/10 8.5/10
Gemini (gemini-4-neon, xhigh) 9/10 8.5/10

Round 1 fixed: the migration job ignoring SILO_BACKUP_ENABLED, SILO_BACKUP_KEEP rotating copies before migrations succeeded, Discord drafts for keys the environment took over, the index field when the settings status fails, the backup docs, and a duplicate test. Round 2 fixed (74d5ebe): Discord and MDBList drafts for a key the environment took over are now ignored where they are read, not only in saves; Save stays disabled when nothing editable changed; one read of SILO_BACKUP_ENABLED for every server that migrates; the backups doc and a test comment. Answered as the same on main, each fixed separately: the task editor and missed events moving the backup schedule, and the shared form submitting a newly locked draft. Answered without a change: a failure preparing the backup before migrations stops startup even with backups off, as a stored false does, and the Discord card stays editable when the settings status can't be read, as the SMTP fields on that page do.

Visual review: 2 rounds, captures from 44b3641a

Member Round 1 Round 2
Sol better, 7.5/10 better, 8/10
Opus better, 7.5/10 better, 8/10
Gemini better, 7/10 better, 8/10

Fixed: the replace hint on an env-set secret, Save shown with nothing to save, the bright Unlimited label beside a disabled limit. Answered (same on main): disabled-control contrast and the shared note's wrapping, the backups schedule copy, the MDBList "Editing" pill and test sentence, decimal GB for a byte budget, and the "Clear credentials" wording when only some Discord keys come from the environment.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code subagents, Codex and Antigravity (council members), Playwright (headless Chromium), GitHub CLI
  • Model(s): claude-opus-5-5 (implementation, code review), claude-sonnet-5-5 (code-review cleanup finder and validation check), gpt-6.2-sol and gemini-4-neon (plan and visual review)
  • Involvement: Fully AI-generated, directed by the maintainer; not yet human-reviewed
  • Adversarial review:
    • Plan round (Sol, Opus, Gemini) cut the candidate list to settings with no save hooks. Simkl and theme keys have no reader, the Jellyfin web keys have their own writers, and IntroDB is legacy.
    • Code review at xhigh, run as three finders and a validation check. Fixed: an empty Discord save, Clear credentials staying visible, the .env.example default, and the backup before migrations. Answered: per-server locks and restart semantics, which belong to the existing table. Selective restore went to its own change.
    • Visual review, two rounds.
    • Simplify pass.
    • Background review: see Council review.

🤖 Generated with Claude Code

Note

Add environment-variable support for backups, Discord, MDBList and more settings

  • Adds envSettingVars mappings in env_settings.go so SILO_* variables can configure the web media URL, Meilisearch index, Discord credentials, prepared-download size limit, realtime monitoring, backup settings, and MDBList API key. Documented in .env.example.
  • The pre-migration backup in backup_wiring.go now reads SILO_BACKUP_ENABLED via a settings-reader overlay; other keys still come from stored settings. Startup logs a warning if parsing the environment fails.
  • Admin UI pages disable and mark fields as environment-managed when their setting comes from an environment variable. Environment-managed Discord credentials and MDBList keys are excluded from save and clear requests in NotificationsAdminSettings.tsx and ProvidersSettings.tsx.
  • Behavioral Change: admins cannot edit environment-managed settings through the UI; beforeMigrateBackup in backup_wiring.go now takes an EnvSettings argument, and callers in main.go and tests were updated.

Macroscope summarized 74d5ebe.

…ment

Thirteen more server settings can be set from environment variables, with
the checks an admin save runs: the nightly backup schedule and contents
(SILO_BACKUP_*), the Discord application (SILO_DISCORD_*), the MDBList key,
the Meilisearch index, the web media origin, the prepared-download budget
and realtime library monitoring. A deployment kept in version control no
longer needs the admin UI for them.

The web admin shows each of these fields read-only with the variable that
sets it, as it does for the existing variables. The Discord card leaves
keys the environment sets out of its saves and its clear action, which the
server would refuse.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The pull request adds environment-variable mappings for deployment settings, applies SILO_BACKUP_ENABLED to the pre-migration backup decision, and updates admin controls for settings managed by environment variables.

Changes: Environment-managed settings

Layer / File(s) Summary
Environment mappings and examples
internal/config/env_settings.go, internal/api/handlers/admin_settings_env_test.go, .env.example
Adds stored-setting mappings for deployment variables and tests their mapped values. Adds commented environment-variable examples.
Pre-migration backup override
cmd/silo/main.go, cmd/silo/backup_wiring.go, cmd/silo/backup_wiring_test.go, docs/architecture/backups.md
Startup reads SILO_BACKUP_ENABLED and passes it to the pre-migration backup. The backup uses it to override stored backup.enabled, while other backup settings continue to use stored values before migrations.
Environment-managed setting controls
web/src/components/settings/LimitField.tsx, web/src/pages/admin-backups/BackupSettings.tsx, web/src/pages/admin-settings/DownloadsSettings.tsx, web/src/pages/admin-settings/LibraryMetadataSettings.tsx, web/src/pages/admin-settings/SearchSettings.tsx
Admin controls receive environment-management status. Managed limit and backup schedule inputs are disabled, and the Meilisearch index field displays its managed status.
Environment-managed credentials
web/src/components/settings/SecretField.tsx, web/src/pages/admin-settings/NotificationsAdminSettings.tsx, web/src/pages/admin-settings/ProvidersSettings.tsx
Discord and MDBList credential controls account for environment-managed values when displaying fields, saving, clearing, and testing credentials.

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

Change: Feature

Possibly related PRs

Suggested reviewers: blurbery, rhainland

Merge Risk: Low · up to 74d5e

Environment-managed settings now map into the admin UI and the pre-migration backup decision. If the managed-status request fails, the Discord card may offer edits the server will refuse. This is a minor usability issue and is mergeable with a small follow-up.

Security architecture risk: Minimal · up to 74d5e

The added deployment settings retain existing validation and secret protection. The reviewed behavior does not introduce a material security or recovery regression.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The relevant authority is deployment-level configuration, not ordinary user input. A deployment actor can affect backup policy and integration identity across servers sharing the settings database, with downstream effects bounded by the configured external credentials. This extends an existing cluster-wide settings mechanism rather than introducing a new per-user or tenant authority boundary.

Trust Boundaries and Controls

  • observed — Environment ownership is enforced on the server, not solely by disabled web controls. Startup records managed keys, and both batch and single-setting administrator writes reject those keys. The guard remains process-local, consistent with the requirement for uniform configuration across API replicas.

Resilience and Maintainability Implications

  • observed — Invalid backup-enabled input has different handling by execution mode: normal primary startup rejects it, while migrate-only logs a warning and falls back to the stored backup decision. This does not grant a new backup-bypass privilege: deployment actors already possess the explicit skip variable, and failures reading stored backup settings still stop the migration sequence.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: adding environment-variable configuration for backup, Discord, MDBList and other server settings. It matches the changeset, which adds env_settings.go mappings for tho…
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 relevant to the changeset. It names the thirteen environment variables and their mapped settings (SILO_WEB_MEDIA_URL, SILO_MEILISEARCH_INDEX, SILO_MDBLIST_API_KEY, Disc…
Full details: Title check

Explanation

The title names the main change: adding environment-variable configuration for backup, Discord, MDBList and other server settings. It matches the changeset, which adds env_settings.go mappings for those settings, the pre-migration backup overlay, and the web admin managed-by-env UI. The title is concise and conventional-commit formatted, at 73 characters.

Full details: Description check

Explanation

The description is specific and relevant to the changeset. It names the thirteen environment variables and their mapped settings (SILO_WEB_MEDIA_URL, SILO_MEILISEARCH_INDEX, SILO_MDBLIST_API_KEY, Discord credentials, SILO_DOWNLOAD_ARTIFACT_MAX_BYTES, SILO_SCANNER_REALTIME_MONITORING, SILO_BACKUP_*). It explains the pre-migration backup change in backup_wiring.go and the web admin read-only and lock behavior in LimitField, SecretField, NotificationsAdminSettings.tsx and ProvidersSettings.tsx. It also covers validation, risks, and the reason for the change. This matches the raw summary of changes.

Finishing Touches

Generate unit tests (beta)

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

@silo-kody

silo-kody Bot commented Nov 20, 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 Nov 20, 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-11-20T21:37:16.895136Z 74d5ebe New commits
🔒 Security Review ✅ Completed 2026-11-20T21:40:16.081022Z 74d5ebe 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.

@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 Nov 20, 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 (Opus 5.5, reviewed d70a8b1)

Scope: what the change could do without. I found no correctness bugs. Every one of the thirteen keys is written only through the admin settings save. None reaches a normalizeBatchSetting branch that reads handler state, so the zero handler in CheckEnvironmentSettings is safe for them. The .env.example values match the defaults in adminSettingDefaults and the backup readers. The web changes reuse managedByEnv on the shared fields, and the only extra code is in the two cards that save outside useSettingsForm (Discord, MDBList), which needs it.

Two small cuts are inline, both nits.

Comment thread cmd/silo/backup_wiring.go Resolved

@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.2-sol, reviewed d70a8b1)

type="time"
step={60}
required
disabled={timeEnv != null}

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.

S1 · High — The task editor can change or remove the locked backup schedule. With SILO_BACKUP_TIME=04:00, Backups disables the time field, but Admin → Tasks → Back Up Server still offers Edit schedule (AdminTaskDetail.tsx:301). Removing the daily trigger and saving calls PUT /api/v2/admin/tasks/backup/triggers. admin_tasks.go:332 and taskmanager/manager.go:690 persist and install the empty schedule without touching backup.time. On a single server, nightly backups then stop until the schedule is reconciled, while Backups still shows 04:00 as environment-managed. Make the task schedule read-only through the task API and UI when backup.time owns it, or route that editor through the same setting and lock.

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.

Not changed here; this happens on main too. The task editor can rewrite or empty the "Back Up Server" triggers whoever set backup.time, and SyncSchedule puts the backup.time trigger back at the next settings change or restart. The environment lock doesn't add a new way in. A separate change makes the backup task's schedule follow backup.time in the task editor and API, together with S5.

Comment thread cmd/silo/main.go Resolved
Comment thread cmd/silo/backup_wiring.go Resolved
const anyStoredEditable = editableKeys.some((key) => stored[key]);
const updates: Record<string, string> = {};
if (editableKeys.includes("discord.client_id")) updates["discord.client_id"] = clientId;
if (clientSecret.trim() !== "") updates["discord.client_secret"] = clientSecret;

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.

S4 · Medium — A draft can still submit after its field becomes read-only. Type a Discord secret while the tab has cached status from before a restart, then let sensitive-status refetch and report that SILO_DISCORD_CLIENT_SECRET now owns it. The field disables, but this line still adds its draft to the update. The same applies to the bot token. The settings handler rejects the whole batch, including edits to credentials that are still editable. useSettingsForm.ts:217 has the same problem for staged edits on the Backups, Downloads, Library, and Search pages. Filter submitted keys against the latest ownership map, and retire or mark any draft that just became locked so the field shows the active value and the save bar reflects what can still be saved.

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.

The Discord card is fixed in c7622a0: a secret or token draft counts toward Save and the unsaved-changes guard only while its key is editable. The shared useSettingsForm save sends a newly locked draft the same way on main for every environment variable since #4498, so a separate change fixes it there for all pages.

{"SILO_SCANNER_REALTIME_MONITORING", "scanner.realtime_monitoring", EnvScopeStored},

{"SILO_BACKUP_ENABLED", BackupEnabledSettingKey, EnvScopeStored},
{"SILO_BACKUP_TIME", BackupTimeSettingKey, EnvScopeStored},

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.

S5 · Medium — A missed startup event leaves another server on the old backup trigger. The environment write commits before main.go:1223 publishes its best-effort event. If another API server misses that event, its backup trigger remains on the old time. syncBackupSchedule falls back to the config watcher's OnChange callback, but backup.time is outside config.Config, so a time-only change leaves the configs equal and the watcher returns at internal/nodeconfig/watcher.go:510. Publishing on retry does not repair this because the value already matches storage. Reconcile backup scheduling from the stored time even when the notification is lost, and test a time-only change on a second server that missed the event.

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.

Not changed here; the same gap exists on main for an admin save of backup.time, whose event is equally best-effort. Each API server re-syncs its trigger from the stored time when it starts, so with the same variables on every server (which the stored variables already require) each one starts on the right time. The separate change for S1 also covers catching up after a missed event.

@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 (Gemini 4 Neon, reviewed d70a8b1)

Checked all 13 rows in internal/config/env_settings.go, their sensitivity and validation, save hooks and dedicated write routes, pre-migration backup overlay and --migrate-only, web admin fields, .env.example, and TestCheckEnvironmentSettingsDeploymentSettings. The core wiring, validation, sensitivity classification, and tests match the codebase. Three minor issues remain in UI error/refetch guards and backup documentation (inline below).

Comment thread cmd/silo/backup_wiring.go Resolved
…h entry points

The backup before migrations laid every SILO_BACKUP_* value over the
stored settings. A lower SILO_BACKUP_KEEP then rotated nightly copies
away before the migrations had succeeded, under a value startup had not
stored yet. Only SILO_BACKUP_ENABLED decides that backup now; retention
waits for startup.

A migration job (--migrate-only) read no environment settings, so on the
deploy that first sets SILO_BACKUP_ENABLED=true over a stored false it
migrated without a backup. It now reads them for this one value, and an
invalid value elsewhere falls back to the stored settings with a warning
instead of stopping the migration.

Also drop a test that repeated the env table's invalid-value check.

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

silo-kody Bot commented Nov 20, 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 ❌

Comment thread cmd/silo/main.go Resolved
…aves

- The Discord card left env-set keys out of its saves, but a client
  secret or bot token typed before the environment took that key over
  still went into the batch, and the server refused the whole save. Each
  draft now counts only while its key is editable.
- The Search page's Meilisearch index stayed editable when the
  sensitive-status read failed, unlike the other three Meilisearch
  fields there.
- A migration job read every environment setting for its one use,
  SILO_BACKUP_ENABLED, so an invalid unrelated variable dropped that
  value. It now reads that variable alone.
- The before-upgrade backup's comment and doc now say it reads
  SILO_BACKUP_ENABLED.

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

silo-kody Bot commented Nov 20, 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 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 (Opus, reviewed c7622a0)

Round 1 findings O1 and O2 are resolved by the narrower overlay and the dropped test. The pre-migration read and the Discord gating now work for every case I traced, including an invalid SILO_BACKUP_ENABLED in a migration job: it falls back to the stored value, because ReadEnvSettings returns nil on error and withEnvBackupSettings then returns the stored reader. I found three new issues, all small: one display bug in the Discord card and two places where the code or docs could be simpler. None of them blocks the change.

Comment thread cmd/silo/main.go Resolved
Comment thread docs/architecture/backups.md Resolved

@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 (Sol, reviewed c7622a0)

Comment thread cmd/silo/backup_wiring.go
opts = backup.Options{Pool: pool, Locker: backup.PostgresLocker{Pool: pool}}
}
if opts.Settings != nil {
opts.Settings = withEnvBackupSettings(opts.Settings, env)

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.

S6 (Medium) — Check the environment override before opening backup storage. With pending migrations and SILO_BACKUP_ENABLED=false, a configured local artwork root that resolves to a regular file still blocks --migrate-only. upgradeBackupOptions calls storesFromConfig before this overlay, and its error returns before skipBeforeUpgrade can see false. The API startup path uses the same hook. For an explicit false, take the existing backup lock without preparing the backup destination.

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.

Not changed. A stored backup.enabled=false behaves the same way on main: the backup's options, storage included, are prepared before the setting is read, and any failure there stops startup and names SILO_SKIP_BACKUP_BEFORE_MIGRATE (docs/architecture/backups.md, "Only settings that were read can skip it"). The environment value follows the stored one's rule. A blob store that can't open would also stop the server's own startup a moment later.

// The server refuses a save of a key its environment sets, so those keys
// stay out of every save and clear this card sends, including a draft
// typed before the environment took the key over.
const editableKeys = DISCORD_APP_KEYS.filter((key) => envVar(key) == null);

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.

S8 (Low) — Keep editing disabled when ownership is unknown. If the settings snapshot loads and sensitive-status fails on first load, useSettingsForm ends loading with envVar returning undefined for every key. An entirely environment-managed Discord card then shows editable inputs and an enabled Save button, and the server rejects the save. Pass the status readiness into the card and gate edits and Save until it can tell which keys are editable.

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.

Not changed here. The SMTP fields on the same page, which SILO_SMTP_* sets, also stay editable on main when the status read fails, and the server's 422 refuses the save. The Discord card follows them.

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.

CodeRabbit raised the same point in a separate thread. Not changed here: the Notifications page has no handling for a failed status read on main, and the SMTP fields on it behave the same way. The separate change for the shared settings form now covers this page too, so the SMTP fields and the Discord card stay unavailable, with a retry message, until the status is known.

Comment thread docs/architecture/backups.md Resolved

@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 (Gemini 4 Neon, reviewed c7622a0)

Checked the round-2 fixes against c7622a0b: G1, G2, and G3 are resolved, along with the pre-migration SILO_BACKUP_ENABLED-only overlay on API servers and --migrate-only. Three small follow-ups remain on the diff:

  • G4 (low): DiscordAppCredentials still renders and passes a stale clientIdDraft (and secret drafts) after the environment takes those keys over.
  • G5 (low): MDBListTile keeps its own local apiKey draft outside useSettingsForm and does not gate hasDraft on !managed.
  • G6 (nit): TestEnvBackupSettingsOverlayStored's comment still says any SILO_BACKUP_* variable applies before migrations.

Comment thread cmd/silo/backup_wiring_test.go Resolved
- The Discord card and the MDBList tile ignored a draft for a key the
  environment took over only in what they saved, so the locked field,
  the invite link and the connection test still used the typed value.
  Both now ignore such a draft where they read it. The Discord card
  sends the client ID only when it changed, so Save stays disabled when
  nothing editable changed.
- Every server that migrates reads SILO_BACKUP_ENABLED the same way;
  the separate --migrate-only branch is gone.
- The backups doc and the overlay test describe the skip by the
  effective backup.enabled, with SILO_BACKUP_ENABLED the one setting
  taken from the environment.

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

silo-kody Bot commented Nov 20, 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 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 posted: 1

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: d283e9b1-dab2-458d-8b4b-820e641652eb
Commits

Reviewing files that changed from the base of the PR and between 66b836f and 74d5ebe.

Files selected for processing: 15

  • .env.example
  • cmd/silo/backup_wiring.go
  • cmd/silo/backup_wiring_test.go
  • cmd/silo/main.go
  • docs/architecture/backups.md
  • internal/api/handlers/admin_settings_env_test.go
  • internal/config/env_settings.go
  • web/src/components/settings/LimitField.tsx
  • web/src/components/settings/SecretField.tsx
  • web/src/pages/admin-backups/BackupSettings.tsx
  • web/src/pages/admin-settings/DownloadsSettings.tsx
  • web/src/pages/admin-settings/LibraryMetadataSettings.tsx
  • web/src/pages/admin-settings/NotificationsAdminSettings.tsx
  • web/src/pages/admin-settings/ProvidersSettings.tsx
  • web/src/pages/admin-settings/SearchSettings.tsx

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

savedClientId={form.getValue("discord.client_id")}
sensitiveConfigured={form.sensitiveConfigured}
restartKeys={restartKeys}
envVar={form.envVar}

@coderabbitai coderabbitai Bot Nov 20, 2026 •

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.

Minor · Functional Correctness · Quick win

Keep Discord credential actions unavailable until managed status is known.

If the sensitive-status request fails and no status is cached, the settings form still renders. Every Discord credential then appears unmanaged, so the card offers edits and clears for environment-managed keys. The server can refuse those writes. The refusal surfaces as an error, and drafts are kept, so the impact is a misleading editable field and a failed request. The hook comment at web/src/hooks/useSettingsForm.ts:293-295 states that the form should not offer edits the server would refuse. The failure path does not keep that rule for these credentials.

Keep the credential fields and their save and clear actions unavailable until the managed status is known. Show a retry state when the status request fails. The exact recovery UI is a design choice.

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.

Agreed this should be handled, but not in this PR. The Notifications page doesn't handle a failed status read on main: its SMTP fields, which SILO_SMTP_* sets, render editable the same way. A page-level status-error state also needs new interface text. A separate change on the shared settings form covers it for the whole page, SMTP and the Discord card together.

@Quick104
Quick104 merged commit 1169342 into main Nov 20, 2026
44 checks passed
@Quick104
Quick104 deleted the feat/env-settings-more branch November 20, 2026 23:30
Quick104 added a commit that referenced this pull request Nov 21, 2026
Pass nil secretKeys to the two config.ReadEnvSettings calls added by #4665
(which only read non-secret backup settings).
Quick104 added a commit that referenced this pull request Nov 21, 2026
#4665 landed as a squash with one more commit (74d5ebe), so its files take
main's version. internal/plugins/provision_document.go keeps main's
provisiondoc reader from #4654 and this branch's four document variables and
ai_providers section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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