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
refactor(recovery): canonicalize platform payload vocabulary
rcourtman8a57c7431bd8
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 0d27c6955c..747894806f 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -215,6 +215,12 @@ That same API boundary now routes the `kind`, `sourceType`, andfilter parser, so the lifecycle lane keeps the transport contract alignedwith the canonical resource-history model instead of rebuilding filternormalization locally.+That same shared `internal/api/` boundary now also keeps recovery payload+platform vocabulary canonical at the transport edge. Lifecycle-adjacent+surfaces that deep-link into recovery may still depend on those handlers, but+they must treat response `platform` / `platforms` as API-owned fields and use+legacy `provider` aliases only as compatibility fallback rather than reviving+provider-shaped transport assumptions in fleet flows.The router now wires the tenant resource state provider during initial setupwhen a multi-tenant monitor is present, so tenant-scoped fleet pages do nottrip a missing-provider 500 before the monitor has finished initializing.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 515e7ce6b1..99cff1c002 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -199,6 +199,7 @@ Own canonical runtime payload shapes between backend and frontend.12. Treat Patrol schedule and recency as header-owned metadata on the main Patrol page: findings empty-state consumers should not receive or restate `next_patrol_at`, `last_patrol_at`, or interval timing once those transport fields are already presented by the primary header and verification shell13. Keep recovery payload filters canonical across `/api/recovery/rollups`, `/api/recovery/points`, `/api/recovery/series`, and `/api/recovery/facets`: when `internal/api/recovery_handlers.go` adds a governed recovery filter or display field such as provider-neutral `itemType`, the same normalized transport must land across all four endpoints and the contract tests must pin both outbound payload shape and accepted query aliases in the same slice14. Keep recovery platform-query vocabulary canonical across that same `/api/recovery/*` surface: operator-facing transport must emit `platform` as the canonical query field, accepted legacy `provider` aliases must remain compatibility-only input, and `internal/api/contract_test.go` must pin that fallback behavior in the same slice as any handler change+15. Keep recovery payload platform vocabulary canonical across that same `/api/recovery/*` surface: point payloads must expose `platform`, rollup payloads must expose `platforms`, and any compatibility `provider` / `providers` aliases must remain secondary fallback fields rather than replacing the shared response model## Current State@@ -249,6 +250,11 @@ The same resource contract now also exposes a dedicated`/api/resources/{id}/timeline` history endpoint and bundled facet reads under`/api/resources/{id}/facets`, so operators can inspect change history withoutdepending on a monolithic resource payload.+The recovery API boundary now also keeps canonical platform vocabulary+consistent on both sides of the transport. `/api/recovery/*` queries use+`platform` as the operator-facing filter key, and the point/rollup payloads+now expose `platform` / `platforms` as the primary response fields while+legacy `provider` aliases remain compatibility-only for older decoders.The reporting API contract now also treats current-state fleet inventory as afirst-class surface separate from historical metrics reports.`internal/api/reporting_inventory_handlers.go`,@@ -1362,13 +1368,18 @@ operator-facing query field across `/api/recovery/rollups`, `/api/recovery/pointmapping that boundary onto internal provider fields, but accepted legacy`provider` aliases must be compatibility-only input and must not replace thecanonical transport query shape.+That same outbound recovery transport now also treats `platform` and+`platforms` as the canonical response fields for point and rollup payloads.+Compatibility `provider` and `providers` fields may remain during the v6+transition, but the shared API contract and frontend decode path must treat+them as fallback aliases rather than the primary response vocabulary.`internal/api/contract_test.go` must pin that alias behavior directly, so thecanonical `platform` query and the legacy `provider` fallback cannot driftbetween recovery endpoints without tripping the shared API proof surface.`internal/api/contract_test.go` is the canonical proof owner for that-boundary, so route and query compatibility like `itemType` and accepted alias-inputs such as `type` or legacy `provider` must be pinned there whenever the shared recovery-transport shape changes.+boundary, so response payload shape plus route and query compatibility like+`itemType`, `type`, and legacy `provider` aliases must be pinned there+whenever the shared recovery transport shape changes.The same rule now also covers optional nested node cluster endpoint collectionsso `frontend-modern/src/api/nodes.ts` does not own its own`Array.isArray(node.clusterEndpoints)` response-shape branch.diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 6e371004e9..4dc1238f55 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -689,6 +689,11 @@ as page-local toolbar state inside individual recovery sections.That same shared recovery state owner now also keeps `platform` as thecanonical route and transport filter name for operator-facing recovery links,while any accepted legacy `provider` aliases remain parser compatibility only.+Recovery frontend decode and derived option builders must treat payload+`platform` / `platforms` as the canonical response fields and only fall back+to legacy `provider` / `providers` aliases for compatibility, so route,+filter, and table state do not keep backend-era vocabulary alive as the+default client model.Recovery section owners under `frontend-modern/src/components/Recovery/` mustconsume that shared `platform` filter surface directly. They must not keeprecovery-local `provider` route/query vocabulary alive behind renamed labels,diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex fdb639af62..403c55c1c0 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -162,6 +162,11 @@ platform model from summary through drill-in. Shared recovery URLs andtransport filters should likewise treat `platform` as the canonicaloperator-facing query field, with legacy `provider` aliases accepted only ascompatibility input that rewrites back to canonical `platform` route state.+That same recovery contract should keep response payloads canonical as well:+recovery points and protected rollups should expose `platform` and+`platforms` as the primary transport fields, while any legacy+`provider` / `providers` aliases stay compatibility-only so the page does not+silently drift back to backend-shaped vocabulary during decode.That same shared presentation layer also owns the distinction betweenaggregate recovery-method language and single-record recovery-method language.Timeline legends and daily breakdowns must use aggregate labels such asdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex dcc3e79022..4d3a9af864 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -963,6 +963,10 @@ That same route contract also owns the canonical recovery `platform` query.operator-facing route shape, while accepted legacy `provider` aliases may beparsed only as compatibility input that rewrites back to canonical platformroute state.+Recovery-linked consumers that decode `/api/recovery/*` payloads must likewise+prefer canonical `platform` / `platforms` response fields over legacy+`provider` aliases, so unified resource drill-downs and shared recovery links+carry the same platform vocabulary on both route and payload boundaries.Shared API consumers now also depend on a single registry-list snapshot perrequest when deriving canonical type aggregations for resource list and statsresponses. Re-reading `registry.List()` for the same `/api/resources` requestdiff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsxindex 1d8b167220..e2a66b27e1 100644--- a/frontend-modern/src/components/Recovery/Recovery.tsx+++ b/frontend-modern/src/components/Recovery/Recovery.tsx@@ -39,6 +39,7 @@ import {STALE_ISSUE_THRESHOLD_MS,} from '@/utils/recoveryTablePresentation';import { getRecoveryTimelineLabelEvery } from '@/utils/recoveryTimelineChartPresentation';+import { getRecoveryRollupPlatforms } from '@/utils/recoveryPlatformModel';import { createVisibleCanonicalTypeColumn } from '@/utils/typeColumnDefinition';const MOBILE_RECOVERY_COLUMNS = new Set(['time', 'subject', 'outcome']);@@ -109,7 +110,7 @@ const Recovery: Component = () => {const resourceIndex = resourcesById();const result = rollups().filter((rollup) => {- const providers = (rollup.providers || [])+ const providers = getRecoveryRollupPlatforms(rollup).map((entry) => String(entry || '').trim()).filter(Boolean);if (platform && !providers.includes(platform)) return false;diff --git a/frontend-modern/src/components/Recovery/RecoveryHistoryTable.tsx b/frontend-modern/src/components/Recovery/RecoveryHistoryTable.tsxindex 46e62b93b2..959346c693 100644--- a/frontend-modern/src/components/Recovery/RecoveryHistoryTable.tsx+++ b/frontend-modern/src/components/Recovery/RecoveryHistoryTable.tsx@@ -29,6 +29,7 @@ import {getRecoveryPointTimestampMs,normalizeRecoveryModeQueryValue,} from '@/utils/recoveryRecordPresentation';+import { getRecoveryPointPlatform } from '@/utils/recoveryPlatformModel';import {getRecoveryArtifactColumnHeaderClass,getRecoveryArtifactRowClass,@@ -168,9 +169,7 @@ export const RecoveryHistoryTable: Component<RecoveryHistoryTableProps> = (props? formatRecoveryTimeOnly(tsMs): '—';const subjectType = getRecoverySubjectTypeLabel(point);- const provider = normalizeSourcePlatformQueryValue(- String(point.provider || '').trim(),- );+ const provider = normalizeSourcePlatformQueryValue(getRecoveryPointPlatform(point));const mode =normalizeRecoveryModeQueryValue(String(point.mode || '').toLowerCase()) ||'local';diff --git a/frontend-modern/src/components/Recovery/RecoveryPointDetails.test.tsx b/frontend-modern/src/components/Recovery/RecoveryPointDetails.test.tsxindex 916b27b3d1..e0de60d819 100644--- a/frontend-modern/src/components/Recovery/RecoveryPointDetails.test.tsx+++ b/frontend-modern/src/components/Recovery/RecoveryPointDetails.test.tsx@@ -51,7 +51,7 @@ describe('RecoveryPointDetails', () => {<RecoveryPointDetailspoint={{id: 'point-1',- provider: 'proxmox-pbs',+ platform: 'proxmox-pbs',kind: 'backup',mode: 'remote',outcome: 'success',@@ -110,12 +110,12 @@ describe('RecoveryPointDetails', () => {expect(within(platformCard as HTMLDivElement).getByText('PBS')).toBeInTheDocument();});- it('uses canonical provider labels without forcing provider detail panels for other platforms', () => {+ it('uses canonical platform labels without forcing provider detail panels for other platforms', () => {render(() => (<RecoveryPointDetailspoint={{id: 'point-2',- provider: 'truenas',+ platform: 'truenas',display: {nodeHostLabel: 'tn-scale-01',},diff --git a/frontend-modern/src/components/Recovery/RecoveryPointDetails.tsx b/frontend-modern/src/components/Recovery/RecoveryPointDetails.tsxindex 7368f77b32..a38e5330fc 100644--- a/frontend-modern/src/components/Recovery/RecoveryPointDetails.tsx+++ b/frontend-modern/src/components/Recovery/RecoveryPointDetails.tsx@@ -17,6 +17,7 @@ import {getSourcePlatformLabel,normalizeSourcePlatformQueryValue,} from '@/utils/sourcePlatforms';+import { getRecoveryPointPlatform } from '@/utils/recoveryPlatformModel';interface RecoveryPointDetailsProps {point: RecoveryPoint;@@ -72,10 +73,14 @@ export const RecoveryPointDetails: Component<RecoveryPointDetailsProps> = (propsconst { state } = useWebSocket();const point = () => props.point;const providerKey = createMemo(() =>- normalizeSourcePlatformQueryValue(String(point().provider || '').trim()),+ normalizeSourcePlatformQueryValue(getRecoveryPointPlatform(point())),+ );+ const providerLabel = createMemo(() =>+ getSourcePlatformLabel(providerKey() || getRecoveryPointPlatform(point())),+ );+ const providerBadge = createMemo(() =>+ getSourcePlatformBadge(providerKey() || getRecoveryPointPlatform(point())),);- const providerLabel = createMemo(() => getSourcePlatformLabel(providerKey() || point().provider));- const providerBadge = createMemo(() => getSourcePlatformBadge(providerKey() || point().provider));const isPbsProvider = createMemo(() => providerKey() === 'proxmox-pbs',);diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsxindex 3e8b5687ec..3ed5420069 100644--- a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx+++ b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx@@ -40,6 +40,7 @@ import {normalizeRecoveryOutcome,} from '@/utils/recoveryOutcomePresentation';import { getRecoveryIssueRailClass, type RecoveryIssueTone } from '@/utils/recoveryIssuePresentation';+import { getRecoveryRollupPlatforms } from '@/utils/recoveryPlatformModel';import { getRecoveryRollupSubjectLabel } from '@/utils/recoveryRecordPresentation';import { getSourcePlatformLabel, normalizeSourcePlatformQueryValue } from '@/utils/sourcePlatforms';import { titleCaseDelimitedLabel } from '@/utils/textPresentation';@@ -132,11 +133,11 @@ export const RecoveryProtectedInventorySection: Component<return multiplier * (leftType || '').localeCompare(rightType || '');}case 'source': {- const leftSource = (left.providers || [])+ const leftSource = getRecoveryRollupPlatforms(left).map((provider) => getSourcePlatformLabel(String(provider))).sort().join(',');- const rightSource = (right.providers || [])+ const rightSource = getRecoveryRollupPlatforms(right).map((provider) => getSourcePlatformLabel(String(provider))).sort().join(',');@@ -368,8 +369,7 @@ export const RecoveryProtectedInventorySection: Component<const attemptMs = rollup.lastAttemptAt ? Date.parse(rollup.lastAttemptAt) : 0;const successMs = rollup.lastSuccessAt ? Date.parse(rollup.lastSuccessAt) : 0;const outcome = normalizeRecoveryOutcome(rollup.lastOutcome);- const providers = (rollup.providers || [])- .slice()+ const providers = getRecoveryRollupPlatforms(rollup).map((provider) => String(provider || '').trim()).filter(Boolean).sort((left, right) =>diff --git a/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx b/frontend-modern/src/components/Recovery/RecoverySummary.test.tsxindex 140f7f43fe..7911b05ae4 100644--- a/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx+++ b/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx@@ -18,7 +18,7 @@ describe('RecoverySummary', () => {rollupId: 'alpha',lastOutcome: 'success',lastSuccessAt: '2026-03-09T11:30:00Z',- providers: ['proxmox-pbs'],+ platforms: ['proxmox-pbs'],display: { subjectType: 'proxmox-vm' },},{@@ -26,7 +26,7 @@ describe('RecoverySummary', () => {lastOutcome: 'failed',lastAttemptAt: '2026-03-08T11:00:00Z',lastSuccessAt: null,- providers: ['proxmox-pve'],+ platforms: ['proxmox-pve'],subjectRef: { type: 'truenas-dataset' },},]}diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsxindex 3a6d9aba17..cbbdf3608e 100644--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx@@ -27,7 +27,7 @@ const rollupsPayload = [lastAttemptAt: '2026-02-14T10:00:00.000Z',lastSuccessAt: '2026-02-14T10:00:00.000Z',lastOutcome: 'success',- providers: ['proxmox-pve'],+ platforms: ['proxmox-pve'],},{rollupId: 'ext:truenas-1',@@ -36,7 +36,7 @@ const rollupsPayload = [lastAttemptAt: '2026-02-13T09:00:00.000Z',lastSuccessAt: null,lastOutcome: 'failed',- providers: ['truenas'],+ platforms: ['truenas'],},];@@ -44,7 +44,7 @@ const pointsByRollupId: Record<string, any[]> = {'res:vm-123': [{id: 'p1',- provider: 'proxmox-pve',+ platform: 'proxmox-pve',kind: 'backup',mode: 'local',outcome: 'success',@@ -69,7 +69,7 @@ const pointsByRollupId: Record<string, any[]> = {'ext:truenas-1': [{id: 't1',- provider: 'truenas',+ platform: 'truenas',kind: 'snapshot',mode: 'snapshot',outcome: 'failed',@@ -264,12 +264,12 @@ describe('Recovery', () => {lastAttemptAt: '2026-02-12T08:00:00.000Z',lastSuccessAt: '2026-02-12T08:00:00.000Z',lastOutcome: 'success',- providers: ['proxmox-pve'],+ platforms: ['proxmox-pve'],});pointsByRollupId['res:vm-404'] = [{id: 'p404',- provider: 'proxmox-pve',+ platform: 'proxmox-pve',kind: 'backup',mode: 'local',outcome: 'success',diff --git a/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts b/frontend-modern/src/features/recovery/useRecoverySurfaceState.tsindex ef9450a4c4..a38f12ca81 100644--- a/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts+++ b/frontend-modern/src/features/recovery/useRecoverySurfaceState.ts@@ -14,6 +14,7 @@ import {normalizeSourcePlatformQueryValue,} from '@/utils/sourcePlatforms';import { buildSourcePlatformOptions } from '@/utils/sourcePlatformOptions';+import { getRecoveryPointPlatform, getRecoveryRollupPlatforms } from '@/utils/recoveryPlatformModel';import {normalizeRecoveryModeQueryValue,} from '@/utils/recoveryRecordPresentation';@@ -330,13 +331,13 @@ export function useRecoverySurfaceState() {const platformOptions = createMemo(() => {const platforms = new Set<string>();for (const rollup of rollups()) {- for (const provider of rollup.providers || []) {+ for (const provider of getRecoveryRollupPlatforms(rollup)) {const normalized = normalizeSourcePlatformQueryValue(String(provider || '').trim());if (normalized) platforms.add(normalized);}}for (const point of recoveryPoints.points() || []) {- const normalized = normalizeSourcePlatformQueryValue(String(point?.provider || '').trim());+ const normalized = normalizeSourcePlatformQueryValue(getRecoveryPointPlatform(point));if (normalized) platforms.add(normalized);}return ['all', ...buildSourcePlatformOptions(platforms).map((option) => option.key)];diff --git a/frontend-modern/src/types/recovery.ts b/frontend-modern/src/types/recovery.tsindex 20c58a043e..9cf52c0a02 100644--- a/frontend-modern/src/types/recovery.ts+++ b/frontend-modern/src/types/recovery.ts@@ -1,4 +1,5 @@-export type RecoveryProvider = string;+export type RecoveryPlatform = string;+export type RecoveryProvider = RecoveryPlatform;export type RecoveryKind = 'snapshot' | 'backup' | 'other' | (string & {});export type RecoveryMode = 'snapshot' | 'local' | 'remote' | (string & {});export type RecoveryOutcome =@@ -35,7 +36,8 @@ export interface RecoveryPointDisplay {export interface RecoveryPoint {id: string;- provider: RecoveryProvider;+ platform?: RecoveryPlatform;+ provider?: RecoveryProvider;kind: RecoveryKind;mode: RecoveryMode;outcome: RecoveryOutcome;@@ -83,6 +85,7 @@ export interface ProtectionRollup {lastSuccessAt?: string | null;lastOutcome: RecoveryOutcome;+ platforms?: RecoveryPlatform[];providers?: RecoveryProvider[];}diff --git a/frontend-modern/src/utils/__tests__/recoveryLocationPresentation.test.ts b/frontend-modern/src/utils/__tests__/recoveryLocationPresentation.test.tsindex 155808d95d..6e489b7762 100644--- a/frontend-modern/src/utils/__tests__/recoveryLocationPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/recoveryLocationPresentation.test.ts@@ -20,7 +20,7 @@ describe('recoveryLocationPresentation', () => {expect(getRecoveryPointLocationEntries({id: 'p1',- provider: 'proxmox-pve',+ platform: 'proxmox-pve',kind: 'backup',mode: 'local',outcome: 'success',diff --git a/frontend-modern/src/utils/__tests__/recoveryPlatformModel.test.ts b/frontend-modern/src/utils/__tests__/recoveryPlatformModel.test.tsnew file mode 100644index 0000000000..18e6fd50fb--- /dev/null+++ b/frontend-modern/src/utils/__tests__/recoveryPlatformModel.test.ts@@ -0,0 +1,38 @@+import { describe, expect, it } from 'vitest';++import {+ getRecoveryPointPlatform,+ getRecoveryRollupPlatforms,+} from '@/utils/recoveryPlatformModel';++describe('recoveryPlatformModel', () => {+ it('prefers canonical platform fields when present', () => {+ expect(+ getRecoveryPointPlatform({+ platform: 'truenas',+ provider: 'proxmox-pve',+ }),+ ).toBe('truenas');++ expect(+ getRecoveryRollupPlatforms({+ platforms: ['truenas'],+ providers: ['proxmox-pve'],+ }),+ ).toEqual(['truenas']);+ });++ it('falls back to legacy provider fields when canonical fields are absent', () => {+ expect(+ getRecoveryPointPlatform({+ provider: 'proxmox-pbs',+ }),+ ).toBe('proxmox-pbs');++ expect(+ getRecoveryRollupPlatforms({+ providers: ['proxmox-pbs', 'kubernetes'],+ }),+ ).toEqual(['proxmox-pbs', 'kubernetes']);+ });+});diff --git a/frontend-modern/src/utils/__tests__/recoverySummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/recoverySummaryPresentation.test.tsindex afdc109456..f47b6d3eaa 100644--- a/frontend-modern/src/utils/__tests__/recoverySummaryPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/recoverySummaryPresentation.test.ts@@ -101,9 +101,9 @@ describe('recoverySummaryPresentation', () => {it('builds platform coverage from rollups and multi-platform protected items', () => {const coverage = buildRecoveryPlatformCoverage([- { rollupId: 'a', providers: ['proxmox-pbs'] },- { rollupId: 'b', providers: ['proxmox-pve', 'kubernetes'] },- { rollupId: 'c', providers: [] },+ { rollupId: 'a', platforms: ['proxmox-pbs'] },+ { rollupId: 'b', platforms: ['proxmox-pve', 'kubernetes'] },+ { rollupId: 'c', platforms: [] },]);expect(coverage.platformCount).toBe(4);diff --git a/frontend-modern/src/utils/recoveryPlatformModel.ts b/frontend-modern/src/utils/recoveryPlatformModel.tsnew file mode 100644index 0000000000..578fb41eb6--- /dev/null+++ b/frontend-modern/src/utils/recoveryPlatformModel.ts@@ -0,0 +1,19 @@+import type { ProtectionRollup, RecoveryPoint } from '@/types/recovery';++const toTrimmedString = (value: unknown): string =>+ typeof value === 'string' ? value.trim() : '';++export const getRecoveryPointPlatform = (+ point: Pick<RecoveryPoint, 'platform' | 'provider'> | null | undefined,+): string => toTrimmedString(point?.platform) || toTrimmedString(point?.provider);++export const getRecoveryRollupPlatforms = (+ rollup: Pick<ProtectionRollup, 'platforms' | 'providers'> | null | undefined,+): string[] => {+ const values =+ Array.isArray(rollup?.platforms) && rollup.platforms.length > 0+ ? rollup.platforms+ : rollup?.providers || [];++ return values.map((value) => toTrimmedString(value)).filter(Boolean);+};diff --git a/frontend-modern/src/utils/recoverySummaryPresentation.ts b/frontend-modern/src/utils/recoverySummaryPresentation.tsindex 70334aad02..9daa2aecf5 100644--- a/frontend-modern/src/utils/recoverySummaryPresentation.ts+++ b/frontend-modern/src/utils/recoverySummaryPresentation.ts@@ -14,6 +14,7 @@ import {import {getRecoveryItemTypePresentation,} from '@/utils/recoveryItemTypePresentation';+import { getRecoveryRollupPlatforms } from '@/utils/recoveryPlatformModel';export const RECOVERY_SUMMARY_TIME_RANGES = ['7d', '30d', '90d', '365d'] as const;@@ -385,7 +386,7 @@ export function buildRecoveryPlatformCoverage(for (const rollup of rollups) {const providers = Array.from(new Set(- (rollup.providers || [])+ getRecoveryRollupPlatforms(rollup).map((provider) => normalizeSourcePlatformQueryValue(String(provider || '').trim())).filter(Boolean),),diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 79c1c0a1cd..bdbd56ff10 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -2164,6 +2164,57 @@ func TestContract_ParseRecoveryPlatformQueryPrefersCanonicalPlatformAlias(t *tes}}+func TestContract_RecoveryPointPayloadUsesCanonicalPlatformField(t *testing.T) {+ payload := buildRecoveryPointPayload(recovery.RecoveryPoint{+ ID: "point-1",+ Provider: recovery.Provider("truenas"),+ Kind: recovery.Kind("snapshot"),+ Mode: recovery.Mode("snapshot"),+ Outcome: recovery.Outcome("success"),+ })++ got, err := json.Marshal(payload)+ if err != nil {+ t.Fatalf("marshal recovery point payload: %v", err)+ }++ const want = `{+ "id":"point-1",+ "platform":"truenas",+ "provider":"truenas",+ "kind":"snapshot",+ "mode":"snapshot",+ "outcome":"success"+ }`++ assertJSONSnapshot(t, got, want)+}++func TestContract_RecoveryRollupPayloadUsesCanonicalPlatformsField(t *testing.T) {+ payload := buildRecoveryRollupPayload(recovery.ProtectionRollup{+ RollupID: "rollup-1",+ LastOutcome: recovery.Outcome("success"),+ Providers: []recovery.Provider{+ recovery.Provider("proxmox-pbs"),+ recovery.Provider("truenas"),+ },+ })++ got, err := json.Marshal(payload)+ if err != nil {+ t.Fatalf("marshal recovery rollup payload: %v", err)+ }++ const want = `{+ "rollupId":"rollup-1",+ "lastOutcome":"success",+ "platforms":["proxmox-pbs","truenas"],+ "providers":["proxmox-pbs","truenas"]+ }`++ assertJSONSnapshot(t, got, want)+}+func TestContract_BillingStateJSONSnapshot(t *testing.T) {payload := entitlements.BillingState{Capabilities: []string{"relay", "mobile_app"},diff --git a/internal/api/recovery_handlers.go b/internal/api/recovery_handlers.goindex 991b11d7a5..9caa966244 100644--- a/internal/api/recovery_handlers.go+++ b/internal/api/recovery_handlers.go@@ -38,7 +38,7 @@ func (h *RecoveryHandlers) storeForOrg(orgID string) (*recoverystore.Store, erro}type recoveryPointsResponse struct {- Data []recovery.RecoveryPoint `json:"data"`+ Data []recoveryPointPayload `json:"data"`Meta struct {Page int `json:"page"`Limit int `json:"limit"`@@ -47,6 +47,79 @@ type recoveryPointsResponse struct {} `json:"meta"`}+type recoveryPointPayload struct {+ ID string `json:"id"`+ Platform recovery.Provider `json:"platform"`+ Provider recovery.Provider `json:"provider,omitempty"`+ Kind recovery.Kind `json:"kind"`+ Mode recovery.Mode `json:"mode"`+ Outcome recovery.Outcome `json:"outcome"`++ StartedAt *time.Time `json:"startedAt,omitempty"`+ CompletedAt *time.Time `json:"completedAt,omitempty"`++ SizeBytes *int64 `json:"sizeBytes,omitempty"`+ Verified *bool `json:"verified,omitempty"`+ Encrypted *bool `json:"encrypted,omitempty"`+ Immutable *bool `json:"immutable,omitempty"`++ SubjectResourceID string `json:"subjectResourceId,omitempty"`+ RepositoryResourceID string `json:"repositoryResourceId,omitempty"`+ SubjectRef *recovery.ExternalRef `json:"subjectRef,omitempty"`+ RepositoryRef *recovery.ExternalRef `json:"repositoryRef,omitempty"`+ Details map[string]any `json:"details,omitempty"`+ Display *recovery.RecoveryPointDisplay `json:"display,omitempty"`+}++type recoveryRollupPayload struct {+ RollupID string `json:"rollupId"`+ SubjectResourceID string `json:"subjectResourceId,omitempty"`+ SubjectRef *recovery.ExternalRef `json:"subjectRef,omitempty"`+ Display *recovery.RecoveryPointDisplay `json:"display,omitempty"`+ LastAttemptAt *time.Time `json:"lastAttemptAt,omitempty"`+ LastSuccessAt *time.Time `json:"lastSuccessAt,omitempty"`+ LastOutcome recovery.Outcome `json:"lastOutcome"`+ Platforms []recovery.Provider `json:"platforms,omitempty"`+ Providers []recovery.Provider `json:"providers,omitempty"`+}++func buildRecoveryPointPayload(point recovery.RecoveryPoint) recoveryPointPayload {+ return recoveryPointPayload{+ ID: point.ID,+ Platform: point.Provider,+ Provider: point.Provider,+ Kind: point.Kind,+ Mode: point.Mode,+ Outcome: point.Outcome,+ StartedAt: point.StartedAt,+ CompletedAt: point.CompletedAt,+ SizeBytes: point.SizeBytes,+ Verified: point.Verified,+ Encrypted: point.Encrypted,+ Immutable: point.Immutable,+ SubjectResourceID: point.SubjectResourceID,+ RepositoryResourceID: point.RepositoryResourceID,+ SubjectRef: point.SubjectRef,+ RepositoryRef: point.RepositoryRef,+ Details: point.Details,+ Display: point.Display,+ }+}++func buildRecoveryRollupPayload(rollup recovery.ProtectionRollup) recoveryRollupPayload {+ return recoveryRollupPayload{+ RollupID: rollup.RollupID,+ SubjectResourceID: rollup.SubjectResourceID,+ SubjectRef: rollup.SubjectRef,+ Display: rollup.Display,+ LastAttemptAt: rollup.LastAttemptAt,+ LastSuccessAt: rollup.LastSuccessAt,+ LastOutcome: rollup.LastOutcome,+ Platforms: rollup.Providers,+ Providers: rollup.Providers,+ }+}+func parseRFC3339QueryTime(raw string) (*time.Time, error) {raw = strings.TrimSpace(raw)if raw == "" {@@ -167,7 +240,10 @@ func (h *RecoveryHandlers) HandleListPoints(w http.ResponseWriter, r *http.Reque}var resp recoveryPointsResponse- resp.Data = points+ resp.Data = make([]recoveryPointPayload, 0, len(points))+ for _, point := range points {+ resp.Data = append(resp.Data, buildRecoveryPointPayload(point))+ }resp.Meta.Page = pageresp.Meta.Limit = limitresp.Meta.Total = total@@ -613,8 +689,13 @@ func (h *RecoveryHandlers) HandleListRollups(w http.ResponseWriter, r *http.Requmeta["totalPages"] = (total + limit - 1) / limit}+ payloadRollups := make([]recoveryRollupPayload, 0, len(rollups))+ for _, rollup := range rollups {+ payloadRollups = append(payloadRollups, buildRecoveryRollupPayload(rollup))+ }+if err := utils.WriteJSONResponse(w, map[string]any{- "data": rollups,+ "data": payloadRollups,"meta": meta,}); err != nil {log.Error().Err(err).Msg("Failed to serialize recovery rollups response")diff --git a/internal/api/recovery_handlers_test.go b/internal/api/recovery_handlers_test.goindex 48e1003a23..de1991e2b0 100644--- a/internal/api/recovery_handlers_test.go+++ b/internal/api/recovery_handlers_test.go@@ -69,7 +69,10 @@ func TestHandleListPointsAcceptsCanonicalPlatformQuery(t *testing.T) {}var resp struct {- Data []recovery.RecoveryPoint `json:"data"`+ Data []struct {+ Platform string `json:"platform"`+ Provider string `json:"provider"`+ } `json:"data"`}if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {t.Fatalf("json.Unmarshal() error = %v", err)@@ -78,8 +81,49 @@ func TestHandleListPointsAcceptsCanonicalPlatformQuery(t *testing.T) {t.Fatal("expected recovery points for platform=truenas, got none")}for _, point := range resp.Data {- if point.Provider != recovery.Provider("truenas") {- t.Fatalf("expected only truenas recovery points, got provider %q", point.Provider)+ if point.Platform != "truenas" {+ t.Fatalf("expected only truenas recovery points, got platform %q", point.Platform)+ }+ if point.Provider != "truenas" {+ t.Fatalf("expected compatibility provider field to remain aligned, got %q", point.Provider)+ }+ }+}++func TestHandleListRollupsExposeCanonicalPlatformsPayload(t *testing.T) {+ prevMock := mock.IsMockEnabled()+ mock.SetEnabled(true)+ t.Cleanup(func() {+ mock.SetEnabled(prevMock)+ })++ req := httptest.NewRequest(http.MethodGet, "/api/recovery/rollups?platform=truenas&limit=500", nil)+ rec := httptest.NewRecorder()++ NewRecoveryHandlers(nil).HandleListRollups(rec, req)++ if rec.Code != http.StatusOK {+ t.Fatalf("HandleListRollups() status = %d, want %d", rec.Code, http.StatusOK)+ }++ var resp struct {+ Data []struct {+ Platforms []string `json:"platforms"`+ Providers []string `json:"providers"`+ } `json:"data"`+ }+ if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {+ t.Fatalf("json.Unmarshal() error = %v", err)+ }+ if len(resp.Data) == 0 {+ t.Fatal("expected recovery rollups for platform=truenas, got none")+ }+ for _, rollup := range resp.Data {+ if len(rollup.Platforms) == 0 || rollup.Platforms[0] != "truenas" {+ t.Fatalf("expected canonical platforms payload to include truenas, got %#v", rollup.Platforms)+ }+ if len(rollup.Providers) == 0 || rollup.Providers[0] != "truenas" {+ t.Fatalf("expected compatibility providers payload to remain aligned, got %#v", rollup.Providers)}}}diff --git a/internal/api/router_integration_test.go b/internal/api/router_integration_test.goindex 469dae4760..14fef20048 100644--- a/internal/api/router_integration_test.go+++ b/internal/api/router_integration_test.go@@ -285,7 +285,7 @@ func TestRecoveryRollupsEndpointReturnsMockData(t *testing.T) {hasK8s := falsehasTrueNAS := falsefor _, item := range payload.Data {- raw, ok := item["providers"]+ raw, ok := item["platforms"]if !ok {continue}@@ -304,7 +304,7 @@ func TestRecoveryRollupsEndpointReturnsMockData(t *testing.T) {}}if !hasK8s || !hasTrueNAS {- t.Fatalf("expected rollups to include kubernetes and truenas providers, got k8s=%v truenas=%v", hasK8s, hasTrueNAS)+ t.Fatalf("expected rollups to include kubernetes and truenas platforms, got k8s=%v truenas=%v", hasK8s, hasTrueNAS)}}@@ -451,7 +451,7 @@ func TestRecoveryPointsEndpointReturnsMockData(t *testing.T) {var payload struct {Data []struct {- Provider string `json:"provider"`+ Platform string `json:"platform"`} `json:"data"`Meta struct {Total int `json:"total"`@@ -467,7 +467,7 @@ func TestRecoveryPointsEndpointReturnsMockData(t *testing.T) {var hasK8s, hasTrueNAS boolfor _, p := range payload.Data {- switch p.Provider {+ switch p.Platform {case "kubernetes":hasK8s = truecase "truenas":