Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Stop setup reporting a false usage-statistics failure

rcourtman8cb5b0cf227d
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 16109bfdee..feacf66b51 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -8849,6 +8849,15 @@ a neighbouring feature: the alerts Schedule page is "Delivery Schedule" in
every locale, and `i18n.test.ts` refuses a maintenance word in any locale's
title because maintenance windows live elsewhere.
+### A refused setting reports the state the server kept
+
+When a write is refused because the server owns the value (an environment
+lock), the surface reads the effective value before speaking: no message when
+the server already holds what the operator chose, a message naming the
+variable when it holds the opposite, and the generic failure only when the
+state cannot be read. The setup wizard's usage-statistics opt-out follows
+this, and catalog copy keeps the variable name untranslated (`i18n.test.ts`).
+
### Alert overview rows place Investigate by the shared breakpoint
`AlertOverviewAlertCard` reads the shared `useBreakpoint()` hook to decide
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index d425a38003..c03ed7ca4a 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -611,6 +611,15 @@ Renaming the alerts Schedule page title (`alerts.page.schedule.title`) changes
local presentation copy only; it carries no resource data and changes no
request, handoff or model-bound context.
+First-run setup reports the usage-statistics choice truthfully when the server
+owns it. An opt-out written after the admin account exists is refused with
+409 `env_locked` on a server started with `PULSE_TELEMETRY`; the security step
+then reads `/api/system/settings` and says nothing when statistics are already
+off, tells the operator to set `PULSE_TELEMETRY=false` and restart
+(`setup.security.error.telemetryLockedOn`) when the server keeps them on,
+because removing the variable would restore the default (on), and keeps the
+generic failure only when it cannot tell. It never claims statistics are off without reading that they are.
+
Docker and Podman container CPU normalization may expose numeric raw per-core
CPU percent, normalized capacity percent, and reporting host CPU count in
resource or alert metadata. Those fields are operational usage telemetry only;
diff --git a/frontend-modern/browser-verification/ce113fdcec6e1b0d.json b/frontend-modern/browser-verification/ce113fdcec6e1b0d.json
new file mode 100644
index 0000000000..0134872097
--- /dev/null
+++ b/frontend-modern/browser-verification/ce113fdcec6e1b0d.json
@@ -0,0 +1,41 @@
+{
+ "version": 1,
+ "base_sha": "3043244d74a2f62229d2f1a43753b66ecdf28cc6",
+ "verified_at": "2026-10-15T16:02:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx",
+ "frontend-modern/src/i18n/messages.de.ts",
+ "frontend-modern/src/i18n/messages.es.ts",
+ "frontend-modern/src/i18n/messages.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx": "76afc60ef63865b342d84ce13a0ec8c5c9cc96f1ed7185fd163ee7c7b8e0b916",
+ "frontend-modern/src/i18n/messages.de.ts": "48144a30fde27fa14c57926195eb81c4d5619e1334c79d3acf3110364043049d",
+ "frontend-modern/src/i18n/messages.es.ts": "4047738cd720d4f3cd522560ac42c003207aa8c42130e2d39972c2ff3a6af689",
+ "frontend-modern/src/i18n/messages.ts": "792b0760680347aaba627c3eb302af93554817f633a499465aa3bd69bb181417"
+ },
+ "routes": [
+ "/",
+ "/settings/infrastructure"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 800
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "Before (main): a fresh server started with PULSE_TELEMETRY=false, setup with Usage statistics switched off, showed \"Your admin account was created, but usage statistics could not be turned off\" after the 409 env_locked reply",
+ "After: the same setup gets the 409, reads /api/system/settings (telemetryEnabled false), shows no message and continues to Connect your first system",
+ "The locked-on and unreadable cases are covered by SecurityStep tests; the step layout is unchanged at phone width"
+ ],
+ "interactions": [
+ "Started a fresh data directory, verified the bootstrap token, switched Usage statistics off, created the admin account",
+ "Read the network calls: settings update 409, settings read 200, no error toast"
+ ]
+}
diff --git a/frontend-modern/src/components/SetupWizard/__tests__/SecurityStep.test.tsx b/frontend-modern/src/components/SetupWizard/__tests__/SecurityStep.test.tsx
index 7d8d21841e..ea8b20ec0a 100644
--- a/frontend-modern/src/components/SetupWizard/__tests__/SecurityStep.test.tsx
+++ b/frontend-modern/src/components/SetupWizard/__tests__/SecurityStep.test.tsx
@@ -42,6 +42,8 @@ describe('SecurityStep', () => {
beforeEach(() => {
vi.clearAllMocks();
sessionStorage.clear();
+ // Drop queued one-off responses so a test cannot hand its leftovers on.
+ apiFetchJSONMock.mockReset();
apiFetchJSONMock.mockResolvedValue({ success: true });
stubCryptoRandom();
});
@@ -152,6 +154,64 @@ describe('SecurityStep', () => {
expect(showErrorMock).not.toHaveBeenCalled();
});
+ // A server started with PULSE_TELEMETRY refuses the write (409 env_locked).
+ // When it already keeps statistics off, reporting a failure told the
+ // operator Pulse was still sending data.
+ it('reports nothing when the server already keeps usage statistics off', async () => {
+ const onComplete = vi.fn();
+ apiFetchJSONMock
+ .mockResolvedValueOnce({ success: true })
+ .mockRejectedValueOnce(
+ new Error('telemetryEnabled is locked by the PULSE_TELEMETRY environment variable'),
+ )
+ .mockResolvedValueOnce({ telemetryEnabled: false, envOverrides: { PULSE_TELEMETRY: true } });
+
+ render(() => (
+ <SecurityStep
+ state={baseState}
+ updateState={vi.fn()}
+ bootstrapToken="bootstrap-token"
+ onComplete={onComplete}
+ onBack={vi.fn()}
+ />
+ ));
+
+ fireEvent.click(screen.getByRole('button', { name: 'Usage statistics' }));
+ fireEvent.click(screen.getByRole('button', { name: /Create Account & Continue/i }));
+
+ await waitFor(() => expect(onComplete).toHaveBeenCalledOnce());
+ expect(apiFetchJSONMock.mock.calls[2][0]).toBe('/api/system/settings');
+ expect(showErrorMock).not.toHaveBeenCalled();
+ });
+
+ it('names the server setting when it keeps usage statistics on', async () => {
+ const onComplete = vi.fn();
+ apiFetchJSONMock
+ .mockResolvedValueOnce({ success: true })
+ .mockRejectedValueOnce(
+ new Error('telemetryEnabled is locked by the PULSE_TELEMETRY environment variable'),
+ )
+ .mockResolvedValueOnce({ telemetryEnabled: true, envOverrides: { PULSE_TELEMETRY: true } });
+
+ render(() => (
+ <SecurityStep
+ state={baseState}
+ updateState={vi.fn()}
+ bootstrapToken="bootstrap-token"
+ onComplete={onComplete}
+ onBack={vi.fn()}
+ />
+ ));
+
+ fireEvent.click(screen.getByRole('button', { name: 'Usage statistics' }));
+ fireEvent.click(screen.getByRole('button', { name: /Create Account & Continue/i }));
+
+ await waitFor(() => expect(onComplete).toHaveBeenCalledOnce());
+ expect(showErrorMock).toHaveBeenCalledWith(
+ 'Your admin account was created. Usage statistics stay on because this server sets PULSE_TELEMETRY=true. Set PULSE_TELEMETRY=false and restart Pulse to turn them off.',
+ );
+ });
+
it('keeps the account when the opt-out write fails and says so', async () => {
const onComplete = vi.fn();
apiFetchJSONMock
diff --git a/frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx b/frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx
index 35716c367c..c085a84698 100644
--- a/frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx
+++ b/frontend-modern/src/components/SetupWizard/steps/SecurityStep.tsx
@@ -18,6 +18,21 @@ interface SecurityStepProps {
const GENERATED_PASSWORD_LENGTH = 20;
const GENERATED_PASSWORD_CHARS = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789!@#$%';
+// What the server keeps after an opt-out it refused: already off, held on by
+// the PULSE_TELEMETRY environment variable, or unknown.
+const readTelemetryOutcome = async (): Promise<'off' | 'lockedOn' | 'unknown'> => {
+ try {
+ const settings = await SettingsAPI.getSystemSettings();
+ if (settings.telemetryEnabled === false) return 'off';
+ const locked = Boolean(
+ settings.envOverrides?.telemetryEnabled || settings.envOverrides?.PULSE_TELEMETRY,
+ );
+ return locked && settings.telemetryEnabled === true ? 'lockedOn' : 'unknown';
+ } catch {
+ return 'unknown';
+ }
+};
+
export const SecurityStep: Component<SecurityStepProps> = (props) => {
const [username, setUsername] = createSignal(props.state.username || 'admin');
const [useCustomPassword, setUseCustomPassword] = createSignal(false);
@@ -124,7 +139,15 @@ export const SecurityStep: Component<SecurityStepProps> = (props) => {
try {
await SettingsAPI.updateSystemSettings({ telemetryEnabled: false });
} catch {
- showError(t('setup.security.error.telemetryDisableFailed'));
+ // A server started with PULSE_TELEMETRY owns this choice and refuses
+ // the write. Read what it chose rather than report a failure: when
+ // it already keeps statistics off there is nothing to tell.
+ const outcome = await readTelemetryOutcome();
+ if (outcome === 'lockedOn') {
+ showError(t('setup.security.error.telemetryLockedOn'));
+ } else if (outcome !== 'off') {
+ showError(t('setup.security.error.telemetryDisableFailed'));
+ }
}
}
diff --git a/frontend-modern/src/i18n/__tests__/i18n.test.ts b/frontend-modern/src/i18n/__tests__/i18n.test.ts
index b8702b3b45..3bd67acd5a 100644
--- a/frontend-modern/src/i18n/__tests__/i18n.test.ts
+++ b/frontend-modern/src/i18n/__tests__/i18n.test.ts
@@ -482,6 +482,18 @@ describe('i18n foundation', () => {
}
});
+ // The setup message names the environment variable an operator must remove;
+ // a translated name would point at a variable that does not exist.
+ it('keeps PULSE_TELEMETRY untranslated in the setup lock message', () => {
+ for (const locale of ['en', ...FIRST_LOCALIZATION_LOCALES] as const) {
+ // Removing the variable restores the default (on), so the copy must
+ // name the value that turns statistics off.
+ expect(I18N_MESSAGES[locale]['setup.security.error.telemetryLockedOn']).toContain(
+ 'PULSE_TELEMETRY=false',
+ );
+ }
+ });
+
it('keeps machine-facing identifiers unchanged in alerts overview catalog copy', () => {
for (const locale of FIRST_LOCALIZATION_LOCALES) {
expect(I18N_MESSAGES[locale]['alerts.assistant.button.full']).toContain('Pulse Assistant');
diff --git a/frontend-modern/src/i18n/messages.de.ts b/frontend-modern/src/i18n/messages.de.ts
index 299a3eda42..8bb3e45f06 100644
--- a/frontend-modern/src/i18n/messages.de.ts
+++ b/frontend-modern/src/i18n/messages.de.ts
@@ -296,6 +296,8 @@ export const DE_MESSAGE_OVERRIDES = {
'setup.security.error.passwordRequired': 'Bitte geben Sie ein Passwort ein',
'setup.security.error.passwordTooShort': 'Das Passwort muss mindestens 12 Zeichen haben',
'setup.security.error.setupFailed': 'Einrichtung fehlgeschlagen: {error}',
+ 'setup.security.error.telemetryLockedOn':
+ 'Ihr Admin-Konto wurde erstellt. Die Nutzungsstatistiken bleiben eingeschaltet, weil dieser Server PULSE_TELEMETRY=true setzt. Setzen Sie PULSE_TELEMETRY=false und starten Sie Pulse neu, um sie auszuschalten.',
'setup.security.error.telemetryDisableFailed':
'Ihr Admin-Konto wurde erstellt, aber die Nutzungsstatistiken konnten nicht ausgeschaltet werden. Sie koennen sie unter Einstellungen → System → Allgemein ausschalten.',
'setup.security.generatedPasswordHelp':
diff --git a/frontend-modern/src/i18n/messages.es.ts b/frontend-modern/src/i18n/messages.es.ts
index 5aadac2936..d2eed9e69c 100644
--- a/frontend-modern/src/i18n/messages.es.ts
+++ b/frontend-modern/src/i18n/messages.es.ts
@@ -288,6 +288,8 @@ export const ES_MESSAGE_OVERRIDES = {
'setup.security.error.passwordRequired': 'Ingresa una contraseña',
'setup.security.error.passwordTooShort': 'La contraseña debe tener al menos 12 caracteres',
'setup.security.error.setupFailed': 'La configuración falló: {error}',
+ 'setup.security.error.telemetryLockedOn':
+ 'Tu cuenta de administrador se creó. Las estadísticas de uso siguen activadas porque este servidor define PULSE_TELEMETRY=true. Define PULSE_TELEMETRY=false y reinicia Pulse para desactivarlas.',
'setup.security.error.telemetryDisableFailed':
'Tu cuenta de administrador se creó, pero las estadísticas de uso no se pudieron desactivar. Puedes desactivarlas en Ajustes → Sistema → General.',
'setup.security.generatedPasswordHelp':
diff --git a/frontend-modern/src/i18n/messages.ts b/frontend-modern/src/i18n/messages.ts
index 091e4b55a9..5ce7559b72 100644
--- a/frontend-modern/src/i18n/messages.ts
+++ b/frontend-modern/src/i18n/messages.ts
@@ -86,6 +86,8 @@ export const EN_MESSAGES = {
'setup.security.error.setupFailed': 'Setup failed: {error}',
'setup.security.error.telemetryDisableFailed':
'Your admin account was created, but usage statistics could not be turned off. You can turn them off in Settings → System → General.',
+ 'setup.security.error.telemetryLockedOn':
+ 'Your admin account was created. Usage statistics stay on because this server sets PULSE_TELEMETRY=true. Set PULSE_TELEMETRY=false and restart Pulse to turn them off.',
'setup.security.generatedPasswordHelp':
'A secure 20-character password will be generated and shown on the next screen.',
'setup.security.label.confirmPassword': 'Confirm password',
@@ -684,6 +686,7 @@ export const FIRST_SESSION_MONITORING_MIGRATED_MESSAGE_KEYS = [
'setup.security.error.passwordTooShort',
'setup.security.error.setupFailed',
'setup.security.error.telemetryDisableFailed',
+ 'setup.security.error.telemetryLockedOn',
'setup.security.generatedPasswordHelp',
'setup.security.label.confirmPassword',
'setup.security.label.password',