Repository navigation
fix(web): save the rest of a settings page when an edited field becomes environment-managed - #4673
Conversation
…es environment-managed A settings page kept a draft for a field after a server restart made the field environment-managed. The field turned disabled but stayed counted as unsaved, and Save sent it with the other edits, so the server refused the whole batch and none of the edits were saved. The settings form now drops a draft once sensitive-status reports its key as set by the environment: the field shows the server's value, the save bar counts only editable fields, and Save sends only those. A save the server refuses as invalid also refetches sensitive-status, since nothing else does while the page stays open through a restart, so a second Save goes through. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 42 minutes. View limit details
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Resolved: phone-width before-and-after captures now cover the environment-managed field, remaining unsaved edit, and successful persistence after reload, with both builds identified. Original requestPlease add before-and-after captures at a phone-width viewport for the changed settings flow, showing the environment-managed field, unsaved-change count, and successful save of the remaining edit. CONTRIBUTING.md treats desktop and mobile web as separate surfaces; the shared form’s value and save-state changes affect mobile too, even without layout or styling changes. Name the before/after builds with the captures. |
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (gemini-4-neon, reviewed 5c8876a)
Verified claims that hold: environmentRefusesSave arrives as 422 validation_failed on PUT /api/v2/admin/settings when the If-Match guard passes (internal/api/handlers/admin.go:1633-1635, internal/apiv2/admin_settings_write.go:89-98), managed_by_env_vars covers every key environmentRefusesSave refuses (internal/api/handlers/admin_settings_inspection.go:66-74, cmd/silo/main.go:787-798,1436-1437, cmd/silo/env_settings.go:75-81), and nothing else refetches sensitive-status while a visible tab stays open across a restart (web/src/lib/query-client.ts:47-48, web/src/components/RealtimeEventsProvider.tsx:579-581,1284-1307).
Five issues remain across the change and the settings pages it serves (G2, G3, and G5 are inline on their diff lines; G1 and G4 sit outside the diff hunks):
G1 (High) — Locked StorageSettings bypasses useUpdateServerSettings, so POST /api/v2/admin/storage-transitions never refreshes sensitive-status
- Location:
web/src/hooks/queries/admin/settings.ts:165-180,web/src/pages/admin-settings/StorageSettings.tsx:641-647,725-784 - Trigger: On an install with locked storage (
artworkLockedorprivateLocked), open Settings → Storage, edit any location key (artwork.storage_backend,artwork.local_path,s3.public_endpoint,s3.public_bucket,s3.public_key_prefix,s3.private_endpoint,s3.private_bucket, ors3.private_key_prefix) alongside another storage key inSTORAGE_TRANSITION_KEYS(such ass3.public_region,s3.public_path_style,s3.public_url_auth, or S3 credentials). Restart the server with a storage env var matching the recorded location (permitted byCheckEnvironmentSettingsininternal/api/handlers/admin_settings_env.go:45-51), then click Review transition and Queue transition. - Impact: Because
storageLocationChangePendingis true andnonTransitionKeysis empty (StorageSettings.tsx:730),useUpdateServerSettingsis never called.POST /api/v2/admin/storage-transitionsanswers 422validation_failed(internal/storagetransition/service.go:325-331,479, wired atcmd/silo/main.go:4003; mapped atinternal/apiv2/admin_storage_transition.go:179-181).useCreateStorageTransitionhas noonErrorinvalidation forsensitive-status, andStorageSettings.tsx:781-783catches the error with a generic toast. The env-managed location draft stays dirty,storageLocationChangePendingstays true, the SaveBar stays stuck on Review transition, and the remaining storage edits cannot be saved without discarding all edits or reloading. - Evidence:
web/src/hooks/queries/admin/settings.ts:165-180defines onlyonSuccess;web/src/pages/admin-settings/StorageSettings.tsx:92-102,725-784routes everySTORAGE_TRANSITION_KEYSsave throughcreateTransitionwhile a location edit is staged. - Suggested repair: Add an
onErrorhandler touseCreateStorageTransitionthat invalidates[...adminKeys.serverSettings(), "sensitive-status"]onV2ProblemErrorwithproblemType === "validation_failed". InStorageSettings.tsx, surface the problem detail in the catch toast and close the transition dialog oncestorageLocationChangePendingclears so the SaveBar returns to Save.
G4 (Medium) — RedisGroup leaves "Use Redis" stuck OFF and disabled when REDIS_URL drops Redis drafts while another General edit stays dirty
- Location:
web/src/pages/admin-settings/RedisGroup.tsx:41-53,99-101 - Trigger: With
redis.urlstored in the database, open Settings → General, toggle Use Redis off (setEnabledOverride(false); stageRedisUrl(form, "")), and edit another General field (for examplebranding.login_subtitle). Restart withREDIS_URLset to the same stored URL (ETag unchanged) and click Save. - Impact: The first Save gets 422
validation_failed,sensitive-statusrefreshes withredis.urlandredis.dbunderREDIS_URL, anduseSettingsFormdrops both Redis drafts. Becausebranding.login_subtitleis still dirty,form.dirtyCountdrops to1rather than0, soif (form.dirtyCount === 0) setEnabledOverride(null)(RedisGroup.tsx:51) does not run.enabledstaysfalsewhileurlEnvis"REDIS_URL": Use Redis renders OFF and disabled with "Set by REDIS_URL", hiding the URL, Database number, and Test connection rows even though Redis is active, until the remaining edits are saved or discarded. - Evidence:
web/src/pages/admin-settings/RedisGroup.tsx:48-53only clearsenabledOverrideonform.dirtyCount === 0and computesconst enabled = enabledOverride ?? (redisUrl.trim() !== "" || configured). - Suggested repair: Clear
enabledOverrideand ignore it when computingenabledwheneverurlEnv != null.
AI disclosure: reviewed by gemini-4-neon via Antigravity in T3 Code.
|
The evidence page now has 390 px phone-width before and after captures for the flow where the page stays open. Before is 66b836f (main); after is 5c8876a (this head). Both runs used the same data. They show the environment-managed field and the unsaved-change count after the first refusal, then the second Save storing the remaining edit and the reload confirming it. The PR description's Validation section lists the result. 🤖 Claude Code (claude-opus-5-5) |
…save fails A save refused as invalid now re-reads which keys the environment sets. When that read failed, the query turned errored, and the Storage page traded its editor, drafts included, for a reload notice. The refresh now reads the list directly and updates the cache only when the read succeeds, so a failed read keeps the last known list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (gpt-6.2-sol, reviewed 5c8876a)
Posted by the PR author's run because the reviewer's tool couldn't submit a review pinned to the commit. The findings are the reviewer's, in summary.
S1 (P2): a retried Save can turn Jellyfin Web off on its own. Turning Enable Jellyfin API off also stages jellyfin_compat.web_enabled: "false". If the server restarts with SILO_JELLYFIN_ENABLED=true matching the stored value, the refresh locks the API switch and drops its draft, but the companion draft stays hidden and dirty. A component test showed the second PUT sending only web_enabled: "false". Suggested: drop the companion edit when its parent draft is dropped (web/src/hooks/useSettingsForm.ts, web/src/pages/admin-settings/CompatibilityProxiesSettings.tsx setJellyfinAPIEnabled).
S2 (P2): an ordinary validation error can strand Storage drafts. Any validation_failed refusal, such as a relative artwork path, now refreshes sensitive-status. If that refresh fails (502 in the test), the query turns errored, and the Storage page replaces its editor, Save and Discard with a reload notice. On main the same refusal left the editor available for correction (web/src/hooks/queries/admin/settings.ts onError, web/src/pages/admin-settings/StorageSettings.tsx status-error state).
S3 (P3): an acknowledged save can restore an outdated locked value. If the old process accepts a change and the restarted process then reports a different environment-set value, the form shows the new locked value until the earlier PUT settles, then the response's older value. Main ends with the same stale display. Suggested: advance the field's edit version when its draft is dropped (web/src/hooks/useSettingsForm.ts draft removal and save reconciliation).
Score: 6/10.
AI disclosure: reviewed by gpt-6.2-sol via Codex in T3 Code; posted by Claude Code (claude-opus-5-5).
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (claude-opus-5-5, reviewed 73eb033)
The round-2 change fixes the case it set out to fix: a failed status read after a validation_failed refusal now keeps the last list, and the Storage page keeps its editor and drafts. Within onError, fetchQuery and refetchQueries would not get there. On TanStack v5 both move the query to status: "error" while keeping its data, so useQuery().isError turns true and Storage swaps in the reload notice again. Among mutation-side options, the direct queryFn plus setQueryData is the simplest. The new test drives a failure-handling path that no type check catches, so it fits "Decide what to test". Two nits:
O1 (nit, boundary): the errored-list signal belongs in useSettingsForm, not the mutation. web/src/hooks/useSettingsForm.ts:25 reads isError, which is also true when a refetch fails while data is still cached. Other refetches of this key can still fail the same way. After a successful save, onSuccess invalidates sensitive-status, and a 30 s stale refetch runs when the page mounts again. If that read fails (two 5xx in a row with the default single retry), Storage still replaces its editor with "reload before editing" even though a usable list is cached. That part was already on main. Reading isLoadingError (an error with no data yet) instead of isError closes all three paths in one place. onError could then go back to invalidateQueries, and this PR's test would pass unchanged. One cost to check: General and Search use sensitiveStatusError to show "connection unknown", and with this change they would show the cached status after a failed refetch. That seems acceptable to me, but it changes what those pages show.
O2 (nit, correctness): the hand-rolled read skips the query cache's lifecycle. At web/src/hooks/queries/admin/settings.ts:314, onError checks isCapturedProfileAuthorityActive only before the read starts, and .then(setQueryData) doesn't check again. If the admin signs out and signs in to another server or account while the read is in flight, App.tsx:375 clears the cache and the old read then writes the previous server's env-var list into the new session, marked fresh for 30 s. useSettingsForm would then drop drafts or lock fields based on another server's environment. invalidateQueries didn't have this problem, because a fetch on a cleared query resolves into a detached Query. The same setQueryData can also overwrite a newer list from a concurrent onSuccess refetch if it resolves second. That second case does no harm in practice, since the list changes only on restart. Repair: check isCapturedProfileAuthorityActive(intent.profileContext) again inside .then. O1 removes the issue entirely by returning to invalidateQueries.
Round 1: my hand-written query-key note is resolved (the module constant is used now). S2 is resolved by 73eb033. The others were deferred as pre-existing or separate, and I didn't re-review them.
AI disclosure: written by Claude Opus 5.5 (claude-opus-5-5) via Claude Code, as an adversarial review sub-agent.
Quick104
left a comment
There was a problem hiding this comment.
Reviewed commit 73eb033669becf42d61f6c4cab04a1977d3dfc61.
- S4 (P2) An older status read can remove a lock the recovery read just found. If a reconnect refetch starts before the settings refusal, the recovery GET can publish the new lock while that refetch is still running. When the older read finishes, TanStack Query replaces the cache with its result and the form offers an edit the server will refuse again. A test with two deferred responses reproduced the stale cache on this head and passed on
5c8876a. Coordinate the recovery read with in-flight reads for the same query key and retain the last successful status if recovery fails. settings.ts - S5 (P3) The form drops a Redis database clear the server accepts. Clear the Database number field, edit another field, then let the status query discover
REDIS_URL. The form drops the emptyredis.dbdraft and reports a successful save for the remaining edit, leaving the stored override in place. The validator can stay unchanged when the environment supplies the same URL and database already in use. The form sent the clear on the PR base and omitted it on this head. Preserve an emptyredis.dbdraft when applying the environment locks. useSettingsForm.ts · admin.go - S6 (P3) A transient gateway error consumes the whole recovery attempt. A single 502 on the status GET after an environment refusal is enough to leave the field editable and its draft in every retry of the save until another read succeeds. With the app's query retry policy, the previous head recovered on the next GET. Keep the bounded retry for the recovery read and leave the editor available if those attempts fail. settings.ts · query-client.ts
Reviewed with Codex (gpt-6.2-sol).
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (gemini-4-neon, reviewed 73eb033)
Round-1 items (G1–G5): resolved (deferred to separate fixes; verified against the server storage-transition check, dependent-field / RedisGroup gating on main, and the pinned If-Match baseline behavior on 412).
New findings on 73eb033:
-
G6 (Medium) — Out-of-order manual refresh can overwrite newer
sensitive-statuscache entries (web/src/hooks/queries/admin/settings.ts:313-317)- Trigger:
onErrorstartsADMIN_SENSITIVE_STATUS_QUERY.queryFn()outsideQueryCachewithout awaiting it, so the mutation settles immediately and the form can save again while that read is still in flight. If a corrected save succeeds and invalidatessensitive-status(settings.ts:257-259), or a latervalidation_failedread completes first across a restart or rolling deploy, the earlier slowqueryFn()call resolves last and writes unconditionally withqueryClient.setQueryData(ADMIN_SENSITIVE_STATUS_QUERY.queryKey, status). - Impact: The stale snapshot replaces the newer cache entry and resets
dataUpdatedAttoDate.now()(staleTime: 30_000), revertingconfiguredormanaged_by_env_varsacross everyuseAdminSensitiveStatusobserver for up to 30 seconds (e.g., flipping a newly saved secret back to unconfigured and hiding its Clear action, toggling Redis off, or re-enabling an env-locked field). In the reverse direction,setQueryDatasetsmanual: trueand does not cancel an already-in-flightQueryrefetch, which can overwrite the manual update when it completes. - Repair: Either guard the write with a monotonic refresh sequence and
queryClient.getQueryState(key)checks (skippingsetQueryDataif a newer refresh started,dataUpdateCountadvanced since start, orfetchStatus === "fetching"), or keepinvalidateQueriessoQueryCacheowns cancellation and ordering and computesensitiveStatusErrorinweb/src/hooks/useSettingsForm.ts:25asisError && sensitiveData == nullso a failed background refetch preserves the last cached status.
- Trigger:
-
G7 (Low) — New regression test does not wait for the direct
queryFn()failure to settle and checks an empty environment map (web/src/hooks/queries/admin/settingsWrite.test.ts:185-210)- Trigger: On
73eb033,onErrorcallsADMIN_SENSITIVE_STATUS_QUERY.queryFn()directly instead of throughQueryClient, soclient.isFetching()remains0while the 502 read runs, andstatusReads += 1executes before the response body is decoded and rejected. The initial/sensitive-statusfixture also returnsmanaged_by_env_vars: {}, and the assertions only checksensitiveStatusErroranddirtyKeys. - Impact:
await waitFor(() => expect(client.isFetching()).toBe(0))no longer waits for the failed refresh to finish, and the test does not verify that a previously known env-managed entry (envVar(...)) andsensitiveStatusReadystay intact after the 502. - Repair: Wait for the second
/sensitive-statusread to finish settling (for example by tracking completion of the second response read), seed a non-emptymanaged_by_env_varsentry on the first read, and assertsensitiveStatusReadyandenvVar(...)remain unchanged after the failure.
- Trigger: On
AI-assisted review: gemini-4-neon via Antigravity in T3 Code.
…ep a redis.db clear The settings form reported the environment list as unavailable whenever a re-read failed, even with a list already loaded, and the Storage page then traded its editor and drafts for a reload notice. The form now treats the status as unknown only when no list has loaded. That lets the refresh after a refused save go back to invalidating the query, which coordinates it with other reads, keeps the retry policy, and is dropped on sign-out, instead of the direct read added in the previous commit. The server accepts clearing redis.db under REDIS_URL, which is how a saved number is removed, so the form keeps that draft when REDIS_URL takes over instead of dropping it with the other environment-set keys. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
…ment list Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (gpt-6.2-sol, reviewed c2e4898)
S8 (P2) A replica-local lock can erase a valid draft
In web/src/hooks/useSettingsForm.ts:65, any status response that lists a key deletes its draft. SILO_DB_MAX_CONNECTIONS applies per process and can legitimately be set on just one API replica (internal/config/env_settings.go:18, :97). Edit Database max connections in General Settings after an unlocked replica answers the initial read. If a background status read hits the replica with the override, the form deletes the draft before any save. In a hook test, a later unlocked response re-enabled the field, but the next PUT contained only the unrelated subtitle edit. Keep the blocked draft and restore it to the save batch if the lock clears.
S9 (P3) Retrying Save before the status read finishes sends the refused batch again
web/src/hooks/queries/admin/settings.ts:312 starts invalidation in the background. General Settings re-enables Save as soon as the rejected mutation settles (web/src/pages/admin-settings/GeneralSettings.tsx:83, :237). With the status response held open after a 422, clicking Save again sent the same locked key and restarted the status query. Repeated clicks can delay recovery. Keep Save busy until this refresh settles, including when the read fails.
Review by Codex (gpt-6.2-sol).
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (gemini-4-neon, reviewed c2e4898)
G9 (low): RedisGroup leaves enabledOverride stuck off when useSettingsForm drops redis.url while another draft remains
- Location:
web/src/pages/admin-settings/RedisGroup.tsx:44-53(coupled withweb/src/hooks/useSettingsForm.ts:65-85) - Trigger: Open General Settings on a server with
redis.urlstored (for exampleredis://cache:6379/3) andREDIS_URLunset. Flip Use Redis off (setEnabledOverride(false)+stageRedisUrl(form, "")) alongside either another General Settings edit (such asbranding.login_subtitle) or a prior clear ofredis.dbto"". Restart the server withREDIS_URLset to the same URL (the settings ETag stays unchanged) and click Save. The422 validation_failedrefusal refreshessensitive-status, anduseSettingsFormdropsredis.url(and non-emptyredis.db) while keeping the other draft or the exempted emptyredis.dbclear, leavingform.dirtyCount > 0. - Impact:
RedisGroup.tsx:49-52resetsenabledOverrideonly whenform.dirtyCount === 0, soenabledstaysfalseeven thoughurlEnvis"REDIS_URL"and theredis.urlclear draft was dropped. The Use Redis switch renders disabled and off while Redis is active fromREDIS_URL, hiding the URL, Database, and connection-check controls until all remaining edits are saved or discarded. When an emptyredis.dbclear was staged, that draft stays counted inSaveBarand is still submitted on Save while its field is hidden inside the collapsed group. - Repair: Clear
enabledOverridewhenurlEnv != nullinweb/src/pages/admin-settings/RedisGroup.tsx(for example,if (urlEnv != null && enabledOverride !== null) setEnabledOverride(null);after thedirtyCount === 0check), so an environment-managedREDIS_URLshows the Redis fields and any retainedredis.dbclear.
AI-assisted review generated with gemini-4-neon via Antigravity (T3 Code).
A failed settings read during Reload turned the form's loadError on even though the snapshot was still loaded, and pages that show a load error replaced the form, drafts and all. loadError now means what it says: the snapshot never loaded, like the secret status since #4673. The Use Redis switch also follows the stored URL again when the page goes clean, not only when its Redis edits clear: switching Redis on with no URL saved stages nothing, so Discard has to reset it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
With #4673, a draft for a key the environment takes over is dropped. When SILO_JELLYFIN_ENABLED takes over a staged API switch-off, the Jellyfin Web switch-off staged with it stayed, with no field to show it, and Save wrote it. The page now drops that switch-off whenever the API switch-off it goes with is no longer staged. The Redis takeover test now keeps a staged database number, the case in which the old switch state outlived #4673's draft drop. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#4696) * fix(web): stop settings pages from saving changes the admin can't see Several settings pages hid a field when the setting that controls it changed, but kept the field's unsaved edit. The save bar counted it and Save wrote it. - Storage (admin and setup wizard): the link-mode settings stay in view while they hold an edit. - Setup wizard Connect apps: a typed Jellyfin address stays in view after Jellyfin is turned off. - Playback: the device picker, Buffer ahead, and the lower-version preference stay in view while they hold an edit; saved device paths keep their rows. - Compatibility: Jellyfin Web's switch-off is staged only with a real API switch-off and is taken back by any other flip. - Redis: switching it off with no saved URL drops what was typed, and the switch follows REDIS_URL once the environment takes over. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(web): mark kept rows and keep only the edited ones Review follow-ups for the hidden-draft fix: - A link-mode setting the selected mode doesn't use stays only while it holds an edit, row by row, rather than keeping the whole Cloudflare group in view. - A row kept in view for an unsaved edit after its switch or mode would hide it carries the existing unsaved-change dot. SecretField forwards that marker. - The device picker builds rows from the saved list first and orders a toggle by the rows, so switching a device back on restores the saved order instead of leaving a reordered list staged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(web): drop the Jellyfin Web switch-off when its API draft goes With #4673, a draft for a key the environment takes over is dropped. When SILO_JELLYFIN_ENABLED takes over a staged API switch-off, the Jellyfin Web switch-off staged with it stayed, with no field to show it, and Save wrote it. The page now drops that switch-off whenever the API switch-off it goes with is no longer staged. The Redis takeover test now keeps a staged database number, the case in which the old switch state outlived #4673's draft drop. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(web): one rule for the Jellyfin Web switch-off; keep saved device order Review follow-ups on #4696: - Compatibility: the switch handler is back to staging Jellyfin Web off with every API switch-off, and one layout effect drops that draft whenever an API switch-off isn't staged. That covers flipping back, switching off an API already saved off, the window right after a save, and the environment taking the switch over. - Playback: a device toggle orders the list saved paths first, so turning a device off and back on restores the saved list even when detection lists the devices in another order. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(web): keep a kept device picker from adding NVENC-incompatible paths Review follow-ups on #4696: - Playback: shown under NVENC or "none" only because it holds an unsaved change, the device picker now only takes devices back to their saved state. NVENC reads the setting as a CUDA device, so adding render paths there would save a value NVENC can't use. - The Redis takeover test uses the server's shape (REDIS_URL manages both Redis keys) and keeps an unrelated edit staged, the case where the old switch state outlived the dropped drafts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(web): mark the changed devices in a kept device picker Review follow-up on #4696: under a mode the device picker doesn't apply to, a device row whose switch differs from the saved list now carries the unsaved-change dot, like every other row kept for an edit. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(web): treat a device toggle back to the saved list as no change Review follow-up on #4696: a saved device list that isn't in canonical form (a space after a comma) never matched the toggled string, so switching back to the saved devices left a draft with every switch of a kept picker locked. A toggle that lands on the saved devices now drops the draft. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(web): check that only the unrelated edit survives a Redis takeover Review follow-up on #4696. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(web): stage the Redis number with the switch-off in the takeover test Review follow-up on #4696: the fixture reports a saved database number, as the server does for a saved URL, so the switch-off stages both Redis keys and the test checks that only the unrelated edit survives REDIS_URL taking them over. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(web): keep a device revert staged while a save settles Review follow-up on #4696 (Kody): a device toggle back to the saved list reset the draft directly, so during a save of that setting the revert was dropped and the save wrote the unwanted devices. The toggle now stages the saved string itself and lets the form decide whether that undoes the edit, as it does for every other field; only an unset value, which the snapshot never carries, is dropped directly, and not while a save is in flight. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(web): let a kept device picker always reach the saved list Review follow-up on #4696 (Sol S7): after a settings refresh, a staged device list could match the saved devices or differ only in order, and the kept picker under NVENC or Software then locked every switch. Under a mode the picker doesn't apply to, any device can now be switched off and only saved devices switched on, so the saved list is always reachable and no render path can be added for NVENC. A list that differs only in order marks its selected rows. Component tests cover NVENC refusing a new render path and an order-only list going back to the saved one; both fail on main. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Problem
Related issue: N/A
Validation tasks: none
Other clients: Apple N/A (no admin settings form); Android N/A (no admin settings form); Roku N/A (no admin settings form)
An admin settings page can't save any of its edits after a server restart makes one of the edited fields environment-managed. The field turns read-only ("Set by SILO_SERVER_NAME in the server's environment.") but keeps the admin's draft and still counts it as unsaved. Save sends it with the other edits, and the server refuses the whole batch ("branding.server_name is managed by an environment variable"). The locked field can't be changed back, and every later Save gets the same refusal. This applies to every page built on the shared settings form and every variable in the environment settings table from #4498.
This change drops a field's draft once the server reports that the environment sets it. The field then shows the server's value, the save bar counts only fields the admin can still save, and Save sends only those. A save the server refuses as invalid also re-reads which keys the environment sets, so the form catches up even when nothing else has refreshed that list.
Approach
useSettingsFormchecks its unsaved keys againstmanaged_by_env_varsfromGET /api/v2/admin/settings/sensitive-statusand removes the draft of any key the environment now sets. It does this during render, the same way the hook already resets drafts when the acting profile changes. The one exception is a staged emptyredis.db. The server still accepts clearing it underREDIS_URL, because that is how a saved number gets removed, so that draft stays. The server's refusal is unchanged.useUpdateServerSettingsinvalidates the sensitive-status query when the server refuses a save withvalidation_failed, which is how the environment refusal arrives. While the page stays open through a restart, nothing else refetches that list: window-focus refetching is off, and a server restart doesn't fire the browser'sonlineevent. Without this, the first refusal would repeat on every Save. Other failures, such as timeouts and server errors, don't trigger the refetch.useSettingsFormnow treats the status as unknown (sensitiveStatusError) only when no list has ever loaded. Before, any failed re-read counted, even with a list already loaded. On the Storage page that state replaces the whole editor, drafts included. A failed re-read now keeps the last list. The pages that handlesensitiveStatusError(Storage, General, Search) see it only on a first-load failure, which the follow-up about failed status reads builds on.Not covered here: when the variable's value differs from the stored one, startup writes it to
server_settings, which changes the settings revision. The form's concurrency guard then answers 412 for the remaining edits until the admin discards them. Main does the same after any outside settings change. That is a separate gap in how the settings form handles a 412, and it has its own follow-up.Validation
SILO_SERVER_NAMEset to the stored value, then press Save. With the page left open, every Save answered 422 and the field never turned read-only. After a network reconnect refreshed the field to read-only, it still showed the draft, the bar counted 2, and Save answered 422. The subtitle stayed unsaved in both cases.server_settingsrow show the subtitle stored and the server name left at the environment's value.settingsWrite.test.tsrun the form through a real query client:redis.dbclear survivingREDIS_URLtaking over. Fails on 73eb033, the head before that fix.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/settings-env-locked-draft/
Risks
The drop is silent. If an admin typed into a field and the environment then took it over, that text is gone, and the field's "Set by …" note is the only explanation. The server would refuse that value anyway. In a cluster whose API servers were started with different environments, the form follows whichever server answered the sensitive-status request.
Follow-ups
Each of these is a separate pull request in progress. All of them happen on main too.
Checklist
Council review
Background review: 3 rounds, last reviewed c2e4898 (the merged head).
Fixed:
isLoadingError(Opus O1).redis.dbclear (Sol S5).Round 3, answered:
Answered: hidden companion or dependent drafts (Sol S1, Gemini G2, G3, G4), storage transitions refused under storage variables (Gemini G1), and the 412 after a changed value (Gemini G5, Kody) all happen on main and are in Follow-ups. The stale value after a late-acknowledged save (Sol S3) also happens on main, and the save's own settings refetch corrects it.
Visual review: 1 round, captures of the reconnect and different-value cases from an earlier head with the same visible behavior
Answered: every visual finding concerns styling the before captures show too (disabled-input contrast, where the modified dots sit, no confirmation after a successful save, a clipped sidebar item), or the silent drop that Risks describes. The captures of the page-left-open and only-edit cases come from the final head and were checked by the implementer, not the council.
AI Disclosure
🤖 Generated with Claude Code