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
Harden monitored-system ledger explanation fallback
rcourtman7a069a2888e2
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 2bd3f39655..9e8d5964ee 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -230,6 +230,10 @@ shared monitored-system explanation summary, sanitized grouping reasons, andincluded top-level surfaces exactly as the unified-resource resolver computedthem, while the frontend client stays in lockstep with that nested payloadshape.+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.Action-plan stale-plan protection on those audit records now uses the canonical`resourceVersion`, `policyVersion`, and `planHash` fields only, so theresponse 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.mdindex 89e45f490e..49688c7945 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -201,6 +201,10 @@ count decisions. Commercial usage UI may show grouped monitored systems, butit must render the canonical backend explanation for why one or moretop-level views counted as a single monitored system instead of inventingsupport copy or merge heuristics in the frontend.+That billing support surface must also remain readable while mixed-version+clients and servers roll forward: missing explanation payloads may degrade to a+safe generic explanation, but the monitored-system ledger must never fail the+page or hide counted systems because the nested support details are absent.Frontend billing/admin surfaces must not synthesize `plan_version` fromsubscription 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.tsindex ba2e52856f..7a3f062c47 100644--- a/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts+++ b/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts@@ -62,4 +62,26 @@ describe('MonitoredSystemLedgerAPI', () => {expect(result.systems[0]?.explanation.reasons).toHaveLength(1);expect(result.systems[0]?.explanation.surfaces).toHaveLength(1);});++ it('normalizes missing explanation payloads', async () => {+ vi.mocked(apiFetchJSON).mockResolvedValueOnce({+ systems: [+ {+ name: 'server-1',+ type: 'host',+ status: 'online',+ last_seen: '2026-01-01T00:00:00Z',+ source: 'agent',+ },+ ],+ total: 1,+ limit: 5,+ });++ const result = await MonitoredSystemLedgerAPI.getLedger();++ expect(result.systems[0]?.explanation.summary).toContain('counts this top-level collection path');+ expect(result.systems[0]?.explanation.reasons).toEqual([]);+ expect(result.systems[0]?.explanation.surfaces).toEqual([]);+ });});diff --git a/frontend-modern/src/api/monitoredSystemLedger.ts b/frontend-modern/src/api/monitoredSystemLedger.tsindex be6ec58bd1..c29c75538a 100644--- a/frontend-modern/src/api/monitoredSystemLedger.ts+++ b/frontend-modern/src/api/monitoredSystemLedger.ts@@ -24,7 +24,7 @@ export interface MonitoredSystemLedgerEntry {status: string; // "online" | "offline" | "unknown"last_seen: string; // RFC3339 or emptysource: string;- explanation: MonitoredSystemLedgerExplanation;+ explanation?: MonitoredSystemLedgerExplanation;}export interface MonitoredSystemLedgerResponse {@@ -37,6 +37,26 @@ export class MonitoredSystemLedgerAPI {private static readonly baseUrl = '/api/license/monitored-system-ledger';static async getLedger(): Promise<MonitoredSystemLedgerResponse> {- return apiFetchJSON<MonitoredSystemLedgerResponse>(this.baseUrl);+ const response = await apiFetchJSON<MonitoredSystemLedgerResponse>(this.baseUrl);+ return {+ ...response,+ systems: (response.systems ?? []).map(normalizeMonitoredSystemLedgerEntry),+ };}}++function normalizeMonitoredSystemLedgerEntry(+ entry: MonitoredSystemLedgerEntry,+): MonitoredSystemLedgerEntry {+ const explanation = entry.explanation;+ return {+ ...entry,+ explanation: {+ summary:+ explanation?.summary ??+ 'Pulse counts this top-level collection path as one monitored system.',+ reasons: explanation?.reasons ?? [],+ surfaces: explanation?.surfaces ?? [],+ },+ };+}diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsxindex d799363258..ea08bb9116 100644--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx@@ -11,7 +11,10 @@ import {} from '@/components/shared/Table';import { formatRelativeTime } from '@/utils/format';import { MonitoredSystemLedgerAPI } from '@/api/monitoredSystemLedger';-import type { MonitoredSystemLedgerEntry } from '@/api/monitoredSystemLedger';+import type {+ MonitoredSystemLedgerEntry,+ MonitoredSystemLedgerExplanation,+} from '@/api/monitoredSystemLedger';import { getSimpleStatusIndicator } from '@/utils/status';import {getMonitoredSystemLedgerErrorState,@@ -32,6 +35,16 @@ function usagePercent(total: number, limit: number): number {return Math.min(100, Math.round((total / limit) * 100));}+function systemExplanation(system: MonitoredSystemLedgerEntry): MonitoredSystemLedgerExplanation {+ return {+ summary:+ system.explanation?.summary ??+ 'Pulse counts this top-level collection path as one monitored system.',+ reasons: system.explanation?.reasons ?? [],+ surfaces: system.explanation?.surfaces ?? [],+ };+}+export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProps = {}) {const [ledger, { refetch }] = createResource(() => MonitoredSystemLedgerAPI.getLedger());const [expandedSystemKey, setExpandedSystemKey] = createSignal<string | null>(null);@@ -131,6 +144,7 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelPropconst key = systemKey(system, index());const explanationID = `monitored-system-explanation-${index()}`;const expanded = () => expandedSystemKey() === key;+ const explanation = systemExplanation(system);return (<TableRow><TableCell>@@ -151,20 +165,20 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelPropclass="space-y-2 rounded-md border border-border bg-surface px-3 py-2 text-xs text-muted"><p class="whitespace-normal text-base-content">- {system.explanation.summary}+ {explanation.summary}</p>- <Show when={system.explanation.reasons.length > 0}>+ <Show when={explanation.reasons.length > 0}><ul class="space-y-1 whitespace-normal">- <For each={system.explanation.reasons}>+ <For each={explanation.reasons}>{(reason) => <li>{reason.summary}</li>}</For></ul></Show>- <Show when={system.explanation.surfaces.length > 0}>+ <Show when={explanation.surfaces.length > 0}><div class="space-y-1"><p class="font-medium text-base-content">Included views</p><ul class="space-y-1 whitespace-normal">- <For each={system.explanation.surfaces}>+ <For each={explanation.surfaces}>{(surface) => (<li>{surface.name} ({surface.type}, {surface.source})diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsxindex ec847b4bf8..9179814a34 100644--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx@@ -209,4 +209,33 @@ describe('MonitoredSystemLedgerPanel', () => {expect(screen.getByText('server-b host (host, agent)')).toBeInTheDocument();expect(screen.queryByText('Failed to load monitored system ledger.')).not.toBeInTheDocument();});++ it('does not crash when explanation payload is missing', async () => {+ getLedgerMock.mockResolvedValue({+ systems: [+ {+ name: 'server-a',+ type: 'host',+ status: 'online',+ last_seen: '2026-01-01T00:00:00Z',+ source: 'agent',+ },+ ],+ total: 1,+ limit: 10,+ } as MonitoredSystemLedgerResponse);++ render(() => <MonitoredSystemLedgerPanel />);++ await waitFor(() => {+ expect(screen.getByText('server-a')).toBeInTheDocument();+ });++ fireEvent.click(screen.getByRole('button', { name: 'Why this counts' }));++ expect(+ screen.getByText('Pulse counts this top-level collection path as one monitored system.'),+ ).toBeInTheDocument();+ expect(screen.queryByText('Included views')).not.toBeInTheDocument();+ });});