diff --git a/docs/ALERTING.md b/docs/ALERTING.md index 2d3b87dbfa..a3a1609d5c 100644 --- a/docs/ALERTING.md +++ b/docs/ALERTING.md @@ -253,7 +253,11 @@ watchdog or deliver notifications while Pulse is down. A successful watchdog heartbeat means the receiver heard from Pulse. Pulse sends it based on recent activity in the monitoring loop, not on whether polls finished, agent reports were accepted or alert rules ran. A `200` from -`/api/health` only means the web server answered. +`/api/health` only means the web server answered. On standalone servers, +`/api/health` can also report `websocketStateStalled: true` (which surfaces an +amber **Updates stalled** warning in the dashboard header), while its absence +still does not prove polls finished, agent reports were applied or alert rules +ran. If readings look frozen while the monitored systems still respond, check each collection path separately, allowing for normal poll and report intervals and diff --git a/docs/API.md b/docs/API.md index b37403ad71..6e8d4ec3a2 100644 --- a/docs/API.md +++ b/docs/API.md @@ -302,6 +302,18 @@ the shared WebSocket slot for at least 30 seconds. It clears when the slot is released. Hosted and multi-workspace modes omit it. An absent flag does not prove readiness. Preserve evidence; do not repeat state requests or auto-restart. +Signed-in browser sessions poll `GET /api/health` (`cache: 'no-store'`) every +30 seconds while connected with initial data (15 seconds while waiting for the +first snapshot or disconnected, 5 seconds while reconnecting). While +`websocketStateStalled: true` holds and the backend is reachable or the +WebSocket is connected, the dashboard header replaces **Connected** (or +**Waiting for data**, **Sync reconnecting**, or **Backend healthy**) with an +amber **Updates stalled** badge (`Backend is reachable, but live dashboard +state updates are stalled.`), clearing automatically once the flag clears. An +absent flag or green **Connected** badge (`Live updates are connected. Source +readings may be older.`) still does not prove fresh polling, applied agent +reports, or alert evaluation. + ### System State `GET /api/state` Returns the complete state of your infrastructure (Nodes, VMs, Containers, Storage, Alerts). This is the main endpoint used by the dashboard. diff --git a/docs/FAQ.md b/docs/FAQ.md index 32b1b3726e..05085d6585 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -326,6 +326,17 @@ does not tell you whether alert rules ran. A green connection badge, recent **Last seen** or successful **Test Connection** does not prove that every reading is fresh. Missing or unavailable is not zero. +- **Dashboard header connection badge:** While signed in, Pulse polls + `GET /api/health` in the background. On standalone servers, if + `GET /api/health` reports `websocketStateStalled: true`, the header shows an + always-visible amber **Updates stalled** badge (`Backend is reachable, but + live dashboard state updates are stalled.`) on both desktop and phones instead + of green **Connected**, clearing automatically when the backend releases the + state-build slot. **Waiting for data** means the WebSocket connected before + the first dashboard snapshot arrived. Hosted and multi-workspace servers omit + `websocketStateStalled`, and even a green **Connected** badge (`Live updates + are connected. Source readings may be older.`) does not prove that individual + pollers, agents, or alert rules are current. - **Proxmox nodes** show reading status beside the node name on both desktop and phones, withholding live metrics and uptime when readings are not current: **Offline** (a failed Proxmox read does not prove the host is powered off), diff --git a/docs/REVERSE_PROXY.md b/docs/REVERSE_PROXY.md index 8f4c38397c..4ebba18c14 100644 --- a/docs/REVERSE_PROXY.md +++ b/docs/REVERSE_PROXY.md @@ -182,7 +182,7 @@ HTTP/error status, not cookies, proxy secrets or a full network export. ### Other Issues -- **"Connection lost" (Workloads), "Disconnected", "Reconnecting...", "Sync reconnecting", "Backend healthy" or a stuck "Connecting to Pulse" screen:** separate the WebSocket upgrade from state delivery. If an already-observed upgrade failed through this proxy, check its `Upgrade` and `Connection` forwarding. An HTTP 101 or welcome message without subsequent state is a different failure; changing those headers is not an established remedy. Use the [stalled-dashboard guidance](TROUBLESHOOTING.md#health-is-green-but-the-dashboard-is-stalled), even if `/api/health` returns 200. Keep authentication, TLS and origin checks enabled; do not expose the backend to test a bypass. +- **"Connection lost" (Workloads), "Disconnected", "Reconnecting...", "Sync reconnecting", "Backend healthy", "Waiting for data", "Updates stalled" or a stuck "Connecting to Pulse" screen:** separate the WebSocket upgrade from state delivery. If an already-observed upgrade failed through this proxy, check its `Upgrade` and `Connection` forwarding. An HTTP 101 or welcome message without subsequent state is a different failure, and changing those headers is not an established remedy. **Waiting for data** means the WebSocket connected before the first dashboard snapshot arrived, and on standalone servers an amber **Updates stalled** badge means `GET /api/health` reported `websocketStateStalled: true` (`Backend is reachable, but live dashboard state updates are stalled.`). Neither is fixed by changing proxy headers. Use the [stalled-dashboard guidance](TROUBLESHOOTING.md#health-is-green-but-the-dashboard-is-stalled), even if `/api/health` returns 200. Keep authentication, TLS and origin checks enabled, and do not expose the backend to test a bypass. - **502 Bad Gateway**: Check Pulse's actual listener and the proxy's upstream address, port and network reachability; this does not by itself prove Pulse is stopped. Container `localhost` refers to that container, not another service. - **403 CSRF origin validation failed**: Pulse blocked a browser write whose origin did not match its expected scheme, host and port, or arrived cross-site through a proxy attaching proxy-auth, Basic or API-token credentials. Check that the proxy preserves the public `Host` header, sends `X-Forwarded-Proto: https` on TLS routes and is listed in `PULSE_TRUSTED_PROXY_CIDRS`. Do not strip browser origin headers in a credential-injecting proxy. - **CORS Errors**: Do not add CORS headers in the proxy. Pulse handles them. Set **Settings → System → Network → CORS Allowed Origins** (`/settings/system-network`) or use `ALLOWED_ORIGINS` if needed. diff --git a/docs/UPGRADE_v6.md b/docs/UPGRADE_v6.md index d537eab071..82ae982783 100644 --- a/docs/UPGRADE_v6.md +++ b/docs/UPGRADE_v6.md @@ -270,7 +270,11 @@ command, URL or report. release or a completed download. `GET /api/version` reports the server version; a valid signature is not completed installation or healthy operation. - Observe ordinary polling, current readings and their original source/time. - A green connection badge or response from `/api/health` does not prove every + An amber **Updates stalled** badge in the header means `GET /api/health` + reported `websocketStateStalled: true` on a standalone server (the backend is + reachable, but live dashboard state updates are stalled), and **Waiting for + data** means the WebSocket connected before the first snapshot arrived. A + green connection badge or response from `/api/health` does not prove every collector recovered. Read-only `GET /api/monitoring/scheduler/health` and `GET /api/resources` can supplement, not replace, those observations. - Check ordinary notification delivery already observed and its destination/ diff --git a/frontend-modern/public/docs/ALERTING.md b/frontend-modern/public/docs/ALERTING.md index 2d3b87dbfa..a3a1609d5c 100644 --- a/frontend-modern/public/docs/ALERTING.md +++ b/frontend-modern/public/docs/ALERTING.md @@ -253,7 +253,11 @@ watchdog or deliver notifications while Pulse is down. A successful watchdog heartbeat means the receiver heard from Pulse. Pulse sends it based on recent activity in the monitoring loop, not on whether polls finished, agent reports were accepted or alert rules ran. A `200` from -`/api/health` only means the web server answered. +`/api/health` only means the web server answered. On standalone servers, +`/api/health` can also report `websocketStateStalled: true` (which surfaces an +amber **Updates stalled** warning in the dashboard header), while its absence +still does not prove polls finished, agent reports were applied or alert rules +ran. If readings look frozen while the monitored systems still respond, check each collection path separately, allowing for normal poll and report intervals and diff --git a/frontend-modern/public/docs/API.md b/frontend-modern/public/docs/API.md index b37403ad71..6e8d4ec3a2 100644 --- a/frontend-modern/public/docs/API.md +++ b/frontend-modern/public/docs/API.md @@ -302,6 +302,18 @@ the shared WebSocket slot for at least 30 seconds. It clears when the slot is released. Hosted and multi-workspace modes omit it. An absent flag does not prove readiness. Preserve evidence; do not repeat state requests or auto-restart. +Signed-in browser sessions poll `GET /api/health` (`cache: 'no-store'`) every +30 seconds while connected with initial data (15 seconds while waiting for the +first snapshot or disconnected, 5 seconds while reconnecting). While +`websocketStateStalled: true` holds and the backend is reachable or the +WebSocket is connected, the dashboard header replaces **Connected** (or +**Waiting for data**, **Sync reconnecting**, or **Backend healthy**) with an +amber **Updates stalled** badge (`Backend is reachable, but live dashboard +state updates are stalled.`), clearing automatically once the flag clears. An +absent flag or green **Connected** badge (`Live updates are connected. Source +readings may be older.`) still does not prove fresh polling, applied agent +reports, or alert evaluation. + ### System State `GET /api/state` Returns the complete state of your infrastructure (Nodes, VMs, Containers, Storage, Alerts). This is the main endpoint used by the dashboard. diff --git a/frontend-modern/public/docs/FAQ.md b/frontend-modern/public/docs/FAQ.md index 32b1b3726e..05085d6585 100644 --- a/frontend-modern/public/docs/FAQ.md +++ b/frontend-modern/public/docs/FAQ.md @@ -326,6 +326,17 @@ does not tell you whether alert rules ran. A green connection badge, recent **Last seen** or successful **Test Connection** does not prove that every reading is fresh. Missing or unavailable is not zero. +- **Dashboard header connection badge:** While signed in, Pulse polls + `GET /api/health` in the background. On standalone servers, if + `GET /api/health` reports `websocketStateStalled: true`, the header shows an + always-visible amber **Updates stalled** badge (`Backend is reachable, but + live dashboard state updates are stalled.`) on both desktop and phones instead + of green **Connected**, clearing automatically when the backend releases the + state-build slot. **Waiting for data** means the WebSocket connected before + the first dashboard snapshot arrived. Hosted and multi-workspace servers omit + `websocketStateStalled`, and even a green **Connected** badge (`Live updates + are connected. Source readings may be older.`) does not prove that individual + pollers, agents, or alert rules are current. - **Proxmox nodes** show reading status beside the node name on both desktop and phones, withholding live metrics and uptime when readings are not current: **Offline** (a failed Proxmox read does not prove the host is powered off), diff --git a/frontend-modern/public/docs/REVERSE_PROXY.md b/frontend-modern/public/docs/REVERSE_PROXY.md index 8f4c38397c..4ebba18c14 100644 --- a/frontend-modern/public/docs/REVERSE_PROXY.md +++ b/frontend-modern/public/docs/REVERSE_PROXY.md @@ -182,7 +182,7 @@ HTTP/error status, not cookies, proxy secrets or a full network export. ### Other Issues -- **"Connection lost" (Workloads), "Disconnected", "Reconnecting...", "Sync reconnecting", "Backend healthy" or a stuck "Connecting to Pulse" screen:** separate the WebSocket upgrade from state delivery. If an already-observed upgrade failed through this proxy, check its `Upgrade` and `Connection` forwarding. An HTTP 101 or welcome message without subsequent state is a different failure; changing those headers is not an established remedy. Use the [stalled-dashboard guidance](TROUBLESHOOTING.md#health-is-green-but-the-dashboard-is-stalled), even if `/api/health` returns 200. Keep authentication, TLS and origin checks enabled; do not expose the backend to test a bypass. +- **"Connection lost" (Workloads), "Disconnected", "Reconnecting...", "Sync reconnecting", "Backend healthy", "Waiting for data", "Updates stalled" or a stuck "Connecting to Pulse" screen:** separate the WebSocket upgrade from state delivery. If an already-observed upgrade failed through this proxy, check its `Upgrade` and `Connection` forwarding. An HTTP 101 or welcome message without subsequent state is a different failure, and changing those headers is not an established remedy. **Waiting for data** means the WebSocket connected before the first dashboard snapshot arrived, and on standalone servers an amber **Updates stalled** badge means `GET /api/health` reported `websocketStateStalled: true` (`Backend is reachable, but live dashboard state updates are stalled.`). Neither is fixed by changing proxy headers. Use the [stalled-dashboard guidance](TROUBLESHOOTING.md#health-is-green-but-the-dashboard-is-stalled), even if `/api/health` returns 200. Keep authentication, TLS and origin checks enabled, and do not expose the backend to test a bypass. - **502 Bad Gateway**: Check Pulse's actual listener and the proxy's upstream address, port and network reachability; this does not by itself prove Pulse is stopped. Container `localhost` refers to that container, not another service. - **403 CSRF origin validation failed**: Pulse blocked a browser write whose origin did not match its expected scheme, host and port, or arrived cross-site through a proxy attaching proxy-auth, Basic or API-token credentials. Check that the proxy preserves the public `Host` header, sends `X-Forwarded-Proto: https` on TLS routes and is listed in `PULSE_TRUSTED_PROXY_CIDRS`. Do not strip browser origin headers in a credential-injecting proxy. - **CORS Errors**: Do not add CORS headers in the proxy. Pulse handles them. Set **Settings → System → Network → CORS Allowed Origins** (`/settings/system-network`) or use `ALLOWED_ORIGINS` if needed. diff --git a/frontend-modern/public/docs/UPGRADE_v6.md b/frontend-modern/public/docs/UPGRADE_v6.md index d537eab071..82ae982783 100644 --- a/frontend-modern/public/docs/UPGRADE_v6.md +++ b/frontend-modern/public/docs/UPGRADE_v6.md @@ -270,7 +270,11 @@ command, URL or report. release or a completed download. `GET /api/version` reports the server version; a valid signature is not completed installation or healthy operation. - Observe ordinary polling, current readings and their original source/time. - A green connection badge or response from `/api/health` does not prove every + An amber **Updates stalled** badge in the header means `GET /api/health` + reported `websocketStateStalled: true` on a standalone server (the backend is + reachable, but live dashboard state updates are stalled), and **Waiting for + data** means the WebSocket connected before the first snapshot arrived. A + green connection badge or response from `/api/health` does not prove every collector recovered. Read-only `GET /api/monitoring/scheduler/health` and `GET /api/resources` can supplement, not replace, those observations. - Check ordinary notification delivery already observed and its destination/ diff --git a/frontend-modern/src/features/docs/__tests__/dashboardReadinessGuide.test.ts b/frontend-modern/src/features/docs/__tests__/dashboardReadinessGuide.test.ts index 79cbe7480a..ab3ef1bd28 100644 --- a/frontend-modern/src/features/docs/__tests__/dashboardReadinessGuide.test.ts +++ b/frontend-modern/src/features/docs/__tests__/dashboardReadinessGuide.test.ts @@ -109,6 +109,62 @@ describe('dashboard readiness guidance', () => { ); }); + it('documents the Updates stalled and Waiting for data header badges across Help guides', () => { + const health = text(section('API', 'System Health')); + expect(health).toMatch( + /poll GET \/api\/health \(cache: 'no-store'\) every 30 seconds while connected with initial data \(15 seconds while waiting for the first snapshot or disconnected, 5 seconds while reconnecting\)/, + ); + expect(health).toMatch( + /replaces Connected \(or Waiting for data, Sync reconnecting, or Backend healthy\) with an amber Updates stalled badge \(Backend is reachable, but live dashboard state updates are stalled\.\)/, + ); + expect(health).toMatch(/clearing automatically once the flag clears/); + expect(health).toMatch( + /green Connected badge \(Live updates are connected\. Source readings may be older\.\) still does not prove fresh polling, applied agent reports, or alert evaluation/, + ); + + const proxy = text(section('REVERSE_PROXY', 'Other Issues')); + expect(proxy).toMatch(/"Waiting for data", "Updates stalled"/); + expect(proxy).toMatch( + /Waiting for data means the WebSocket connected before the first dashboard snapshot arrived/, + ); + expect(proxy).toMatch( + /amber Updates stalled badge means GET \/api\/health reported websocketStateStalled: true \(Backend is reachable, but live dashboard state updates are stalled\.\)/, + ); + expect(proxy).toMatch(/Neither is fixed by changing proxy headers/); + + const faq = text(section('FAQ', 'No data showing?')); + expect(faq).toMatch( + /Dashboard header connection badge:.*GET \/api\/health.*websocketStateStalled: true.*amber Updates stalled badge \(Backend is reachable, but live dashboard state updates are stalled\.\) on both desktop and phones/, + ); + expect(faq).toMatch( + /Waiting for data means the WebSocket connected before the first dashboard snapshot arrived/, + ); + expect(faq).toMatch( + /Hosted and multi-workspace servers omit websocketStateStalled, and even a green Connected badge \(Live updates are connected\. Source readings may be older\.\) does not prove/, + ); + + const upgradeSection = guide('UPGRADE_v6') + .split('## Post-Upgrade Checklist\n')[1] + ?.split('\n### ')[0]; + expect(upgradeSection).toBeDefined(); + const upgrade = text(article(`## Post-Upgrade Checklist\n${upgradeSection}`, 'UPGRADE_v6')); + expect(upgrade).toMatch( + /amber Updates stalled badge in the header means GET \/api\/health reported websocketStateStalled: true on a standalone server/, + ); + expect(upgrade).toMatch( + /Waiting for data means the WebSocket connected before the first snapshot arrived/, + ); + + const alertingSection = guide('ALERTING').split('## Detect an outage of Pulse itself\n')[1]; + expect(alertingSection).toBeDefined(); + const alerting = text( + article(`## Detect an outage of Pulse itself\n${alertingSection}`, 'ALERTING'), + ); + expect(alerting).toMatch( + /\/api\/health can also report websocketStateStalled: true \(which surfaces an amber Updates stalled warning in the dashboard header\)/, + ); + }); + it('uses existing evidence without extra probes, reset advice or credential-bearing exports', () => { const rendered = stalled(); const copy = text(rendered); @@ -129,7 +185,7 @@ describe('dashboard readiness guidance', () => { expect(copy).toMatch(/Preserve existing configuration, credentials and logs/); expect(copy).toMatch(/guidance is not a runtime fix/); expect(rendered.querySelector('a[href="#-getting-help"]')).not.toBeNull(); - for (const name of ['API', 'TROUBLESHOOTING']) { + for (const name of ['API', 'TROUBLESHOOTING', 'FAQ', 'UPGRADE_v6', 'ALERTING']) { expect(read(`frontend-modern/public/docs/${name}.md`)).toBe(guide(name)); } }); diff --git a/scripts/tests/test_stale_reading_help_docs.py b/scripts/tests/test_stale_reading_help_docs.py index 75df139bfe..ea3d39d02b 100644 --- a/scripts/tests/test_stale_reading_help_docs.py +++ b/scripts/tests/test_stale_reading_help_docs.py @@ -989,16 +989,107 @@ class StaleReadingAndAgentHelpDocsTest(unittest.TestCase): with self.subTest(phrase=phrase): self.assertIn(phrase, recovery) + def test_help_binds_dashboard_updates_stalled_header_badge_to_runtime_source(self): + runtime = doc_text("frontend-modern/src/useAppRuntimeState.ts") + layout = doc_text("frontend-modern/src/AppLayout.tsx") + + for marker in ( + "label: 'Connected'", + "detail: 'Live updates are connected. Source readings may be older.'", + "label: 'Updates stalled'", + "detail: 'Backend is reachable, but live dashboard state updates are stalled.'", + "label: 'Waiting for data'", + "detail: 'Live updates are connected. Waiting for the first dashboard snapshot.'", + "if (websocketStateStalled() && (connected() || backendHealthy())) {", + "const response = await apiFetch('/api/health', { cache: 'no-store' });", + "stalled = isRecord(payload) && payload.websocketStateStalled === true;", + "isConnected ? (resolved ? 30000 : 15000) : reconnecting() ? 5000 : 15000", + ): + with self.subTest(source="useAppRuntimeState.ts", marker=marker): + self.assertIn(marker, runtime) + for marker in ( + "export function ConnectionStatusBadge(", + "const showLabelByDefault = () => status().tone !== 'healthy';", + ): + with self.subTest(source="AppLayout.tsx", marker=marker): + self.assertIn(marker, layout) + + api_health = norm( + doc_text("docs/API.md") + .split("### System Health\n", 1)[1] + .split("\n### ", 1)[0] + ) + for phrase in ( + "poll `GET /api/health` (`cache: 'no-store'`) every 30 seconds while connected with initial data (15 seconds while waiting for the first snapshot or disconnected, 5 seconds while reconnecting)", + "replaces **Connected** (or **Waiting for data**, **Sync reconnecting**, or **Backend healthy**) with an amber **Updates stalled** badge (`Backend is reachable, but live dashboard state updates are stalled.`)", + "clearing automatically once the flag clears", + "green **Connected** badge (`Live updates are connected. Source readings may be older.`)", + ): + with self.subTest(doc="API.md", phrase=phrase): + self.assertIn(phrase, api_health) + + proxy = norm( + doc_text("docs/REVERSE_PROXY.md").split("### Other Issues\n", 1)[1] + ) + for phrase in ( + '"Waiting for data", "Updates stalled"', + "**Waiting for data** means the WebSocket connected before the first dashboard snapshot arrived", + "amber **Updates stalled** badge means `GET /api/health` reported `websocketStateStalled: true` (`Backend is reachable, but live dashboard state updates are stalled.`)", + "Neither is fixed by changing proxy headers.", + ): + with self.subTest(doc="REVERSE_PROXY.md", phrase=phrase): + self.assertIn(phrase, proxy) + + faq_no_data = norm( + doc_text("docs/FAQ.md") + .split("### No data showing?\n", 1)[1] + .split("\n### ", 1)[0] + ) + for phrase in ( + "**Dashboard header connection badge:**", + "`GET /api/health` reports `websocketStateStalled: true`", + "always-visible amber **Updates stalled** badge (`Backend is reachable, but live dashboard state updates are stalled.`) on both desktop and phones", + "**Waiting for data** means the WebSocket connected before the first dashboard snapshot arrived", + "Hosted and multi-workspace servers omit `websocketStateStalled`", + "green **Connected** badge (`Live updates are connected. Source readings may be older.`)", + ): + with self.subTest(doc="FAQ.md", phrase=phrase): + self.assertIn(phrase, faq_no_data) + + upgrade_post = norm( + doc_text("docs/UPGRADE_v6.md") + .split("## Post-Upgrade Checklist\n", 1)[1] + .split("\n### ", 1)[0] + ) + for phrase in ( + "An amber **Updates stalled** badge in the header means `GET /api/health` reported `websocketStateStalled: true` on a standalone server", + "**Waiting for data** means the WebSocket connected before the first snapshot arrived", + ): + with self.subTest(doc="UPGRADE_v6.md", phrase=phrase): + self.assertIn(phrase, upgrade_post) + + alerting_outage = norm( + doc_text("docs/ALERTING.md").split("## Detect an outage of Pulse itself\n", 1)[1] + ) + self.assertIn( + "`/api/health` can also report `websocketStateStalled: true` (which surfaces an amber **Updates stalled** warning in the dashboard header)", + alerting_outage, + ) + def test_shipped_public_docs_mirrors_match_byte_for_byte(self): for name in ( "AGENT_SECURITY.md", + "ALERTING.md", + "API.md", "FAQ.md", "KUBERNETES.md", "PBS.md", "RECOVERY.md", + "REVERSE_PROXY.md", "TRUENAS.md", "UNIFIED_AGENT.md", "UNIFIED_RESOURCES.md", + "UPGRADE_v6.md", ): with self.subTest(doc=name): self.assertEqual(