mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-30 09:32:45 +01:00
Align dashboard Updates stalled header warning across shipped Help docs
PR #5439 added authenticated GET /api/health polling in useAppRuntimeState.ts and surfaced an always-visible amber "Updates stalled" header warning badge when websocketStateStalled: true holds (alongside "Waiting for data" before the first snapshot arrives), while none of the shipped Help guides yet explained those header states or distinguished them from proxy upgrade failures and a green Connected badge. Update docs/API.md, docs/REVERSE_PROXY.md, docs/FAQ.md, docs/UPGRADE_v6.md, and docs/ALERTING.md (plus their byte-identical frontend-modern/public/docs/ mirrors) to document the exact runtime polling cadence, badge labels and detail copy, automatic clearance, standalone-only scope, and truthfulness boundaries. Extend dashboardReadinessGuide.test.ts and test_stale_reading_help_docs.py to verify rendered Help HTML, mirror parity, and live runtime source bindings. Contract-Neutral: Shipped Help documentation and its unit/consistency tests only; no runtime UI, backend API, schema, auth, or subsystem contract delta. Change-source: pulse-maintainer
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user