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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(web): discard superseded organisation admission responses
pulse-triage[bot]9a837b8b4082
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.jsonindex 77affab023..b46cd46cba 100644--- a/frontend-modern/browser-verification.json+++ b/frontend-modern/browser-verification.json@@ -1,44 +1,38 @@{"version": 1,- "base_sha": "deac5e7750a79052170ba4396b700a3d6b855e3f",- "verified_at": "2026-09-05T04:03:13Z",+ "base_sha": "58413ebdf6af81018bce15ff4023ca9824c0cdae",+ "verified_at": "2026-09-05T09:32:59.247Z","result": "passed","changed_paths": ["frontend-modern/src/useAppRuntimeState.ts"],"content_sha256": {- "frontend-modern/src/useAppRuntimeState.ts": "01c0eebf2d99994d730c8add6604d1851f89f8a6532cabbc159b44f030b8124b"+ "frontend-modern/src/useAppRuntimeState.ts": "d1de019dad5bff7fcb78116a8cf53663f1ddcd4c631bdbf0260b68580ebe0eb7"},"routes": [- "/proxmox",- "/docker","/alerts",- "/settings"+ "/settings",+ "/docker"],"viewports": [{"width": 1440,"height": 900},- {- "width": 1100,- "height": 900- },{"width": 390,"height": 900}],"states": [- "Isolated real Go backend and production embedded frontend; synthetic Proxmox and Docker inventory; Chromium 141.0.7390.37, fresh contexts, 100% zoom",- "Real connected socket closed with 1013; reconnect attempts blocked while HTTP health stays available",- "Six checks passed at 1440, 1100 and 390 by 900, with and without admission HTTP 503 on recovery; each injected case observed exactly one failed admission request",- "Platform destinations retained through interruption and recovery without document reload; no acknowledgement persistence or notification delivery claim"+ "Full application served by isolated local Vite; synthetic HTTP, two synthetic organisations and cold socket; Chromium 141.0.7390.37, fresh contexts, default zoom.",+ "Six cases: incoming admission fails, succeeds all-false, or completes after outgoing response. Superseded outgoing response cannot restore platform navigation.",+ "Backend tenancy, populated resource rendering, production build, external notification delivery and candidate soak not qualified."],"interactions": [- "pulse-heavy-run -- env PULSE_E2E_USE_LOCAL_BACKEND=1 PULSE_E2E_SKIP_PLAYWRIGHT_INSTALL=1 PULSE_MOCK_MODE=true PULSE_E2E_NAVIGATION_RECOVERY=1 PULSE_E2E_LOCAL_BACKEND_PORT=18765 npm --prefix tests/integration test -- tests/96-navigation-socket-recovery.spec.ts --project=chromium",- "390px before, during and after interruption: open More, Escape, reopen and follow Settings; switch Proxmox and Docker; open Alerts with enabled Acknowledge control and return to Docker",- "1440px: open active incidents during interruption with enabled Acknowledge control; recovered desktop and 390px screenshots inspected",- "Baseline failed at 1440 and 1100 when admission HTTP refresh failed; baseline 390px passed. Focused retention test failed before repair. Repaired run: six browser checks and 107 focused tests pass"+ "pulse-heavy-run -- bash -c 'for w in 390 1440; do for mode in failure success reverse; do PULSE_PROOF_WIDTH=$w PULSE_PROOF_MODE=$mode node scripts/check-navigation-admission-race.mjs || exit; done; done'",+ "Production reconnect subscriber invoked; switch organisation via real selector; release held outgoing response; assert no platform navigation and exact organisation request sequence.",+ "390px: More open, Escape, reopen, Settings; subsequent successful organisation switch restores platform selector; choose Docker and verify route without reload.",+ "1440px: Settings remains visible; subsequent successful switch restores Proxmox destination without reload. Desktop and narrow screenshots inspected."]}diff --git a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts b/frontend-modern/src/__tests__/useAppRuntimeState.test.tsindex 0fe0e3e058..eee99b62d3 100644--- a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts+++ b/frontend-modern/src/__tests__/useAppRuntimeState.test.ts@@ -964,6 +964,61 @@ describe('useAppRuntimeState', () => {dispose();});+ it.each(['failed', 'successful', 'pending'] as const)(+ 'ignores an outgoing tenant refresh after a %s tenant switch request',+ async (completion) => {+ isMultiTenantEnabledMock.mockReturnValue(true);+ const eventsModule = await import('@/stores/events');+ const { dispose, hookState } = mountHook();+ await waitFor(() => {+ expect(hookState.platformAdmission()).not.toBeNull();+ expect(hookState.organizations().some((org) => org.id === 'acme')).toBe(true);+ });+ const outgoing = hookState.platformAdmission();+ let finishOutgoing!: (value: unknown) => void;+ apiFetchJSONMock.mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ finishOutgoing = resolve;+ }),+ );+ const reconnect = (eventsModule.eventBus.on as ReturnType<typeof vi.fn>).mock.calls.find(+ ([event]) => event === 'websocket_reconnected',+ )![1] as () => void;+ reconnect();+ const emptyAdmission = Object.fromEntries(Object.keys(outgoing!).map((key) => [key, false]));+ let finishIncoming!: (value: unknown) => void;+ if (completion === 'failed') {+ apiFetchJSONMock.mockRejectedValue(new Error('503 admission unavailable'));+ } else if (completion === 'successful') {+ apiFetchJSONMock.mockResolvedValue({ aggregations: { platformAdmission: emptyAdmission } });+ } else {+ apiFetchJSONMock.mockImplementation(+ () =>+ new Promise((resolve) => {+ finishIncoming = resolve;+ }),+ );+ }+ hookState.handleOrgSwitch(hookState.activeOrgID() === 'acme' ? 'default' : 'acme');+ await flushAsync();+ expect(hookState.platformAdmission()).toEqual(+ completion === 'successful' ? emptyAdmission : null,+ );+ finishOutgoing({ aggregations: { platformAdmission: outgoing } });+ await flushAsync();+ expect(hookState.platformAdmission()).toEqual(+ completion === 'successful' ? emptyAdmission : null,+ );+ if (completion === 'pending') {+ finishIncoming({ aggregations: { platformAdmission: emptyAdmission } });+ await flushAsync();+ expect(hookState.platformAdmission()).toEqual(emptyAdmission);+ }+ dispose();+ },+ );+it('leaves admission unresolved when the first request fails', async () => {apiFetchJSONMock.mockRejectedValue(new Error('503 admission unavailable'));const { dispose, hookState } = mountHook();diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.tsindex 5adc9d99f7..2f23444333 100644--- a/frontend-modern/src/useAppRuntimeState.ts+++ b/frontend-modern/src/useAppRuntimeState.ts@@ -297,13 +297,18 @@ export const useAppRuntimeState = () => {return Object.fromEntries(flags) as PlatformNavigationVisibility;};+ let platformAdmissionRequest = 0;const loadPlatformAdmission = async () => {+ const request = ++platformAdmissionRequest;try {// One resource is enough: the aggregations describe the whole set, so// this resolves navigation without reading an estate-sized payload.const payload = await apiFetchJSON<{ aggregations?: { platformAdmission?: unknown } }>('/api/resources?page=1&limit=1',);+ // A tenant switch or newer refresh supersedes this response, even if+ // that newer request failed. Never restore an outgoing tenant facet.+ if (request !== platformAdmissionRequest) return;setPlatformAdmission(normalizePlatformAdmission(payload?.aggregations?.platformAdmission));} catch (error) {// A failed refresh says nothing about which platforms still exist.diff --git a/scripts/check-navigation-admission-race.mjs b/scripts/check-navigation-admission-race.mjsnew file mode 100644index 0000000000..275aacb7da--- /dev/null+++ b/scripts/check-navigation-admission-race.mjs@@ -0,0 +1,274 @@+// Full application, real organisation selector; synthetic HTTP and cold socket.+// Run with PULSE_PROOF_WIDTH=390|1440 and PULSE_PROOF_MODE=failure|success|reverse.+// pulse-heavy-run -- node scripts/check-navigation-admission-race.mjs+import { createServer } from "../frontend-modern/node_modules/vite/dist/node/index.js";+import {+ chromium,+ expect,+} from "../tests/integration/node_modules/@playwright/test/index.mjs";+import { fileURLToPath } from "node:url";+import { mkdir, rm, writeFile } from "node:fs/promises";+import { createHash } from "node:crypto";+import { readFileSync } from "node:fs";++const repo = fileURLToPath(new URL("../", import.meta.url));+const root = `${repo}frontend-modern`;+const width = Number(process.env.PULSE_PROOF_WIDTH || 1440);+const mode = process.env.PULSE_PROOF_MODE || "failure";+if (+ ![390, 1440].includes(width) ||+ !["failure", "success", "reverse"].includes(mode)+) {+ throw new Error("Use width 390 or 1440 and mode failure, success or reverse");+}+const phase =+ process.env.PULSE_PROOF_PHASE === "baseline" ? "baseline" : "repaired";+const output = `${repo}tmp/navigation-admission-race/${phase}-${width}-${mode}`;+const emptyAdmission = {+ aggregations: {+ platformAdmission: {+ proxmox: false,+ docker: false,+ kubernetes: false,+ truenas: false,+ vmware: false,+ standalone: false,+ },+ },+};+await mkdir(output, { recursive: true });+await rm(`${output}/result.json`, { force: true });+process.chdir(root);+const server = await createServer({+ root,+ configFile: `${root}/vite.config.ts`,+ server: { host: "127.0.0.1", port: 5199, strictPort: true },+});+let browser;+try {+ await server.listen();+ browser = await chromium.launch({ headless: true });+ const page = await browser.newPage({ viewport: { width, height: 900 } });+ const errors = [];+ page.on("pageerror", (error) => errors.push(error.message));+ await page.route("**/*", (route) =>+ new URL(route.request().url()).origin === "http://127.0.0.1:5199"+ ? route.continue()+ : route.abort(),+ );+ // No resource snapshot: admission, rather than inventory, must decide tabs.+ await page.routeWebSocket("**/ws*", () => {});+ let outgoing;+ let incoming;+ let hold = false;+ let failed = 0;+ const requests = [];+ await page.route(+ (url) => url.pathname.startsWith("/api/"),+ async (route) => {+ const url = new URL(route.request().url());+ const path = url.pathname;+ const json = (data) => route.fulfill({ json: data });+ if (path === "/api/resources") {+ if (+ url.searchParams.get("page") === "1" &&+ url.searchParams.get("limit") === "1"+ ) {+ requests.push(+ route.request().headers()["x-pulse-org-id"] || "default",+ );+ if (!hold)+ return json({+ aggregations: {+ platformAdmission: {+ proxmox: true,+ docker: true,+ kubernetes: false,+ truenas: false,+ vmware: false,+ standalone: false,+ },+ },+ });+ if (!outgoing) {+ outgoing = route;+ return;+ }+ incoming = route;+ if (mode === "reverse") return;+ if (mode === "success") return json(emptyAdmission);+ failed++;+ return route.fulfill({+ status: 503,+ json: { error: "Synthetic admission failure" },+ });+ }+ return json({ resources: [], total: 0, aggregations: {} });+ }+ if (path === "/api/orgs")+ return json([+ { id: "default", displayName: "Default Organization" },+ { id: "acme", displayName: "Acme" },+ ]);+ if (path === "/api/license/runtime-capabilities")+ return json({+ capabilities: ["multi_tenant"],+ limits: [],+ hosted_mode: false,+ max_history_days: 7,+ });+ if (path === "/api/security/status")+ return json({ hasAuthentication: true, sessionCapabilities: {} });+ if (path === "/api/version")+ return json({ version: "6.5.0-test", isDevelopment: true });+ if (path === "/api/health") return json({ status: "healthy" });+ if (path === "/api/alerts/active") return json([]);+ return json({ data: [], policy: {} });+ },+ );+ await page.goto("http://127.0.0.1:5199/alerts");+ const org = page.getByLabel("Organization", { exact: true });+ await expect(org)+ .toBeVisible({ timeout: 60_000 })+ .catch(async (error) => {+ console.error(errors, await page.locator("body").innerText());+ throw error;+ });+ hold = true;+ // Exercise the production reconnect subscriber without replacing its store.+ await page.evaluate(async () =>+ (await import("/src/stores/events.ts")).eventBus.emit(+ "websocket_reconnected",+ ),+ );+ await expect.poll(() => Boolean(outgoing)).toBe(true);+ const documentIdentity = await page.evaluate(() => performance.timeOrigin);+ await org.selectOption("acme");+ await expect(org).toHaveValue("acme");+ await expect.poll(() => Boolean(incoming)).toBe(true);+ if (mode !== "reverse") {+ await expect+ .poll(() =>+ incoming+ .request()+ .response()+ .then((r) => r?.status()),+ )+ .toBe(mode === "failure" ? 503 : 200);+ }+ const nav = page.getByRole("navigation", {+ name: width < 1280 ? "Mobile navigation" : "Primary navigation",+ exact: true,+ });+ const platform =+ width < 1280+ ? nav.locator('[data-tab-id="platform-switcher"]')+ : nav.getByRole("link", { name: /Proxmox/ });+ await expect(platform).toHaveCount(0);+ const response = page.waitForResponse(+ (r) =>+ r.url().includes("/api/resources?page=1&limit=1") && r.status() === 200,+ );+ await outgoing.fulfill({+ json: {+ aggregations: {+ platformAdmission: {+ proxmox: true,+ docker: true,+ kubernetes: false,+ truenas: false,+ vmware: false,+ standalone: false,+ },+ },+ },+ });+ await (await response).finished();+ // Give the fetch continuation and Solid render a browser task and two frames.+ await page.evaluate(+ () =>+ new Promise((resolve) =>+ setTimeout(+ () => requestAnimationFrame(() => requestAnimationFrame(resolve)),+ 100,+ ),+ ),+ );+ // Remove the transient switch toast so the narrow navigation is inspectable.+ const dismiss = page.getByRole("button", { name: "Dismiss notification" });+ for (const button of await dismiss.all()) await button.click();+ await expect(dismiss).toHaveCount(0);+ await page.screenshot({ path: `${output}/after-outgoing-response.png` });+ await expect(platform).toHaveCount(0);+ expect(requests).toEqual(["default", "default", "acme"]);+ expect(failed).toBe(mode === "failure" ? 1 : 0);+ if (mode === "reverse") {+ const newestResponse = page.waitForResponse(+ (r) => r.request() === incoming.request(),+ );+ await incoming.fulfill({ json: emptyAdmission });+ await (await newestResponse).finished();+ await expect(platform).toHaveCount(0);+ }+ if (width < 1280) {+ await nav+ .getByRole("button", { name: "More navigation", exact: true })+ .click();+ const more = page.getByRole("menu", {+ name: "More navigation destinations",+ });+ await expect(+ more.getByRole("menuitem", { name: /Settings/ }),+ ).toBeVisible();+ await page.keyboard.press("Escape");+ await expect(more).toBeHidden();+ await nav+ .getByRole("button", { name: "More navigation", exact: true })+ .click();+ await more.getByRole("menuitem", { name: /Settings/ }).click();+ await expect(page).toHaveURL(/\/settings/);+ } else {+ await expect(nav.getByRole("link", { name: /Settings/ })).toBeVisible();+ }+ // A subsequent successful organisation request must still restore navigation.+ hold = false;+ await org.selectOption("default");+ await expect(platform).toBeVisible();+ expect(requests).toEqual(["default", "default", "acme", "default"]);+ if (width < 1280) {+ await platform.click();+ const menu = page.getByRole("menu", {+ name: "Switch platform",+ exact: true,+ });+ await menu.getByRole("menuitem", { name: "Docker", exact: true }).click();+ await expect(page).toHaveURL(/\/docker/);+ await expect(menu).toBeHidden();+ await page.screenshot({ path: `${output}/recovered-navigation.png` });+ }+ expect(await page.evaluate(() => performance.timeOrigin)).toBe(+ documentIdentity,+ );+ expect(errors).toEqual([]);+ const result = {+ result: "passed",+ browser: browser.version(),+ viewport: { width, height: 900 },+ mode,+ phase,+ requests,+ failed,+ verified_at: new Date().toISOString(),+ source_sha256: createHash("sha256")+ .update(readFileSync(`${root}/src/useAppRuntimeState.ts`))+ .digest("hex"),+ };+ await writeFile(+ `${output}/result.json`,+ JSON.stringify(result, null, 2) + "\n",+ );+ console.log(JSON.stringify(result));+} finally {+ await browser?.close();+ await server.close();+}diff --git a/tests/qualification/navigation-reconnect/README.md b/tests/qualification/navigation-reconnect/README.mdindex 31ee19b8fa..344a647252 100644--- a/tests/qualification/navigation-reconnect/README.md+++ b/tests/qualification/navigation-reconnect/README.md@@ -110,3 +110,58 @@ the repaired runtime source bytes; baseline artifacts are retained locally in`tmp/navigation-admission-baseline/`, repaired artifacts in`tests/integration/test-results/` and `tests/integration/playwright-report/`.These local artifacts are not release qualification or automatic CI admission.++## Superseded organisation admission — responsive qualification++The isolated main-derived base `58413ebdf6af81018bce15ff4023ca9824c0cdae`+allows an outstanding outgoing organisation admission response to restore its+platform destinations after switching organisations. This is a separate+request-ordering defect, not evidence that #1899 involves organisation switching+or that resource data crosses tenant boundaries.++The repair permits only the latest admission request to update navigation.+A newer failed request still supersedes an older successful response; a newer+successful all-false response remains authoritative. There is no API, entitlement,+navigation design, retry or polling change.++Repeat the bounded full-app experiment after locked dependency installation in+`frontend-modern` and `tests/integration`:++```sh+pulse-heavy-run -- bash -c '+ for width in 390 1440; do+ for mode in failure success reverse; do+ PULSE_PROOF_WIDTH=$width PULSE_PROOF_MODE=$mode \+ node scripts/check-navigation-admission-race.mjs || exit+ done+ done+'+```++This uses local Vite, fresh Chromium contexts, synthetic HTTP responses for two+organisations and a cold synthetic socket. It invokes the production reconnect+subscriber and real organisation selector, not a replacement application store.+It is deliberately a frontend ordering experiment, not real-backend tenancy or+production-build qualification.++Six repaired cases pass at 390×900 and 1440×900 in Chromium 141.0.7390.37+at default zoom: newer admission fails, newer admission succeeds with no+platforms, and the outgoing response completes before the pending newer success.+All cases retain system navigation and restore platform navigation on a subsequent+successful switch without document reload. Narrow cases open More, dismiss with+Escape, reopen and follow Settings, then switch to Docker after recovery.+The synthetic inventory is empty; this proves route/control access, not loaded+resource rendering or alert acknowledgement.++Per-case screenshots, request sequences and exact runtime SHA-256 receipts are+written to `tmp/navigation-admission-race/repaired-<width>-<mode>/`.+Run the failure mode on the base source with `PULSE_PROOF_PHASE=baseline`+to retain separate baseline artifacts. Desktop and narrow baseline failure occurs+after the outgoing response restores platform navigation. Three focused ordering+regressions also discriminate the base; repaired runtime/architecture checks total+59 passes, and frontend typecheck passes.++This completes the missing narrow synthetic-browser coverage from the withdrawn+ordering proposal. Exact-candidate backend operation, reporter browser/proxy+behaviour, resource isolation, external alert delivery and release soak remain+unqualified. No released fix or issue closure is implied.