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
Keep TrueNAS start and running dates out of completed evidence
pulse-triage[bot]0d79797ed60b
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 44eb545cc4..4f2c2b0c7c 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -21,6 +21,21 @@## Purpose+### TrueNAS start and active-run dates are not completion evidence++The Protection table's Completed column, its explicit completion sort and its+inline details require a completion timestamp. A start is never substituted+for a missing finish. Running replication does not present a last-run timestamp+as completion of the active run, even when the source supplies it in completedAt.+Started evidence and the recorded outcome remain available, and an accepted+finished read updates rows and already-open details without a remount. Missing+completions sort last in both directions; dated terminal failures remain dated+failures, not successful backups. The registered+`TrueNASProtectionTable.completion.test.tsx` drives the real query and transport+normalizer through mixed timestamps, sorting and running-to-finished reads.+This changes presentation only: stored timestamps, outcome, identity, API,+policy, backup execution and native recovery are unchanged.+### Failed TrueNAS Protection reads cannot look currentA failed recovery-points refresh must remain visible even when the query retainsdiff --git a/frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx b/frontend-modern/src/features/truenas/TrueNASProtectionTable.tsxindex 28a20816de..17a4484bc4 100644--- a/frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx+++ b/frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx@@ -177,6 +177,11 @@ const targetSecondaryLabel = (point: RecoveryPoint): string => {const sizeLabel = (point: RecoveryPoint): string =>formatPlatformTableBytesValue(point.sizeBytes ?? undefined, '-');+// A start is not a finish. Running replication can also retain a last-run+// timestamp in completedAt, which is not completion of the active run.+const completionTimestamp = (point: RecoveryPoint): string =>+ normalizeRecoveryOutcome(point.outcome) === 'running' ? '' : asTrimmedString(point.completedAt);+// Columns a user can sort by. Every protection column carries a scalar:// Completed orders chronologically and Size on raw bytes, both newest/biggest// first on the first click.@@ -205,9 +210,7 @@ const getTrueNASProtectionSortValue = (return target === '-' ? null : target;}case 'completed':- return getPlatformTableDateTimeSortValue(- asTrimmedString(point.completedAt) || asTrimmedString(point.startedAt),- );+ return getPlatformTableDateTimeSortValue(completionTimestamp(point));case 'size':return typeof point.sizeBytes === 'number' && Number.isFinite(point.sizeBytes)? point.sizeBytes@@ -270,7 +273,7 @@ const buildProtectionDetailSections = (point: RecoveryPoint): ProtectionDetailSedetailRow('Dataset', datasetLabel(point)),detailRow('Host', hostLabel(point)),detailRow('Started', detailDateTime(point.startedAt)),- detailRow('Completed', detailDateTime(point.completedAt)),+ detailRow('Completed', detailDateTime(completionTimestamp(point))),detailRow('Size', sizeLabel(point)),detailRow('Verified', detailBool(point.verified)),detailRow('Encrypted', detailBool(point.encrypted)),@@ -587,10 +590,7 @@ export const TrueNASProtectionTable: Component<{class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}><PlatformTableDateTimeValue- value={- asTrimmedString(point.completedAt) ||- asTrimmedString(point.startedAt)- }+ value={completionTimestamp(point)}emptyText="-"/></TableCell>diff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASProtectionTable.completion.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASProtectionTable.completion.test.tsxnew file mode 100644index 0000000000..6618293be4--- /dev/null+++ b/frontend-modern/src/features/truenas/__tests__/TrueNASProtectionTable.completion.test.tsx@@ -0,0 +1,152 @@+import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';+import { Route, Router } from '@solidjs/router';+import { afterEach, describe, expect, it, vi } from 'vitest';++import { TrueNASProtectionTable } from '@/features/truenas/TrueNASProtectionTable';+import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';+import { useRecoveryPoints } from '@/hooks/useRecoveryPoints';+import type { RecoveryPointTransport } from '@/types/recovery';++const apiFetchJSON = vi.hoisted(() => vi.fn());+vi.mock('@/utils/apiClient', () => ({ apiFetchJSON }));++const startedAt = '2026-10-26T01:00:00Z';+const completedAt = '2026-10-26T01:15:00Z';+const point = (id: string, overrides: Partial<RecoveryPointTransport> = {}) => ({+ id,+ platform: 'truenas',+ kind: 'backup',+ mode: 'remote',+ outcome: 'success',+ startedAt,+ display: { subjectLabel: `tank/${id}`, subjectType: 'dataset' },+ ...overrides,+});++function mountProtection() {+ let recovery!: ReturnType<typeof useRecoveryPoints>;+ render(() => (+ <Router>+ <Route+ path="/*"+ component={() => {+ recovery = useRecoveryPoints(() => ({ platform: 'truenas', page: 1, limit: 200 }));+ return (+ <TrueNASProtectionTable+ points={recovery.points()}+ loading={recovery.response.loading}+ error={recovery.response.error}+ emptyIcon={<span />}+ emptyTitle="No protection"+ emptyDescription="No events in this successful response."+ />+ );+ }}+ />+ </Router>+ ));+ return () => recovery;+}++const row = (id: string) =>+ document.querySelector<HTMLElement>(`[data-truenas-protection-row="${id}"]`)!;+const completion = (id: string) => row(id).querySelectorAll('td')[3]!;+const rowIDs = () =>+ [...document.querySelectorAll('[data-truenas-protection-row]')].map((item) =>+ item.getAttribute('data-truenas-protection-row'),+ );++afterEach(() => {+ cleanup();+ apiFetchJSON.mockReset();+ resetCreateNonSuspendingQueryCacheForTest();+ localStorage.clear();+});++describe('TrueNAS protection completion evidence', () => {+ it('never substitutes a start or a running last-run date for completion in rows or details', async () => {+ apiFetchJSON.mockResolvedValueOnce({+ data: [+ point('running', { outcome: 'running', completedAt }),+ point('started-only'),+ point('failed-started-only', { outcome: 'failed' }),+ point('unknown', { outcome: 'unknown', startedAt: undefined }),+ point('invalid', { completedAt: 'not-a-date' }),+ point('completed', { completedAt }),+ point('failed-completed', { outcome: 'failed', completedAt }),+ ],+ });+ mountProtection();+ await vi.waitFor(() => expect(row('completed')).not.toBeNull());++ for (const id of ['running', 'started-only', 'failed-started-only', 'unknown', 'invalid']) {+ expect(completion(id)).toHaveTextContent(/^\s*-\s*$/);+ }+ for (const id of ['completed', 'failed-completed']) {+ expect(completion(id)).not.toHaveTextContent(/^\s*-\s*$/);+ }+ expect(row('running')).toHaveAttribute('data-truenas-protection-outcome', 'running');+ expect(row('failed-started-only')).toHaveAttribute('data-truenas-protection-outcome', 'failed');++ for (const id of ['running', 'started-only', 'failed-started-only']) {+ await fireEvent.click(row(id));+ const detail = within(screen.getByTestId('truenas-protection-detail'));+ expect(detail.getByText('Started', { exact: true }).closest('tr')).toHaveTextContent('2026');+ expect(detail.queryByText('Completed', { exact: true })).not.toBeInTheDocument();+ await fireEvent.click(detail.getByRole('button', { name: /^Collapse .* details$/ }));+ }+ await fireEvent.click(row('completed'));+ expect(+ within(screen.getByTestId('truenas-protection-detail'))+ .getByText('Completed', { exact: true })+ .closest('tr'),+ ).toHaveTextContent('2026');+ });++ it('sorts completion by actual finished dates with absent completions last in either direction', async () => {+ apiFetchJSON.mockResolvedValueOnce({+ data: [+ point('running', { outcome: 'running', completedAt: '2026-10-26T04:00:00Z' }),+ point('started-only', { startedAt: '2026-10-26T05:00:00Z' }),+ point('older', { completedAt }),+ point('newer', { completedAt: '2026-10-26T02:00:00Z' }),+ ],+ });+ mountProtection();+ await vi.waitFor(() => expect(row('newer')).not.toBeNull());+ const sort = screen.getByRole('columnheader', { name: /Completed/ });+ await fireEvent.click(sort);+ expect(rowIDs().slice(0, 2)).toEqual(['newer', 'older']);+ expect(rowIDs().slice(2).sort()).toEqual(['running', 'started-only']);+ await fireEvent.click(sort);+ expect(rowIDs().slice(0, 2)).toEqual(['older', 'newer']);+ expect(rowIDs().slice(2).sort()).toEqual(['running', 'started-only']);+ });++ it('accepts a finished read and updates the already-open running details without a remount', async () => {+ apiFetchJSON.mockResolvedValueOnce({ data: [point('active', { outcome: 'running' })] });+ const recovery = mountProtection();+ await vi.waitFor(() => expect(row('active')).not.toBeNull());+ await fireEvent.click(row('active'));+ expect(completion('active')).toHaveTextContent(/^\s*-\s*$/);+ expect(+ within(screen.getByTestId('truenas-protection-detail')).queryByText('Completed', {+ exact: true,+ }),+ ).not.toBeInTheDocument();++ apiFetchJSON.mockResolvedValueOnce({ data: [point('active', { completedAt })] });+ await recovery().refetch({ background: true });+ expect(row('active')).toHaveAttribute('data-truenas-protection-outcome', 'success');+ expect(completion('active')).not.toHaveTextContent(/^\s*-\s*$/);+ expect(+ within(screen.getByTestId('truenas-protection-detail')).getByText('Completed', {+ exact: true,+ }),+ ).toBeInTheDocument();+ expect(apiFetchJSON.mock.calls).toEqual([+ ['/api/recovery/points?page=1&limit=200&platform=truenas'],+ ['/api/recovery/points?page=1&limit=200&platform=truenas'],+ ]);+ });+});