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
Normalize monitored system ledger client contract
rcourtmand374845d99a0
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 1e52d72307..5d80b40a9b 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -441,6 +441,13 @@ place that derives `.env` from configured runtime paths, and neighboringhandlers like `router.go`, `router_routes_auth_security.go`, and`security_setup_fix.go` may not reconstruct their own `/etc/pulse/.env`fallbacks once runtime path authority has been centralized.+That same monitored-system ledger boundary now also governs frontend client+normalization. `frontend-modern/src/api/monitoredSystemLedger.ts` must decode+mixed-version payloads into one normalized response shape before render+surfaces consume it: `status_explanation`, `explanation`, and+`latest_included_signal` are the client contract exposed to the UI, while+missing mixed-version fields may be repaired only inside that API client layer+rather than in panel-local fallback helpers.That same shared API boundary rule now also applies to notification testhandlers: `internal/api/notifications.go` may decode webhook-test requests andreturn the governed response envelope, but notifications-owned service-templatediff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 4f03ae3b86..1529273d25 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -255,6 +255,14 @@ That same helper now also owns the row-status fallback summaries used whenmixed-version payloads omit `status_explanation.summary`. The API client andsettings panel must derive online/warning/offline/unknown fallback text fromthat shared owner instead of keeping separate local defaults that can drift.+That same settings owner split now also requires+`frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx` to+consume the normalized ledger client contract directly. Panel-local fallback+reconstruction for `status_explanation`, `explanation`, or+`latest_included_signal` belongs in+`frontend-modern/src/api/monitoredSystemLedger.ts` instead, so the billing+surface stays a pure render shell over one canonical monitored-system ledger+shape.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 6b0c316114..7f41e3d7ed 100644--- a/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts+++ b/frontend-modern/src/api/__tests__/monitoredSystemLedger.test.ts@@ -105,6 +105,12 @@ describe('MonitoredSystemLedgerAPI', () => {expect(result.systems[0]?.status_explanation?.reasons).toEqual([]);expect(result.systems[0]?.explanation.reasons).toEqual([]);expect(result.systems[0]?.explanation.surfaces).toEqual([]);+ expect(result.systems[0]?.latest_included_signal).toEqual({+ name: 'server-1',+ type: 'host',+ source: 'agent',+ at: '2026-01-01T00:00:00Z',+ });});it('normalizes missing status explanation copy from the canonical presentation helper', async () => {diff --git a/frontend-modern/src/api/monitoredSystemLedger.ts b/frontend-modern/src/api/monitoredSystemLedger.tsindex f701418af5..1e82f3a036 100644--- a/frontend-modern/src/api/monitoredSystemLedger.ts+++ b/frontend-modern/src/api/monitoredSystemLedger.ts@@ -49,13 +49,13 @@ export interface MonitoredSystemLedgerEntry {name: string;type: string;status: MonitoredSystemLedgerStatus;- status_explanation?: MonitoredSystemLedgerStatusExplanation;- latest_included_signal?: MonitoredSystemLedgerLatestSignal;+ status_explanation: MonitoredSystemLedgerStatusExplanation;+ latest_included_signal: MonitoredSystemLedgerLatestSignal;latest_included_signal_at: string; // freshest included observation, RFC3339 or emptylatest_included_signal_source?: string;last_seen?: string; // deprecated compatibility aliassource: string;- explanation?: MonitoredSystemLedgerExplanation;+ explanation: MonitoredSystemLedgerExplanation;}export interface MonitoredSystemLedgerLatestSignal {@@ -71,11 +71,24 @@ export interface MonitoredSystemLedgerResponse {limit: number; // 0 = unlimited}+type MonitoredSystemLedgerRawEntry = Omit<+ MonitoredSystemLedgerEntry,+ 'status_explanation' | 'latest_included_signal' | 'explanation'+> & {+ status_explanation?: MonitoredSystemLedgerStatusExplanation;+ latest_included_signal?: MonitoredSystemLedgerLatestSignal;+ explanation?: MonitoredSystemLedgerExplanation;+};++type MonitoredSystemLedgerRawResponse = Omit<MonitoredSystemLedgerResponse, 'systems'> & {+ systems?: MonitoredSystemLedgerRawEntry[];+};+export class MonitoredSystemLedgerAPI {private static readonly baseUrl = '/api/license/monitored-system-ledger';static async getLedger(): Promise<MonitoredSystemLedgerResponse> {- const response = await apiFetchJSON<MonitoredSystemLedgerResponse>(this.baseUrl);+ const response = await apiFetchJSON<MonitoredSystemLedgerRawResponse>(this.baseUrl);return {...response,systems: (response.systems ?? []).map(normalizeMonitoredSystemLedgerEntry),@@ -84,7 +97,7 @@ export class MonitoredSystemLedgerAPI {}function normalizeMonitoredSystemLedgerEntry(- entry: MonitoredSystemLedgerEntry,+ entry: MonitoredSystemLedgerRawEntry,): MonitoredSystemLedgerEntry {const explanation = entry.explanation;const status = normalizeMonitoredSystemLedgerStatus(entry.status);@@ -169,7 +182,7 @@ function normalizeMonitoredSystemLedgerSource(function normalizeMonitoredSystemLedgerLatestSignal(signal: MonitoredSystemLedgerLatestSignal | undefined,- entry: MonitoredSystemLedgerEntry,+ entry: MonitoredSystemLedgerRawEntry,): MonitoredSystemLedgerLatestSignal {return {name: signal?.name?.trim() || entry.name || 'Unnamed source',diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsxindex 363e800f82..ccd9e86bb5 100644--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx@@ -11,11 +11,7 @@ import {} from '@/components/shared/Table';import { formatRelativeTime } from '@/utils/format';import { MonitoredSystemLedgerAPI } from '@/api/monitoredSystemLedger';-import type {- MonitoredSystemLedgerEntry,- MonitoredSystemLedgerExplanation,- MonitoredSystemLedgerStatusExplanation,-} from '@/api/monitoredSystemLedger';+import type { MonitoredSystemLedgerEntry } from '@/api/monitoredSystemLedger';import { getSimpleStatusIndicator } from '@/utils/status';import {getMonitoredSystemLedgerErrorState,@@ -27,9 +23,7 @@ import {formatMonitoredSystemSurfaceAttribution,getMonitoredSystemLedgerDescription,getMonitoredSystemCountingDetailsToggleLabel,- getMonitoredSystemExplanationFallbackSummary,getMonitoredSystemLedgerPresentation,- getMonitoredSystemStatusFallbackSummary,} from '@/utils/monitoredSystemPresentation';import { MonitoredSystemDefinitionDisclosure } from '@/components/Commercial/MonitoredSystemDefinitionDisclosure';@@ -42,28 +36,11 @@ 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 ?? getMonitoredSystemExplanationFallbackSummary(),- reasons: system.explanation?.reasons ?? [],- surfaces: system.explanation?.surfaces ?? [],- };-}--function systemStatusExplanation(system: MonitoredSystemLedgerEntry): MonitoredSystemLedgerStatusExplanation {- return {- summary:- system.status_explanation?.summary ??- getMonitoredSystemStatusFallbackSummary(system.status),- reasons: system.status_explanation?.reasons ?? [],- };-}-function latestIncludedSignalSummary(system: MonitoredSystemLedgerEntry): {relative: string;attribution: string;} | null {- if (!system.latest_included_signal?.at) {+ if (!system.latest_included_signal.at) {return null;}return {@@ -172,8 +149,6 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelPropconst key = systemKey(system, index());const explanationID = `monitored-system-explanation-${index()}`;const expanded = () => expandedSystemKey() === key;- const explanation = systemExplanation(system);- const statusExplanation = systemStatusExplanation(system);const latestSignal = latestIncludedSignalSummary(system);return (<TableRow>@@ -199,7 +174,7 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp{presentation.currentStatusHeading}</p><p class="whitespace-normal text-base-content">- {statusExplanation.summary}+ {system.status_explanation.summary}</p><Show when={latestSignal}>{(signal) => (@@ -210,31 +185,31 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp</p>)}</Show>- <Show when={statusExplanation.reasons.length > 0}>+ <Show when={system.status_explanation.reasons.length > 0}><ul class="space-y-1 whitespace-normal text-base-content">- <For each={statusExplanation.reasons}>+ <For each={system.status_explanation.reasons}>{(reason) => <li>{reason.summary}</li>}</For></ul></Show></div><p class="whitespace-normal text-base-content">- {explanation.summary}+ {system.explanation.summary}</p>- <Show when={explanation.reasons.length > 0}>+ <Show when={system.explanation.reasons.length > 0}><ul class="space-y-1 whitespace-normal">- <For each={explanation.reasons}>+ <For each={system.explanation.reasons}>{(reason) => <li>{reason.summary}</li>}</For></ul></Show>- <Show when={explanation.surfaces.length > 0}>+ <Show when={system.explanation.surfaces.length > 0}><div class="space-y-1"><p class="font-medium text-base-content">{presentation.includedCollectionPathsHeading}</p><ul class="space-y-1 whitespace-normal">- <For each={explanation.surfaces}>+ <For each={system.explanation.surfaces}>{(surface) => (<li>{formatMonitoredSystemSurfaceAttribution(surface)}</li>)}diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsxindex fa76ac6332..8104f8b332 100644--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx@@ -292,6 +292,11 @@ describe('MonitoredSystemLedgerPanel', () => {summary: 'All included top-level collection paths currently report online status.',reasons: [],},+ explanation: {+ summary: 'Pulse counts this top-level collection path as one monitored system.',+ reasons: [],+ surfaces: [],+ },latest_included_signal: {name: 'server-a',type: 'host',@@ -336,6 +341,19 @@ describe('MonitoredSystemLedgerPanel', () => {summary: 'Pulse cannot determine a canonical runtime status for this monitored system yet.',reasons: [],},+ explanation: {+ summary: 'Pulse counts this top-level collection path as one monitored system.',+ reasons: [],+ surfaces: [],+ },+ latest_included_signal: {+ name: 'server-c',+ type: 'host',+ source: 'agent',+ at: '',+ },+ latest_included_signal_at: '',+ latest_included_signal_source: 'agent',source: 'agent',},],@@ -359,6 +377,16 @@ describe('MonitoredSystemLedgerPanel', () => {name: 'server-d',type: 'host',status: 'offline',+ status_explanation: {+ summary:+ 'At least one included source is offline or disconnected, so Pulse marks this monitored system as offline.',+ reasons: [],+ },+ explanation: {+ summary: 'Pulse counts this top-level collection path as one monitored system.',+ reasons: [],+ surfaces: [],+ },latest_included_signal: {name: 'server-d',type: 'host',diff --git a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.tsindex 4a777931ba..0a6b9c0dc8 100644--- a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts@@ -250,6 +250,8 @@ describe('monitored-system model guardrails', () => {expect(monitoredSystemLedgerApiSource).toContain('@/utils/monitoredSystemPresentation');expect(monitoredSystemLedgerApiSource).toContain('getMonitoredSystemStatusFallbackSummary');expect(monitoredSystemLedgerApiSource).toContain('getMonitoredSystemExplanationFallbackSummary');+ expect(monitoredSystemLedgerApiSource).toContain('type MonitoredSystemLedgerRawEntry =');+ expect(monitoredSystemLedgerApiSource).toContain('systems?: MonitoredSystemLedgerRawEntry[];');expect(monitoredSystemLedgerApiSource).not.toContain('All included top-level collection paths currently report online status.',);@@ -260,6 +262,10 @@ describe('monitored-system model guardrails', () => {'Pulse cannot determine a canonical runtime status for this monitored system yet.',);expect(monitoredSystemPresentationSource).toContain('statusSummaryByStatus');+ expect(agentLedgerPanelSource).not.toContain('getMonitoredSystemExplanationFallbackSummary');+ expect(agentLedgerPanelSource).not.toContain('getMonitoredSystemStatusFallbackSummary');+ expect(agentLedgerPanelSource).not.toContain('function systemExplanation(');+ expect(agentLedgerPanelSource).not.toContain('function systemStatusExplanation(');});it('keeps APITokenManager runtime usage mapped from unified resources', () => {