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.

refactor(recovery): tighten canonical route helper inputs

rcourtman2b57629528f2
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index dbaba7a80c..67cd9e8aef 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -689,6 +689,10 @@ as page-local toolbar state inside individual recovery sections.
That same shared recovery state owner now also keeps `platform` as the
canonical route and transport filter name for operator-facing recovery links,
while any accepted legacy `provider` aliases remain parser compatibility only.
+Caller-facing shared recovery route builders must therefore stay
+platform-first as well: compatibility `provider` aliases may be accepted while
+parsing legacy links, but they should not remain a first-class input on new
+recovery link construction helpers.
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,
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index bb6bd7eff8..783c6c8fa3 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -162,6 +162,9 @@ platform model from summary through drill-in. Shared recovery URLs and
transport filters should likewise treat `platform` as the canonical
operator-facing query field, with legacy `provider` aliases accepted only as
compatibility input that rewrites back to canonical `platform` route state.
+Shared recovery link builders should therefore accept canonical `platform`
+inputs only; legacy `provider` belongs at parse-time compatibility boundaries,
+not in new caller-facing recovery route helpers.
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
@@ -298,6 +301,11 @@ and recovery-adjacent flows may omit `start`/`end` to use the canonical default
window, but when they provide either bound it must be RFC3339 and `end` must
not be earlier than `start`; invalid values fail as `400 invalid_time_range`
instead of silently shifting the exported reporting window.
+That same adjacent API/reporting transport also owns the optional reporting
+field limits and multi-report request parsing. Storage and recovery consumers
+must treat `metricType`, `title`, request-body size, unknown JSON fields, and
+trailing payload rejection as API-owned validation semantics rather than
+counting on permissive backend coercion.
That adjacent export contract now also includes canonical Proxmox pool
membership for each VM row. Storage and recovery flows may use those current-
state facts when they need fleet context, but they must consume the API-owned
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 4d3a9af864..c43a42c517 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -962,7 +962,9 @@ That same route contract also owns the canonical recovery `platform` query.
`/recovery` links must emit `platform=<owned-source-key>` as the shared
operator-facing route shape, while accepted legacy `provider` aliases may be
parsed only as compatibility input that rewrites back to canonical platform
-route state.
+route state. `frontend-modern/src/routing/resourceLinks.ts` must not keep
+legacy `provider` as a first-class build option once parse-time compatibility
+has converted it back to canonical recovery route 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
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index 322d5def39..f250cd0ad5 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -279,10 +279,12 @@ describe('resource link routing contract', () => {
expect(buildRecoveryPath({ platform: 'pbs', mode: 'remote' })).toBe(
'/recovery?platform=proxmox-pbs&mode=remote',
);
- expect(parseRecoveryLinkSearch('?provider=proxmox&mode=local')).toMatchObject({
+ const parsed = parseRecoveryLinkSearch('?provider=proxmox&mode=local');
+ expect(parsed).toMatchObject({
platform: 'proxmox-pve',
mode: 'local',
});
+ expect(buildRecoveryPath(parsed)).toBe('/recovery?platform=proxmox-pve&mode=local');
expect(parseRecoveryLinkSearch('?itemType=proxmox-vm')).toMatchObject({
itemType: 'vm',
});
diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts
index a37875a2f0..80e8ab629c 100644
--- a/frontend-modern/src/routing/resourceLinks.ts
+++ b/frontend-modern/src/routing/resourceLinks.ts
@@ -114,7 +114,6 @@ type RecoveryLinkOptions = {
rollupId?: string | null;
view?: string | null;
platform?: string | null;
- provider?: string | null;
stale?: string | null;
range?: string | null;
cluster?: string | null;
@@ -129,6 +128,8 @@ type RecoveryLinkOptions = {
query?: string | null;
};
+const RECOVERY_LEGACY_PLATFORM_QUERY_PARAM = 'provider';
+
export const parseWorkloadsLinkSearch = (search: string) => {
const params = new URLSearchParams(search);
return {
@@ -262,7 +263,7 @@ export const parseRecoveryLinkSearch = (search: string) => {
platform: normalizeSourcePlatformQueryValue(
firstNonEmpty([
params.get(RECOVERY_QUERY_PARAMS.platform),
- params.get('provider'),
+ params.get(RECOVERY_LEGACY_PLATFORM_QUERY_PARAM),
]),
),
stale: normalizeQueryBooleanFlag(params.get(RECOVERY_QUERY_PARAMS.stale)),
@@ -284,9 +285,7 @@ export const buildRecoveryPath = (options: RecoveryLinkOptions = {}): string =>
const params = new URLSearchParams();
const rollupId = normalizeQueryValue(options.rollupId);
const view = normalizeQueryValue(options.view);
- const platform = normalizeSourcePlatformQueryValue(
- firstNonEmpty([options.platform, options.provider]),
- );
+ const platform = normalizeSourcePlatformQueryValue(options.platform);
const stale = normalizeQueryBooleanFlag(options.stale);
const range = normalizeQueryValue(options.range);
const cluster = normalizeQueryValue(options.cluster);