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
Trim useRecoveryPoints to what the TrueNAS Protection tab reads
rcourtman5601271aa8e0
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex af7bf6fda2..b0c97df2b4 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -4865,6 +4865,20 @@ those exports read, have been removed.frontend boundary: raw compatibility fields such as `provider` may stillarrive from older `/api/recovery/points` payloads, but the points it returnsare canonical `platform` models.+The hook also holds only what the TrueNAS Protection tab reads. Its query+carries `platform`, `page`, and `limit`, it needs a query accessor, and it+returns the points, the loading and error state, and a refetch. The points+endpoint accepts more filters, but no surface sends them: the hook's other+query options (rollup, kind, mode, outcome, item type, linked resource, text,+cluster, node, namespace, workload scope, verification, and the time window),+its `meta` and `resolvedOnce` results, and the call without a query accessor+that fetched the unfiltered first page had no reader once the aggregate Recovery+page was deleted, and are gone. A surface that needs one of those filters adds+it to the query type together with its caller, and sends a linked-resource+filter as `itemResourceId`, never `subjectResourceId`.+`frontend-modern/src/api/__tests__/recoveryTransport.test.ts` pins the query+keys and the result members at the type level and the three parameters that+reach the wire at runtime.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/0a1e7b1b3247eaec.json b/frontend-modern/browser-verification/0a1e7b1b3247eaec.jsonnew file mode 100644index 0000000000..d19e06d976--- /dev/null+++ b/frontend-modern/browser-verification/0a1e7b1b3247eaec.json@@ -0,0 +1,39 @@+{+ "version": 1,+ "base_sha": "9f3726a05da68dc511007db46f7bf7543bc5f36c",+ "verified_at": "2026-10-08T10:47:25Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/hooks/useRecoveryPoints.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/hooks/useRecoveryPoints.ts": "b7468328eb31dabd1b2a397f0ae2100f140e3acb8f8967906ede84f7e2fd7bb7"+ },+ "routes": [+ "/truenas/overview",+ "/truenas/protection"+ ],+ "viewports": [+ {+ "width": 1440,+ "height": 900+ },+ {+ "width": 390,+ "height": 844+ }+ ],+ "states": [+ "Before/after pair on pulse-dev: production vite builds of the parent tree (main at 9f3726a05d, which is byte-identical to the PR 2750 head f0561c274b the pair was built from) and of this tree, each served with vite preview proxied to the 50-node mock rig on :7699 (which includes the TrueNAS recovery fixtures), driven by the same headless Chromium script at 1440x900 and 390x844.",+ "Off the Protection tab: /truenas/overview makes no /api/recovery/points request in either build, so the hook still sees a null query there. Opening Protection through the section tab requests /api/recovery/points?page=1&limit=200&platform=truenas (two identical requests on open in both builds); the 33 s window on the tab adds one more, the 30 s poll; leaving to Overview and waiting 33 s adds none; returning requests it once. The request URLs and counts are identical in both builds at both widths.",+ "TrueNAS Protection: 10 rows in both builds, named by dataset (archive/backups, tank/apps, vault/compliance, tank/photos, tank/media, fast/vm-images), status filter All 10, Attention 1, Healthy 8, Warning 0, Failed 1, Running 1, Unknown 0; searching \"backups\" narrows to the same three rows; the first row opens the identical Protection detail panel (Kind Replication, Outcome Failed, Dataset archive/backups, Host truenas-main, Replication and Target sections) apart from the mock clock minute. Screenshots of both builds at both widths show the table and the phone layout rendered.",+ "Results JSON: 26 measurements, 24 identical; the two that differ are the detail panel text, which is identical once the mock clock time (03:27/03:28 vs 03:30/03:31) is masked. No failing responses and no console errors in either build.",+ "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, TrueNAS-*.js (69306 to 68264 bytes) loses only the removed hook statements: the unused option normalisation, the unused URL parameters, the \"__all__\" branch, the meta memo and the meta and resolvedOnce return members. The literal rollupId is in the before chunk and not in the after chunk.",+ "check-bundle-size.mjs passes on both builds with no chunk renamed and .bundlesize.json unchanged: TrueNAS 16.86 to 16.57 kB gzip, total JS 1366.45 to 1366.15 kB, total CSS 32.13 kB in both."+ ],+ "interactions": [+ "Sign in with the rig login, load /truenas/overview and wait, click the Protection section tab, read the row labels, status filter options and row count, type \"backups\" into \"Search snapshots or replication\", read the narrowed rows, clear it, expand the first row and read the Protection detail panel; repeat at 390x844.",+ "Stay on Protection for 33 s and count /api/recovery/points requests, click the Overview section tab and wait 33 s, click Protection again and count requests and rows; repeat at 390x844.",+ "Run the same script against the before and after builds and diff the JSON; screenshots of both viewports inspected."+ ]+}diff --git a/frontend-modern/src/api/__tests__/recoveryTransport.test.ts b/frontend-modern/src/api/__tests__/recoveryTransport.test.tsindex 5c8391cf57..3344ec885e 100644--- a/frontend-modern/src/api/__tests__/recoveryTransport.test.ts+++ b/frontend-modern/src/api/__tests__/recoveryTransport.test.ts@@ -1,14 +1,14 @@import { afterEach, describe, expect, expectTypeOf, it, vi } from 'vitest';import { existsSync, readdirSync, readFileSync } from 'node:fs';import { join } from 'node:path';-import { createRoot } from 'solid-js';+import { createRoot, type Accessor } from 'solid-js';import {filterTrueNASProtectionPoints,sortTrueNASProtectionPoints,} from '@/features/truenas/truenasPageModel';import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';-import { useRecoveryPoints } from '@/hooks/useRecoveryPoints';+import { useRecoveryPoints, type RecoveryPointsQuery } from '@/hooks/useRecoveryPoints';import type {RecoveryPoint,RecoveryPointDisplay,@@ -125,6 +125,67 @@ describe('recovery transport', () => {}});+ it('asks /api/recovery/points only for the page, limit and platform it was given', async () => {+ // The points endpoint accepts more filters, but the only reader sends these+ // three. A caller that casts extra filters in must not get them on the wire.+ apiFetchJSONMock.mockResolvedValue({+ data: [],+ meta: { page: 2, limit: 200, total: 0, totalPages: 1 },+ });+ const smuggled = {+ platform: ' truenas ',+ page: 2.7,+ limit: Number.NaN,+ rollupId: 'rollup-1',+ kind: 'snapshot',+ mode: 'snapshot',+ outcome: 'failed',+ itemType: 'dataset',+ itemResourceId: 'res-1',+ subjectResourceId: 'res-2',+ q: 'tank',+ cluster: 'cluster-1',+ node: 'node-1',+ namespace: 'namespace-1',+ scope: 'workload',+ verification: 'verified',+ from: '2026-10-01T00:00:00Z',+ to: '2026-10-02T00:00:00Z',+ } as RecoveryPointsQuery;+ let dispose = () => {};+ createRoot((rootDispose) => {+ dispose = rootDispose;+ useRecoveryPoints(() => smuggled);+ });+ try {+ await vi.waitFor(() => expect(apiFetchJSONMock).toHaveBeenCalledTimes(1));+ expect(apiFetchJSONMock).toHaveBeenCalledWith(+ '/api/recovery/points?page=2&limit=200&platform=truenas',+ );+ } finally {+ dispose();+ }+ });++ it('leaves the platform off a blank request and makes no request without a query', async () => {+ apiFetchJSONMock.mockResolvedValue({+ data: [],+ meta: { page: 1, limit: 200, total: 0, totalPages: 1 },+ });+ let dispose = () => {};+ createRoot((rootDispose) => {+ dispose = rootDispose;+ useRecoveryPoints(() => null);+ useRecoveryPoints(() => ({ platform: ' ' }));+ });+ try {+ await vi.waitFor(() => expect(apiFetchJSONMock).toHaveBeenCalledTimes(1));+ expect(apiFetchJSONMock).toHaveBeenCalledWith('/api/recovery/points?page=1&limit=200');+ } finally {+ dispose();+ }+ });+it('labels, sorts and finds TrueNAS rows by the backend subject label only through the decode', async () => {// The points handler sends the dataset label only as display.subjectLabel.// The TrueNAS Protection tab reads display.itemLabel, never the subject@@ -174,6 +235,21 @@ describe('recovery transport', () => {expectTypeOf<RecoveryPointDisplayTransport>().toHaveProperty('subjectType');});+ it('keeps the recovery points query and hook result to what the Protection tab reads', () => {+ // Enforced by the frontend type check, not at runtime. The tab sends+ // platform, page and limit and reads the points, the loading and error+ // state and a refetch; the aggregate page's other filters and its meta and+ // resolvedOnce members went with it.+ expectTypeOf<keyof RecoveryPointsQuery>().toEqualTypeOf<'page' | 'limit' | 'platform'>();+ type Result = ReturnType<typeof useRecoveryPoints>;+ expectTypeOf<keyof Result>().toEqualTypeOf<'response' | 'points' | 'refetch'>();+ expectTypeOf<Result>().not.toHaveProperty('meta');+ expectTypeOf<Result>().not.toHaveProperty('resolvedOnce');+ expectTypeOf<Parameters<typeof useRecoveryPoints>[0]>().toEqualTypeOf<+ Accessor<RecoveryPointsQuery | null | undefined>+ >();+ });+it('keeps useRecoveryPoints the only recovery-points reader', () => {// The rollup, facet and series hooks went with the aggregate Recovery// page, and the item-type helper with the recovery query serializer thatdiff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASPageSurface.contract.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASPageSurface.contract.test.tsxindex 51f1ba443d..76ba104b4a 100644--- a/frontend-modern/src/features/truenas/__tests__/TrueNASPageSurface.contract.test.tsx+++ b/frontend-modern/src/features/truenas/__tests__/TrueNASPageSurface.contract.test.tsx@@ -137,7 +137,6 @@ describe('TrueNASPageSurface contract', () => {mockSearchParams.value = {};mockVersionInfo.mockReturnValue(null);mockUseRecoveryPoints.mockReturnValue({- meta: () => ({ total: 0 }),points: () => [],response: { loading: false, error: null },refetch: vi.fn(),diff --git a/frontend-modern/src/hooks/useRecoveryPoints.ts b/frontend-modern/src/hooks/useRecoveryPoints.tsindex 9afe7b3390..b5449e9fda 100644--- a/frontend-modern/src/hooks/useRecoveryPoints.ts+++ b/frontend-modern/src/hooks/useRecoveryPoints.ts@@ -12,32 +12,16 @@ const RECOVERY_POINTS_URL = '/api/recovery/points';const DEFAULT_LIMIT = 200;const REFRESH_MS = 30_000;+// The TrueNAS Protection tab is the only reader and asks for one platform's+// first page. The points endpoint accepts more filters; add one here when a+// surface sends it.export type RecoveryPointsQuery = {// Pagingpage?: number | null;limit?: number | null;- // Primary filters (server-side)- rollupId?: string | null;+ // Filter (server-side)platform?: string | null;- kind?: string | null;- mode?: string | null;- outcome?: string | null;- itemType?: string | null;- itemResourceId?: string | null;- subjectResourceId?: string | null;-- // Normalized filters (server-side)- q?: string | null;- cluster?: string | null;- node?: string | null;- namespace?: string | null;- scope?: 'workload' | null;- verification?: 'verified' | 'unverified' | 'unknown' | null;-- // Time window (server-side)- from?: string | null; // RFC3339- to?: string | null; // RFC3339};const normalizeQuery = (query: RecoveryPointsQuery | undefined): RecoveryPointsQuery => {@@ -53,25 +37,7 @@ const normalizeQuery = (query: RecoveryPointsQuery | undefined): RecoveryPointsQreturn {page,limit,-- rollupId: norm(q.rollupId) || null,platform: norm(q.platform) || null,- kind: norm(q.kind) || null,- mode: norm(q.mode) || null,- outcome: norm(q.outcome) || null,- itemType: norm(q.itemType) || null,- itemResourceId: norm(q.itemResourceId) || norm(q.subjectResourceId) || null,- subjectResourceId: null,-- q: norm(q.q) || null,- cluster: norm(q.cluster) || null,- node: norm(q.node) || null,- namespace: norm(q.namespace) || null,- scope: q.scope || null,- verification: q.verification || null,-- from: norm(q.from) || null,- to: norm(q.to) || null,};};@@ -80,7 +46,6 @@ const serializeQuery = (query: RecoveryPointsQuery | undefined): string =>const parseSerializedQuery = (value: string | null): RecoveryPointsQuery | undefined => {if (value == null) return undefined;- if (value === '__all__') return undefined;try {return JSON.parse(value) as RecoveryPointsQuery;} catch {@@ -95,23 +60,7 @@ const buildURL = (query: RecoveryPointsQuery | undefined): string => {params.set('page', String(q.page || 1));params.set('limit', String(q.limit || DEFAULT_LIMIT));- if (q.rollupId) params.set('rollupId', q.rollupId);if (q.platform) params.set('platform', q.platform);- if (q.kind) params.set('kind', q.kind);- if (q.mode) params.set('mode', q.mode);- if (q.outcome) params.set('outcome', q.outcome);- if (q.itemType) params.set('itemType', q.itemType);- if (q.itemResourceId) params.set('itemResourceId', q.itemResourceId);-- if (q.q) params.set('q', q.q);- if (q.cluster) params.set('cluster', q.cluster);- if (q.node) params.set('node', q.node);- if (q.namespace) params.set('namespace', q.namespace);- if (q.scope) params.set('scope', q.scope);- if (q.verification) params.set('verification', q.verification);-- if (q.from) params.set('from', q.from);- if (q.to) params.set('to', q.to);return `${RECOVERY_POINTS_URL}?${params.toString()}`;};@@ -124,9 +73,8 @@ async function fetchRecoveryPointsResponse(return normalizeRecoveryPointsResponse(response);}-export function useRecoveryPoints(query?: Accessor<RecoveryPointsQuery | null | undefined>) {+export function useRecoveryPoints(query: Accessor<RecoveryPointsQuery | null | undefined>) {const source = createMemo<string | null>(() => {- if (!query) return '__all__';const q = query();if (!q) return null;return serializeQuery(q);@@ -144,9 +92,6 @@ export function useRecoveryPoints(query?: Accessor<RecoveryPointsQuery | null |});const points = createMemo<RecoveryPoint[]>(() => state.value().data || []);- const meta = createMemo(- () => state.value().meta || { page: 1, limit: DEFAULT_LIMIT, total: 0, totalPages: 1 },- );const response = {get error() {@@ -160,8 +105,6 @@ export function useRecoveryPoints(query?: Accessor<RecoveryPointsQuery | null |return {response,points,- meta,refetch: state.refetch,- resolvedOnce: state.resolvedOnce,};}