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
Drop the unread postures response meta from the frontend
rcourtman7148c4869cc3
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex a1b9dc254c..4563da044f 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -5003,6 +5003,16 @@ with its reader.keys, the result members and the response keys at the type level, and atruntime the three parameters that reach the wire and that a backend response'smeta does not survive the decode.+`useProtectionPostures.ts` holds the same line for `GET /api/recovery/postures`:+`ProtectionPosturesResponse` carries the posture rows and the policy that the+Proxmox Backups tab reads, and nothing else. That endpoint also returns its+pagination meta and the backend contract is unchanged, but the hook joins its+200-ID batches into one response, so a `limit` or page count would only be+invented client-side and no surface reads one. A surface that pages postures+adds the meta back together with its reader. `RecoveryResponseMeta` went with+the last response type that carried it.+`frontend-modern/src/hooks/__tests__/useProtectionPostures.test.ts` pins the+response keys at the type level.The retired dashboard recovery and storage entry points must stay removed:`useDashboardRecovery`, `DashboardRecoveryStatusPanel`,`DashboardStoragePanel`, dashboard storage/recovery presentation helpers, anddiff --git a/frontend-modern/browser-verification/04393ee3986e24e4.json b/frontend-modern/browser-verification/04393ee3986e24e4.jsonnew file mode 100644index 0000000000..9f850f7a29--- /dev/null+++ b/frontend-modern/browser-verification/04393ee3986e24e4.json@@ -0,0 +1,44 @@+{+ "version": 1,+ "base_sha": "4471dcaaba82a1dab370bf853e0df275ec5d03a2",+ "verified_at": "2026-10-10T12:05:49Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/hooks/useProtectionPostures.ts",+ "frontend-modern/src/types/recovery.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/hooks/useProtectionPostures.ts": "ad70f23ea9bad5d25bf99db28a96f50222cd4c7414498ef47b479e22d8e7ee48",+ "frontend-modern/src/types/recovery.ts": "92f98ab28931bd691381e3563a15fd8ab5813f70c3b357a8d7720f1c34a5c636"+ },+ "routes": [+ "/proxmox/backups/date",+ "/proxmox/backups/coverage"+ ],+ "viewports": [+ {+ "width": 1440,+ "height": 900+ },+ {+ "width": 390,+ "height": 844+ }+ ],+ "states": [+ "Before/after pair on the Mac: production vite builds of this commit's parent (4471dcaaba) and of the same tree with this change (the two source files in changed_paths carry exactly the hashes recorded here), each served with vite preview and proxied to a private mock backend (a copy of the built dev binary on its own port, throwaway data dir, dev admin bypass, a mock estate sized so the tab's postures request splits into two batches). Driven by the same headless Chromium script at 1440x900 and 390x844, two runs per build interleaved before, after, before, after.",+ "Proxmox Backups, By date and Coverage: the Backup health strip reads 221 targets, 725 restore points, 91 with PBS snapshots, 109 protected, 61 attention, 38 unprotected, 10 unknown, 0 checking, 3 not evaluated, with the posture rule footnote; 144 table rows at desktop and 40 at phone in both views; the first rows, the filter chips and the digit-masked text of the whole main region are identical between the builds (the masked text files are byte-identical in all four view and width combinations). All 38 recorded measurements have exactly one distinct value across the four runs.",+ "Postures requests are unchanged: opening either view sends /api/recovery/postures?...&limit=200 twice, one with 200 resource IDs and one with 18, so the hook joins two batches in the real tab, and the 33 s on By date adds the same two requests. No failing responses and no console errors in any run.",+ "The backend response is unchanged and the page ignores it: every /api/recovery/postures response body in both builds has the top-level keys data, meta and policy, meta carries limit, page, total and totalPages, and the two bodies have 200 and 18 rows.",+ "With /api/recovery/postures stubbed to a 500 the \"Protection posture is unavailable\" notice shows in both builds at both widths and the evidence rows stay (144 desktop, 40 phone).",+ "Dist proof: 189 files each side; 94 byte-identical (the CSS included), 94 differ only in chunk-hash names and SRI strings, and 1 differs in code. After normalising hashes and short identifiers, Proxmox-*.js (276802 to 276696 bytes) loses only the meta field of the initial value, its page/limit/total/totalPages literal, the meta field of the joined response and its page/limit/total/totalPages literal, and the local that held the joined rows (now inlined in the return); the statements that replace them are the data-only initial value and the data-only joined response.",+ "check-bundle-size.mjs passes on both builds with no chunk renamed and .bundlesize.json unchanged: Proxmox 77.78 to 77.74 kB gzip, total JS 1365.65 to 1365.57 kB, total CSS 31.92 kB in both.",+ "Unit evidence: on this tree tsc, eslint and prettier are clean and 33 files with 706 tests pass over the hook, the Proxmox features, the recovery transport and the platform-table guardrails; a wide run over src/features, hooks, utils, api, types, __tests__, components/shared, Workloads and Storage on the PR 2787 head plus this change passes 946 of 948 files (16054 tests), the one failing file being agentInstallCommand.test.ts, whose pty helper raises a termios ioctl error on this Mac and which imports nothing this change touches. Single-flaw controls: re-adding meta to the response type fails tsc on the new pin (and with the pin deleted nothing else fails, so the pin is the guard); dropping the joined rows or the policy, keeping only the first batch, joining batches in reverse, re-sorting the rows, or spreading the first batch's wire meta back into the joined response each fail the new hook test."+ ],+ "interactions": [+ "Load /proxmox/backups/date, wait for the Backup health strip, read the strip text and counts, the table row count and first rows, the filter chips and the text of the main region; stay on the page for 33 s and record every /api/recovery/postures request (resource IDs per request, limit) and every response body shape; repeat at 390x844.",+ "Load /proxmox/backups/coverage, wait for the strip, read the same measurements; repeat at 390x844.",+ "In a fresh page stub /api/recovery/postures to a 500 before loading /proxmox/backups/date and read whether the unavailable notice shows and how many rows render; repeat at 390x844.",+ "Run the same script twice against each of the before and after builds and compare the JSON results and the saved page text; screenshots of both viewports inspected."+ ]+}diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsxindex fb62445289..1ef0f3ce48 100644--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx@@ -158,7 +158,6 @@ function mockBackupAPIs(verificationWindowSeconds: 604800,requireVerification: true,},- meta: { page: 1, limit: 200, total: 1, totalPages: 1 },});}@@ -346,7 +345,6 @@ describe('ProxmoxBackupsTable', () => {verificationWindowSeconds: 604800,requireVerification: true,},- meta: { page: 1, limit: 200, total: 1, totalPages: 1 },});await waitFor(() =>@@ -790,7 +788,7 @@ const sourceCalls = (source: 'pve' | 'pbs') =>describe('independent Proxmox backup inventory reads', () => {beforeEach(() => {window.history.replaceState({}, '', '/proxmox/backups/date');- apiFetchJSONMock.mockResolvedValue({ data: [], policy: {}, meta: {} });+ apiFetchJSONMock.mockResolvedValue({ data: [], policy: {} });});it.each(['pve', 'pbs'] as const)(@@ -1167,7 +1165,7 @@ describe('backup-identity: connected Coverage and By date', () => {}),),);- apiFetchJSONMock.mockResolvedValue({ data: [], policy: {}, meta: {} });+ apiFetchJSONMock.mockResolvedValue({ data: [], policy: {} });vi.spyOn(Date, 'now').mockReturnValue(BACKUP_IDENTITY_NOW);};afterEach(() => vi.restoreAllMocks());diff --git a/frontend-modern/src/hooks/__tests__/useProtectionPostures.test.ts b/frontend-modern/src/hooks/__tests__/useProtectionPostures.test.tsindex 00f476dc7c..54445ea790 100644--- a/frontend-modern/src/hooks/__tests__/useProtectionPostures.test.ts+++ b/frontend-modern/src/hooks/__tests__/useProtectionPostures.test.ts@@ -1,9 +1,21 @@-import { describe, expect, it } from 'vitest';+import { afterEach, describe, expect, expectTypeOf, it, vi } from 'vitest';+import { createRoot } from 'solid-js';+import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';import {MAX_PROTECTION_POSTURE_BATCH_SIZE,buildProtectionPostureBatchURL,normalizeProtectionPostureResourceIDs,+ useProtectionPostures,} from '@/hooks/useProtectionPostures';+import type { ProtectionPosturesResponse } from '@/types/recovery';++const apiFetchJSONMock = vi.hoisted(() => vi.fn());+vi.mock('@/utils/apiClient', () => ({ apiFetchJSON: apiFetchJSONMock }));++afterEach(() => {+ apiFetchJSONMock.mockReset();+ resetCreateNonSuspendingQueryCacheForTest();+});describe('useProtectionPostures transport', () => {it('deduplicates and sorts resource IDs for a stable bounded cache key and request', () => {@@ -28,4 +40,61 @@ describe('useProtectionPostures transport', () => {);expect(() => buildProtectionPostureBatchURL(resourceIDs)).toThrow(/limited to 200/);});++ it('joins the batches of a large fleet into the rows and the policy the tab reads', async () => {+ const resourceIDs = Array.from(+ { length: MAX_PROTECTION_POSTURE_BATCH_SIZE + 1 },+ (_, index) => `vm:${String(index).padStart(3, '0')}`,+ );+ const policy = {+ freshnessWindowSeconds: 604800,+ verificationWindowSeconds: 3600,+ requireVerification: true,+ };+ // The backend still sends its pagination meta with every batch, and its rows+ // are not in resource ID order (the handler may order by state first).+ apiFetchJSONMock.mockImplementation(async (url: string) => {+ const requested = new URL(url, 'https://pulse.invalid').searchParams.getAll('resourceId');+ return {+ data: requested+ .slice()+ .reverse()+ .map((subjectResourceId) => ({ subjectResourceId, state: 'protected' })),+ policy,+ meta: { page: 1, limit: 200, total: requested.length, totalPages: 1 },+ };+ });+ let dispose = () => {};+ const hook = createRoot((rootDispose) => {+ dispose = rootDispose;+ return useProtectionPostures(() => resourceIDs);+ });+ try {+ await vi.waitFor(() => expect(hook.postures()).toHaveLength(resourceIDs.length));+ const batchSizes = apiFetchJSONMock.mock.calls.map(+ ([url]) => new URL(url, 'https://pulse.invalid').searchParams.getAll('resourceId').length,+ );+ expect(batchSizes).toEqual([MAX_PROTECTION_POSTURE_BATCH_SIZE, 1]);+ // Each batch keeps the order the backend sent; the batches join in request order.+ expect(hook.postures().map((posture) => posture.subjectResourceId)).toEqual([+ ...resourceIDs.slice(0, MAX_PROTECTION_POSTURE_BATCH_SIZE).reverse(),+ ...resourceIDs.slice(MAX_PROTECTION_POSTURE_BATCH_SIZE),+ ]);+ expect(hook.postureByResourceID().get('vm:200')?.state).toBe('protected');+ expect(hook.policy()).toEqual(policy);+ // The joined response is the rows and the policy at runtime too: the wire meta of the+ // batches is not carried over (the type pin below cannot see a spread of it).+ expect(Object.keys(await hook.refetch()).sort()).toEqual(['data', 'policy']);+ } finally {+ dispose();+ }+ });++ it('models the data and policy of a posture response and nothing else', () => {+ // Enforced by the frontend type check, not at runtime. The endpoint still+ // sends its pagination meta, but the Proxmox Backups tab reads the rows and+ // the policy, and the hook joins 200-ID batches into one response, so a page+ // count or limit would only be invented client-side with no reader.+ expectTypeOf<keyof ProtectionPosturesResponse>().toEqualTypeOf<'data' | 'policy'>();+ });});diff --git a/frontend-modern/src/hooks/useProtectionPostures.ts b/frontend-modern/src/hooks/useProtectionPostures.tsindex 3fde4068b0..c4e83f3315 100644--- a/frontend-modern/src/hooks/useProtectionPostures.ts+++ b/frontend-modern/src/hooks/useProtectionPostures.ts@@ -20,7 +20,6 @@ const EMPTY_POLICY: ProtectionPosturePolicy = {const EMPTY_RESPONSE: ProtectionPosturesResponse = {data: [],policy: EMPTY_POLICY,- meta: { page: 1, limit: MAX_PROTECTION_POSTURE_BATCH_SIZE, total: 0, totalPages: 0 },};export function normalizeProtectionPostureResourceIDs(@@ -64,16 +63,9 @@ async function fetchAllProtectionPostures(batches.push(resourceIDs.slice(offset, offset + MAX_PROTECTION_POSTURE_BATCH_SIZE));}const responses = await Promise.all(batches.map(fetchProtectionPostures));- const data = responses.flatMap((response) => response.data ?? []);return {- data,+ data: responses.flatMap((response) => response.data ?? []),policy: responses[0]?.policy ?? EMPTY_POLICY,- meta: {- page: 1,- limit: MAX_PROTECTION_POSTURE_BATCH_SIZE,- total: data.length,- totalPages: responses.length,- },};}diff --git a/frontend-modern/src/types/recovery.ts b/frontend-modern/src/types/recovery.tsindex 721fc41a94..b112d2e10f 100644--- a/frontend-modern/src/types/recovery.ts+++ b/frontend-modern/src/types/recovery.ts@@ -76,13 +76,6 @@ export interface RecoveryPointTransport extends RecoveryPoint {subjectRef?: RecoveryExternalRef | null;}-export interface RecoveryResponseMeta {- page: number;- limit: number;- total: number;- totalPages: number;-}-export interface RecoveryPointsResponse {data: RecoveryPoint[];}@@ -136,5 +129,4 @@ export interface ProtectionPosturePolicy {export interface ProtectionPosturesResponse {data: ProtectionPosture[];policy: ProtectionPosturePolicy;- meta: RecoveryResponseMeta;}