From 20446e50ff157e4f1ccda47b57f71d369b8672b4 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 18:34:55 +0000 Subject: [PATCH 1/2] fix(web): show no Pending chip before a server has ever started Advanced security showed "Pending" on every setting of a server that has never started, because a missing applied record compared unequal to the desired value. Pending now needs an applied record (FR-009, data-model.md). The test for a never-started server now expects no Pending chip (signed off by the maintainer). Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- web/src/components/SecurityAdvanced.test.tsx | 2 +- web/src/components/SecurityAdvanced.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/components/SecurityAdvanced.test.tsx b/web/src/components/SecurityAdvanced.test.tsx index 17748def2..01635dc28 100644 --- a/web/src/components/SecurityAdvanced.test.tsx +++ b/web/src/components/SecurityAdvanced.test.tsx @@ -264,7 +264,7 @@ describe("SecurityAdvanced", () => { expect(screen.getByText("Next start: 0")).toBeInTheDocument(); expect(screen.getByText("Override")).toBeInTheDocument(); expect(screen.queryByText(/^Applied:/)).not.toBeInTheDocument(); - expect(screen.getByText("Pending: 0 · applies on the next restart")).toBeInTheDocument(); + expect(screen.queryByText(/^Pending:/)).not.toBeInTheDocument(); }); it.each<{ source: SecuritySource; value?: number; line: string; chip: string }>([ diff --git a/web/src/components/SecurityAdvanced.tsx b/web/src/components/SecurityAdvanced.tsx index 5f6425003..820733e54 100644 --- a/web/src/components/SecurityAdvanced.tsx +++ b/web/src/components/SecurityAdvanced.tsx @@ -141,7 +141,9 @@ function SettingStatus({ applied, desired }: { applied?: StatusEntry; desired?: const shown = applied ?? desired; if (shown === undefined) return null; const shownText = entryText(intl, shown); - const pending = desired !== undefined && entryKey(desired) !== entryKey(applied); + // Pending means a saved change the running server has not applied yet, so a + // server that has never started (no applied record) shows none (FR-009). + const pending = applied !== undefined && desired !== undefined && entryKey(desired) !== entryKey(applied); return (
From 887278be57e3dec94a153004af25efc1b29a7d4a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 18:38:28 +0000 Subject: [PATCH 2/2] docs(web): describe when Advanced security shows the Pending chip Also notes that the create wizard clears overrides when the template changes (#977). Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- web/specs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/specs.md b/web/specs.md index 116692196..3bb3130dc 100644 --- a/web/specs.md +++ b/web/specs.md @@ -1090,11 +1090,11 @@ Save fetches the latest server and applies only the changes from the original ba ## Server security overrides (spec 030) -One shared editor, `SecurityAdvanced` (`web/src/components/SecurityAdvanced.tsx`), edits `spec.security` on a GameServer: `runAsUser`, `runAsGroup` and `fsGroup` (each a whole number 0 to 4294967295, or "use image default" where the image's own user is kept) and `volumeOwnershipCheck` (`EveryStart` or `OnlyWhenWrong`). It shows each module default from the template's `spec.security` next to the override, the desired and applied values and the `pending` flag from `status.security`, and a root-override notice. It exports `isValidSecurityId`, `securityOverrideCount` and `securityIsValid`. The operator decides what applies; the component only edits the spec. Unset fields are left out of the payload, and an empty override is omitted entirely. +One shared editor, `SecurityAdvanced` (`web/src/components/SecurityAdvanced.tsx`), edits `spec.security` on a GameServer: `runAsUser`, `runAsGroup` and `fsGroup` (each a whole number 0 to 4294967295, or "use image default" where the image's own user is kept) and `volumeOwnershipCheck` (`EveryStart` or `OnlyWhenWrong`). It shows each module default from the template's `spec.security` next to the override, the desired and applied values from `status.security`, and a root-override notice. A setting shows "Applied: X" once the server has an applied record, and "Next start: X" (the desired value) before it has ever started. The "Pending: X · applies on the next restart" chip appears only when an applied record exists and the desired value differs from it, so a server that has never started shows no Pending chip (FR-009). It exports `isValidSecurityId`, `securityOverrideCount` and `securityIsValid`. The operator decides what applies; the component only edits the spec. Unset fields are left out of the payload, and an empty override is omitted entirely. Three places mount it: -- **Create server wizard** (`web/src/routes/CreateServer.tsx`, Configure step): an "Advanced" section below the other fields. The Configure step cannot continue while a typed value is not a valid ID (`securityDraftValid`). Its `server.security.*` refusals show as a "Not created: security settings refused" error with the API's message. The section is read-only when the session lacks `servers:security` (`can(me, "servers:security", ...)`). +- **Create server wizard** (`web/src/routes/CreateServer.tsx`, Configure step): an "Advanced" section below the other fields. The Configure step cannot continue while a typed value is not a valid ID (`securityDraftValid`). Picking a different template clears the overrides, since they were chosen (and any risky value confirmed) against the previous module. Its `server.security.*` refusals show as a "Not created: security settings refused" error with the API's message. The section is read-only when the session lacks `servers:security` (`can(me, "servers:security", ...)`). - **Server Settings, Security section** (`web/src/routes/tabs/settings/Security.tsx`, `SecuritySection`; registered in `web/src/routes/tabs/Settings.tsx` as the `security` section, with `Lock` icon): it wraps `SecurityAdvanced` in the settings draft. The section is read-only without `servers:security`, and the tab's Save footer applies it like any other section. Saving a changed `runAsUser` or `runAsGroup` on a server whose `status.security.applied` is set (it has already started, so it has data) opens a confirmation (`needsFileAccessWarning`): files written earlier keep their old owner, and saving does not restart the server. - **Cluster Security panel** (`web/src/components/clusters/SecuritySettingsPanel.tsx`, mounted in `ClusterConfiguration.tsx` for every cluster): the cluster-wide `allowRootOverrides` switch. Without `config:read` the section shows a no-permission note instead of the switch, and the switch is editable only with `config:manage`. It reads and writes `GET`/`PUT /security-settings?cluster=` through `SecuritySettings` in `web/src/lib/endpoints.ts`. A 409 or the `server.cluster.security_settings_missing` message ID (or a response with `present: false`) shows a "Security settings missing" alert and disables the switch. Register Cluster (`RegisterClusterDialog.tsx`) has an optional control-plane namespace field (lowercase DNS label, default `gameplane`) sent as `controlPlaneNamespace` only when it differs from `gameplane`, and the cluster overview shows that namespace for remote clusters.