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.

Share monitored system status fallback defaults

rcourtmana9f3c829ce61
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 85ef868b9d..1e52d72307 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -262,6 +262,12 @@ That client contract must also fail closed when older or partial payloads omit
the nested explanation object: the frontend may normalize missing explanation
fields to empty reasons/surfaces plus a safe default summary, but it must not
crash or invent non-canonical grouping details.
+That same frontend monitored-system client must not keep its own parallel
+fallback copy for those summaries. When the payload omits frontend-authored
+status or explanation text during mixed-version rollouts, the client should
+source its safe default wording from the governed monitored-system
+presentation helper instead of duplicating local strings inside the API
+normalizer.
Action-plan stale-plan protection on those audit records now uses the canonical
`resourceVersion`, `policyVersion`, and `planHash` fields only, so the
response contract stays deterministic without extra version baggage.
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 2f3d4b2602..2d190cdf4b 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -244,6 +244,10 @@ labels, safe fallback summaries, and source/type attribution wording, so the
settings panel, Pro usage section, and counting-rules disclosure must consume
that helper instead of redefining customer-facing monitored-system copy inline
or keeping a parallel copy in generic self-hosted plan utilities.
+That same helper now also owns the row-status fallback summaries used when
+mixed-version payloads omit `status_explanation.summary`. The API client and
+settings panel must derive online/warning/offline/unknown fallback text from
+that shared owner instead of keeping separate local defaults that can drift.
Frontend billing/admin surfaces must not synthesize `plan_version` from
subscription lifecycle state. When a hosted billing record lacks a plan label,
the UI must preserve that absence instead of fabricating values like `active`
diff --git a/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts b/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts
index 3870bc9bfd..6b0c316114 100644
--- a/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts
+++ b/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts
@@ -107,6 +107,36 @@ describe('MonitoredSystemLedgerAPI', () => {
expect(result.systems[0]?.explanation.surfaces).toEqual([]);
});
+ it('normalizes missing status explanation copy from the canonical presentation helper', async () => {
+ vi.mocked(apiFetchJSON).mockResolvedValueOnce({
+ systems: [
+ {
+ name: 'server-1',
+ type: 'host',
+ status: 'offline',
+ latest_included_signal: {
+ name: 'server-1',
+ type: 'host',
+ source: 'agent',
+ at: '2026-01-01T00:00:00Z',
+ },
+ latest_included_signal_at: '2026-01-01T00:00:00Z',
+ latest_included_signal_source: 'agent',
+ last_seen: '2026-01-01T00:00:00Z',
+ source: 'agent',
+ },
+ ],
+ total: 1,
+ limit: 5,
+ });
+
+ const result = await MonitoredSystemLedgerAPI.getLedger();
+
+ expect(result.systems[0]?.status_explanation?.summary).toBe(
+ 'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.',
+ );
+ });
+
it('preserves canonical warning status from the API contract', async () => {
vi.mocked(apiFetchJSON).mockResolvedValueOnce({
systems: [
diff --git a/frontend-modern/src/api/monitoredSystemLedger.ts b/frontend-modern/src/api/monitoredSystemLedger.ts
index 4a20673439..f701418af5 100644
--- a/frontend-modern/src/api/monitoredSystemLedger.ts
+++ b/frontend-modern/src/api/monitoredSystemLedger.ts
@@ -1,4 +1,8 @@
import { apiFetchJSON } from '@/utils/apiClient';
+import {
+ getMonitoredSystemExplanationFallbackSummary,
+ getMonitoredSystemStatusFallbackSummary,
+} from '@/utils/monitoredSystemPresentation';
export type MonitoredSystemLedgerStatus = 'online' | 'warning' | 'offline' | 'unknown';
@@ -97,13 +101,11 @@ function normalizeMonitoredSystemLedgerEntry(
latestIncludedSignal.source,
),
status_explanation: {
- summary: entry.status_explanation?.summary ?? defaultMonitoredSystemStatusExplanation(status),
+ summary: entry.status_explanation?.summary ?? getMonitoredSystemStatusFallbackSummary(status),
reasons: (entry.status_explanation?.reasons ?? []).map(normalizeMonitoredSystemLedgerStatusReason),
},
explanation: {
- summary:
- explanation?.summary ??
- 'Pulse counts this top-level collection path as one monitored system.',
+ summary: explanation?.summary ?? getMonitoredSystemExplanationFallbackSummary(),
reasons: explanation?.reasons ?? [],
surfaces: explanation?.surfaces ?? [],
},
@@ -124,19 +126,6 @@ function normalizeMonitoredSystemLedgerStatus(
}
}
-function defaultMonitoredSystemStatusExplanation(status: MonitoredSystemLedgerStatus): string {
- switch (status) {
- case 'online':
- return 'All included top-level collection paths currently report online status.';
- case 'warning':
- return 'At least one included top-level collection path is degraded, so Pulse marks this monitored system as warning.';
- case 'offline':
- return 'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.';
- default:
- return 'Pulse cannot determine a canonical runtime status for this monitored system yet.';
- }
-}
-
function normalizeMonitoredSystemLedgerStatusReason(
reason: MonitoredSystemLedgerStatusReason,
): MonitoredSystemLedgerStatusReason {
diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
index b979f207a5..363e800f82 100644
--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
@@ -52,7 +52,9 @@ function systemExplanation(system: MonitoredSystemLedgerEntry): MonitoredSystemL
function systemStatusExplanation(system: MonitoredSystemLedgerEntry): MonitoredSystemLedgerStatusExplanation {
return {
- summary: system.status_explanation?.summary ?? getMonitoredSystemStatusFallbackSummary(),
+ summary:
+ system.status_explanation?.summary ??
+ getMonitoredSystemStatusFallbackSummary(system.status),
reasons: system.status_explanation?.reasons ?? [],
};
}
diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
index 53684b31ea..fa76ac6332 100644
--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
@@ -351,4 +351,42 @@ describe('MonitoredSystemLedgerPanel', () => {
expect(screen.getByText('No included signal yet.')).toBeInTheDocument();
});
+
+ it('falls back to the canonical status summary for the row status when status explanation is missing', async () => {
+ getLedgerMock.mockResolvedValue({
+ systems: [
+ {
+ name: 'server-d',
+ type: 'host',
+ status: 'offline',
+ latest_included_signal: {
+ name: 'server-d',
+ type: 'host',
+ source: 'agent',
+ at: '2026-01-01T00:00:00Z',
+ },
+ latest_included_signal_at: '2026-01-01T00:00:00Z',
+ latest_included_signal_source: 'agent',
+ last_seen: '2026-01-01T00:00:00Z',
+ source: 'agent',
+ },
+ ],
+ total: 1,
+ limit: 10,
+ } as MonitoredSystemLedgerResponse);
+
+ render(() => <MonitoredSystemLedgerPanel />);
+
+ await waitFor(() => {
+ expect(screen.getByText('server-d')).toBeInTheDocument();
+ });
+
+ fireEvent.click(screen.getByRole('button', { name: 'View counting details' }));
+
+ expect(
+ screen.getByText(
+ 'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.',
+ ),
+ ).toBeInTheDocument();
+ });
});
diff --git a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
index e87db39ce1..be597f929a 100644
--- a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
@@ -38,8 +38,14 @@ describe('monitoredSystemPresentation', () => {
emptyState: 'No monitored systems counted.',
noIncludedSignalLabel: 'No included signal yet.',
fallbackExplanationSummary: 'Pulse counts this top-level collection path as one monitored system.',
- fallbackStatusSummary:
- 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+ statusSummaryByStatus: {
+ online: 'All included top-level collection paths currently report online status.',
+ warning:
+ 'At least one included top-level collection path is degraded, so Pulse marks this monitored system as warning.',
+ offline:
+ 'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.',
+ unknown: 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+ },
});
expect(getMonitoredSystemBriefSummary()).toBe(
'Billing is based on monitored systems. Child resources are included.',
@@ -55,6 +61,15 @@ describe('monitoredSystemPresentation', () => {
expect(getMonitoredSystemExplanationFallbackSummary()).toBe(
'Pulse counts this top-level collection path as one monitored system.',
);
+ expect(getMonitoredSystemStatusFallbackSummary('online')).toBe(
+ 'All included top-level collection paths currently report online status.',
+ );
+ expect(getMonitoredSystemStatusFallbackSummary('warning')).toBe(
+ 'At least one included top-level collection path is degraded, so Pulse marks this monitored system as warning.',
+ );
+ expect(getMonitoredSystemStatusFallbackSummary('offline')).toBe(
+ 'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.',
+ );
expect(getMonitoredSystemStatusFallbackSummary()).toBe(
'Pulse cannot determine a canonical runtime status for this monitored system yet.',
);
diff --git a/frontend-modern/src/utils/monitoredSystemPresentation.ts b/frontend-modern/src/utils/monitoredSystemPresentation.ts
index d7fd04aa79..f912c93345 100644
--- a/frontend-modern/src/utils/monitoredSystemPresentation.ts
+++ b/frontend-modern/src/utils/monitoredSystemPresentation.ts
@@ -29,8 +29,14 @@ const MONITORED_SYSTEM_LEDGER_PRESENTATION = {
emptyState: 'No monitored systems counted.',
noIncludedSignalLabel: 'No included signal yet.',
fallbackExplanationSummary: 'Pulse counts this top-level collection path as one monitored system.',
- fallbackStatusSummary:
- 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+ statusSummaryByStatus: {
+ online: 'All included top-level collection paths currently report online status.',
+ warning:
+ 'At least one included top-level collection path is degraded, so Pulse marks this monitored system as warning.',
+ offline:
+ 'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.',
+ unknown: 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
+ },
} as const;
export function getMonitoredSystemLedgerPresentation() {
@@ -65,8 +71,10 @@ export function getMonitoredSystemExplanationFallbackSummary(): string {
return MONITORED_SYSTEM_LEDGER_PRESENTATION.fallbackExplanationSummary;
}
-export function getMonitoredSystemStatusFallbackSummary(): string {
- return MONITORED_SYSTEM_LEDGER_PRESENTATION.fallbackStatusSummary;
+export function getMonitoredSystemStatusFallbackSummary(
+ status: 'online' | 'warning' | 'offline' | 'unknown' = 'unknown',
+): string {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.statusSummaryByStatus[status];
}
export function formatMonitoredSystemLatestIncludedSignalSentence(signal: {