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 indeterminate backup task order from claiming a latest OK
pulse-triage[bot]4bcfde9b09b6
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex d43c9cb923..01c311fbb3 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -10379,3 +10379,29 @@ Count/Volume switching, selection and source scope through the HTTP consumer.`proxmoxBackupActivityPresentation.test.ts` checks separate unknown counts,excluded dates, labels and per-source tooltips. Browser verification must inspectthe real table/chart with safe inventory at desktop and narrow viewports.++### Coverage task order is evidence, not an input-order tie-break++The Coverage task summary names a latest task only when the observed start times+establish one (or only one task was observed). Missing, invalid, non-positive or+future starts cannot be ranked as epoch dates; distinct observations with equal+latest starts cannot be ordered by input position, status or ID. In either+ambiguous case the summary is Unknown, not OK or None. The existing detail+explains the uncertainty and retains every possible latest task's status, start,+duration, literal error and full ID. Possible tasks are displayed in a stable+non-time order; older known tasks are not possible latest tasks.++The task column remains visible even when no latest task can be established.+Existing workload/search scope includes candidate errors and IDs, never another+connection's namesake. Ordinary inventory refresh can restore an ordered latest,+reintroduce uncertainty or remove all task evidence without replacing the keyed+row, open panel or disclosure focus. No new API read, route, association rule,+protection assessment, backup/guest operation or recovery guarantee is added.++`proxmoxBackupTaskChronology.test.ts` checks permutations, ties, future/unknown+starts, candidate completeness, scope and sole/absent tasks.+`ProxmoxCoverageTable.test.tsx` checks the canonical compact/full consuming+summary and complete candidate detail. `backupTaskEvidence.test.tsx` exercises the parsed HTTP inventory through the+router, compact/full summaries, complete literal evidence, saved-view search and+ordinary polling. Browser verification must exercise these states through the+production consumer at desktop and narrow widths and inspect actual pixels.diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 1fa6c3810c..1061890767 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -7907,3 +7907,29 @@ Count/Volume switching, selection and source scope through the HTTP consumer.`proxmoxBackupActivityPresentation.test.ts` checks separate unknown counts,excluded dates, labels and per-source tooltips. Browser verification must inspectthe real table/chart with safe inventory at desktop and narrow viewports.++### Coverage task order is evidence, not an input-order tie-break++The Coverage task summary names a latest task only when the observed start times+establish one (or only one task was observed). Missing, invalid, non-positive or+future starts cannot be ranked as epoch dates; distinct observations with equal+latest starts cannot be ordered by input position, status or ID. In either+ambiguous case the summary is Unknown, not OK or None. The existing detail+explains the uncertainty and retains every possible latest task's status, start,+duration, literal error and full ID. Possible tasks are displayed in a stable+non-time order; older known tasks are not possible latest tasks.++The task column remains visible even when no latest task can be established.+Existing workload/search scope includes candidate errors and IDs, never another+connection's namesake. Ordinary inventory refresh can restore an ordered latest,+reintroduce uncertainty or remove all task evidence without replacing the keyed+row, open panel or disclosure focus. No new API read, route, association rule,+protection assessment, backup/guest operation or recovery guarantee is added.++`proxmoxBackupTaskChronology.test.ts` checks permutations, ties, future/unknown+starts, candidate completeness, scope and sole/absent tasks.+`ProxmoxCoverageTable.test.tsx` checks the canonical compact/full consuming+summary and complete candidate detail. `backupTaskEvidence.test.tsx` exercises the parsed HTTP inventory through the+router, compact/full summaries, complete literal evidence, saved-view search and+ordinary polling. Browser verification must exercise these states through the+production consumer at desktop and narrow widths and inspect actual pixels.diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex d971cdbda9..2b7b4f2f4c 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -8861,3 +8861,29 @@ The reserve derives from the full keyed measured-height map plus table chrome,not a DOM height sampled while a window retires. Offscreen detail measurementsremain in that map until the owning item is remeasured or removed, so a transientDOM extent cannot lower the reserve before its compensating spacer settles.++### Coverage task order is evidence, not an input-order tie-break++The Coverage task summary names a latest task only when the observed start times+establish one (or only one task was observed). Missing, invalid, non-positive or+future starts cannot be ranked as epoch dates; distinct observations with equal+latest starts cannot be ordered by input position, status or ID. In either+ambiguous case the summary is Unknown, not OK or None. The existing detail+explains the uncertainty and retains every possible latest task's status, start,+duration, literal error and full ID. Possible tasks are displayed in a stable+non-time order; older known tasks are not possible latest tasks.++The task column remains visible even when no latest task can be established.+Existing workload/search scope includes candidate errors and IDs, never another+connection's namesake. Ordinary inventory refresh can restore an ordered latest,+reintroduce uncertainty or remove all task evidence without replacing the keyed+row, open panel or disclosure focus. No new API read, route, association rule,+protection assessment, backup/guest operation or recovery guarantee is added.++`proxmoxBackupTaskChronology.test.ts` checks permutations, ties, future/unknown+starts, candidate completeness, scope and sole/absent tasks.+`ProxmoxCoverageTable.test.tsx` checks the canonical compact/full consuming+summary and complete candidate detail. `backupTaskEvidence.test.tsx` exercises the parsed HTTP inventory through the+router, compact/full summaries, complete literal evidence, saved-view search and+ordinary polling. Browser verification must exercise these states through the+production consumer at desktop and narrow widths and inspect actual pixels.diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsxindex 6fe93d9438..df7899e3f4 100644--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx@@ -377,7 +377,9 @@ export const ProxmoxBackupsTable: Component<{// The task column auto-hides when no workload has task history (computed// over the full set so it does not flicker as filters change).const coverageHasTask = createMemo(() =>- recoveryModel().coverageRows.some((row) => Boolean(row.latestTask)),+ recoveryModel().coverageRows.some((row) =>+ Boolean(row.latestTask || row.taskCandidates?.length),+ ),);const coverageRowsForLocation = createMemo<WorkloadCoverageRow[]>(() => {diff --git a/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsxindex 6efa0e5e4a..e662b3df1b 100644--- a/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx@@ -34,6 +34,7 @@ import { useObservedElementWidth } from '@/hooks/useObservedElementWidth';import {getWorkloadRecoveryPostureLabel,type WorkloadCoverageRow,+ type CoverageTask,} from './proxmoxBackupRecoveryModel';import { proxmoxBackupWorkloadSubject } from './proxmoxBackupWorkloadSubject';import { formatDurationFromSeconds, type CoverageSortKey } from './proxmoxBackupsTableModel';@@ -181,6 +182,49 @@ const postureExplanation = (row: WorkloadCoverageRow): string => {return 'Pulse cannot tell yet whether this guest is backed up.';};+const TASK_ORDER_NOTICE =+ 'Task start times do not establish which task ran last. Possible latest tasks are listed below without a time order.';++const buildCoverageTaskSection = (task: CoverageTask, label: string): DetailSection => ({+ label,+ rows: compactDetailRows([+ makeDetailRow('Status', task.label, {+ tone: statusDetailTone(taskWordVariant(task.label)),+ }),+ makeDetailRow(+ 'Started',+ task.startedMs === undefined ? 'Unknown' : formatPlatformTableDateTimeValue(task.startedMs),+ { tone: task.startedMs === undefined ? 'warning' : undefined },+ ),+ makeDetailRow(+ 'Duration',+ task.durationSeconds === undefined+ ? 'Not reported'+ : task.durationSeconds === 0+ ? '0s'+ : formatDurationFromSeconds(task.durationSeconds),+ ),+ makeDetailRow(+ 'Error',+ task.error?.trim() || (task.label === 'Failed' ? 'Not reported' : undefined),+ {+ tone: 'danger',+ valueContent: (+ <span class="block whitespace-pre-wrap text-left font-normal leading-snug wrap-anywhere">+ {task.error?.trim() || 'Not reported'}+ </span>+ ),+ },+ ),+ makeDetailRow('Task ID', task.id, { wrap: true }),+ ]),+ footerContent: (+ <p class="whitespace-normal text-[11px] leading-snug text-muted wrap-anywhere">+ Task status does not verify a restore or guest responsiveness.+ </p>+ ),+});+// Provider evidence quality (did the job run, is history complete, can Pulse// read it) explains a posture; it is detail, not the answer.const buildCoverageDetailSections = (row: WorkloadCoverageRow): DetailSection[] =>@@ -196,50 +240,21 @@ const buildCoverageDetailSections = (row: WorkloadCoverageRow): DetailSection[]}),]),},- row.latestTask+ row.taskCandidates?.length? {- label: 'Latest task',- rows: compactDetailRows([- makeDetailRow('Status', row.latestTask.label, {- tone: statusDetailTone(taskWordVariant(row.latestTask.label)),- }),- makeDetailRow(- 'Started',- row.latestTask.startedMs === undefined- ? 'Unknown'- : formatPlatformTableDateTimeValue(row.latestTask.startedMs),- { tone: row.latestTask.startedMs === undefined ? 'warning' : undefined },- ),- makeDetailRow(- 'Duration',- row.latestTask.durationSeconds === undefined- ? 'Not reported'- : row.latestTask.durationSeconds === 0- ? '0s'- : formatDurationFromSeconds(row.latestTask.durationSeconds),- ),- makeDetailRow(- 'Error',- row.latestTask.error?.trim() ||- (row.latestTask.label === 'Failed' ? 'Not reported' : undefined),- {- tone: 'danger',- valueContent: (- <span class="block whitespace-pre-wrap text-left font-normal leading-snug wrap-anywhere">- {row.latestTask.error?.trim() || 'Not reported'}- </span>- ),- },- ),- makeDetailRow('Task ID', row.latestTask.id, { wrap: true }),- ]),+ label: 'Task order',+ rows: [makeDetailRow('Latest task', 'Unknown', { tone: 'warning' })],footerContent: (<p class="whitespace-normal text-[11px] leading-snug text-muted wrap-anywhere">- Task status does not verify a restore or guest responsiveness.+ {TASK_ORDER_NOTICE}</p>),}: null,+ ...(row.taskCandidates ?? []).map((task, index) =>+ buildCoverageTaskSection(task, `Possible latest task ${index + 1}`),+ ),+ row.latestTask ? buildCoverageTaskSection(row.latestTask, 'Latest task') : null,{label: 'Provider evidence',rows: compactDetailRows(@@ -571,12 +586,33 @@ export function ProxmoxCoverageTable(props: {when={row.latestTask}fallback={<Show- when={layoutMode() !== 'compact'}- fallback={<span class="block text-center text-muted">—</span>}+ when={!row.taskCandidates?.length}+ fallback={+ <div+ class="flex items-center justify-center gap-2 sm:justify-start"+ title={TASK_ORDER_NOTICE}+ >+ <StatusDot size="sm" variant="warning" ariaHidden />+ <span+ class={+ layoutMode() === 'compact'+ ? 'sr-only'+ : 'text-amber-600 dark:text-amber-300'+ }+ >+ <span class="sr-only">Latest task: </span>Unknown+ </span>+ </div>+ }>- <span class="text-muted" title="No recent task">- {COVERAGE_EMPTY_LABEL}- </span>+ <Show+ when={layoutMode() !== 'compact'}+ fallback={<span class="block text-center text-muted">—</span>}+ >+ <span class="text-muted" title="No recent task">+ {COVERAGE_EMPTY_LABEL}+ </span>+ </Show></Show>}>diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsxindex 6191b95185..9ee4b75feb 100644--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx@@ -10,6 +10,7 @@ import {BACKUP_IDENTITY_NOW,identityArchive,identityGuest,+ identityTask,} from '../__fixtures__/backupIdentity';import type { WorkloadCoverageRow } from '../proxmoxBackupRecoveryModel';import type { CoverageSortKey } from '../proxmoxBackupsTableModel';@@ -825,3 +826,64 @@ describe('backup evidence native scrolling', () => {},);});++describe('indeterminate task order in the canonical Coverage consumer', () => {+ it.each([330, 1200])(+ 'does not show a latest OK when a failed task cannot be ordered at %ipx',+ (width) => {+ const model = buildProxmoxBackupRecoveryModel({+ workloads: [identityGuest('east-100', 'east', 'pve-1')],+ pbsBackups: [],+ archives: [],+ snapshots: [],+ tasks: [+ identityTask({+ id: 'unknown-start',+ status: 'failed',+ startTime: '',+ error: 'retained failure',+ }),+ identityTask({ id: 'dated-ok' }),+ ],+ nowMs: BACKUP_IDENTITY_NOW,+ });+ const current = model.coverageRows[0];+ renderInRouter(() => (+ <ProxmoxCoverageTable+ rows={model.coverageRows}+ hasAnyRows+ emptyIcon={<span />}+ emptyTitle=""+ emptyDescription=""+ sortKey={() => 'posture'}+ sortDirection={() => 'asc'}+ onSort={() => {}}+ expandedKey={current.key}+ onToggleExpand={() => {}}+ showTaskColumn+ layoutWidth={() => width}+ />+ ));+ const summary = document.querySelector('[data-proxmox-backup-row="coverage"]')!;+ expect(summary).toHaveTextContent('Latest task: Unknown');+ expect(summary).not.toHaveTextContent('OK');+ const panel = screen.getByTestId('proxmox-coverage-detail');+ expect(within(panel).queryByText('Latest task', { selector: 'th', exact: true })).toBeNull();+ expect(+ within(panel).getByText('Task order', { selector: 'th', exact: true }),+ ).toBeInTheDocument();+ expect(+ within(panel).getByText('Possible latest task 1', { selector: 'th', exact: true }),+ ).toBeInTheDocument();+ expect(+ within(panel).getByText('Possible latest task 2', { selector: 'th', exact: true }),+ ).toBeInTheDocument();+ expect(panel).toHaveTextContent('unknown-start');+ expect(panel).toHaveTextContent('retained failure');+ expect(panel).toHaveTextContent('dated-ok');+ expect(panel).toHaveTextContent(+ 'Task status does not verify a restore or guest responsiveness.',+ );+ },+ );+});diff --git a/frontend-modern/src/features/proxmox/__tests__/backupTaskEvidence.test.tsx b/frontend-modern/src/features/proxmox/__tests__/backupTaskEvidence.test.tsxindex 8b21e54379..54be106f11 100644--- a/frontend-modern/src/features/proxmox/__tests__/backupTaskEvidence.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/backupTaskEvidence.test.tsx@@ -188,3 +188,139 @@ describe('latest backup task evidence through the inventory consumer', () => {expect(api.fetch).toHaveBeenCalledTimes(6);});});++describe('uncertain task chronology through the inventory consumer', () => {+ const chronology = (panel: HTMLElement) =>+ within(panel).getByText('Task order', { exact: true, selector: 'th' }).closest('tbody')!;+ const candidate = (panel: HTMLElement, n: number) =>+ within(panel)+ .getByText(`Possible latest task ${n}`, { exact: true, selector: 'th' })+ .closest('tbody')!;+ const setAmbiguous = (startTime = 'invalid') => {+ tasks = [failedTask({ id: 'uncertain-failure', startTime }), identityTask({ id: 'dated-ok' })];+ };++ it.each([+ { start: '', width: 1200 },+ { start: 'invalid', width: 330 },+ { start: '2027-01-01T00:00:00Z', width: 1200 },+ { start: '2026-10-04T11:00:00Z', width: 330 },+ ])(+ 'withdraws a false latest OK and exposes both possible tasks: $start / $width',+ async ({ start, width }) => {+ api.width = width;+ setAmbiguous(start);+ mount();+ const panel = await open();+ expect(value(chronology(panel), 'Latest task')).toHaveTextContent('Unknown');+ expect(chronology(panel)).toHaveTextContent(+ 'Task start times do not establish which task ran last. Possible latest tasks are listed below without a time order.',+ );+ expect(within(panel).queryByText('Latest task', { exact: true, selector: 'th' })).toBeNull();+ const candidates = [candidate(panel, 1), candidate(panel, 2)];+ const failureSection = candidates.find(+ (section) => value(section, 'Task ID').textContent === 'uncertain-failure',+ )!;+ expect(value(failureSection, 'Status')).toHaveTextContent('Failed');+ expect(value(failureSection, 'Error').textContent).toBe(failure);+ expect(value(failureSection, 'Error').querySelector('svg')).toBeNull();+ expect(value(failureSection, 'Started')).toHaveTextContent(+ start === '2026-10-04T11:00:00Z'+ ? formatPlatformTableDateTimeValue(Date.parse(start))+ : 'Unknown',+ );+ const summary = screen+ .getByRole('button', {+ name: 'Collapse details for same-name (VM 100) · PVE connection: east',+ })+ .closest('tr')!;+ expect(summary).toHaveTextContent('Latest task: Unknown');+ expect(summary).not.toHaveTextContent('OK');+ expect(panel).toHaveTextContent('dated-ok');+ expect(panel).toHaveTextContent('Restore evidence');+ expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();+ expect(api.fetch).toHaveBeenCalledTimes(2);++ fireEvent.click(within(panel).getByRole('button', { name: 'Collapse same-name details' }));+ const west = await open('west');+ expect(west).not.toHaveTextContent('Possible latest task');+ expect(west.textContent).not.toContain(failure);+ expect(west).not.toHaveTextContent('Task order');+ },+ );++ it('keeps the task column and all possible tasks when every start is unknown', async () => {+ tasks = [+ failedTask({ id: 'failure-a', startTime: 'invalid' }),+ identityTask({ id: 'ok-b', startTime: '' }),+ ];+ mount();+ const panel = await open();+ expect(screen.getByRole('columnheader', { name: 'Job' })).toBeInTheDocument();+ expect(value(chronology(panel), 'Latest task')).toHaveTextContent('Unknown');+ expect(value(candidate(panel, 1), 'Started')).toHaveTextContent('Unknown');+ expect(value(candidate(panel, 2), 'Started')).toHaveTextContent('Unknown');+ expect(panel).toHaveTextContent('failure-a');+ expect(panel).toHaveTextContent('ok-b');+ });++ it('reconciles uncertain, ordered, uncertain and absent tasks in the open keyed panel on ordinary polls', async () => {+ setAmbiguous();+ mount();+ const panel = await open();+ expect(value(chronology(panel), 'Latest task')).toHaveTextContent('Unknown');+ const toggle = screen.getByRole('button', {+ name: 'Collapse details for same-name (VM 100) · PVE connection: east',+ });+ toggle.focus();+ const summary = toggle.closest('tr');+ tasks = [failedTask({ startTime: '2026-10-03T11:00:00Z' }), identityTask({ id: 'ordered-ok' })];+ await vi.advanceTimersByTimeAsync(30_000);+ await waitFor(() =>+ expect(value(taskSection(panel), 'Task ID')).toHaveTextContent('ordered-ok'),+ );+ expect(value(taskSection(panel), 'Status')).toHaveTextContent('OK');+ expect(panel).not.toHaveTextContent('Task order');+ expect(panel).not.toHaveTextContent('Possible latest task');+ expect(panel.textContent).not.toContain(failure);++ setAmbiguous('2027-01-01T00:00:00Z');+ await vi.advanceTimersByTimeAsync(30_000);+ await waitFor(() =>+ expect(value(chronology(panel), 'Latest task')).toHaveTextContent('Unknown'),+ );+ expect(panel.textContent).toContain(failure);+ expect(panel).not.toHaveTextContent('ordered-ok');+ expect(within(panel).queryByText('Latest task', { exact: true, selector: 'th' })).toBeNull();++ tasks = [];+ await vi.advanceTimersByTimeAsync(30_000);+ await waitFor(() => expect(panel).not.toHaveTextContent('Task order'));+ expect(panel).not.toHaveTextContent('Possible latest task');+ expect(panel.textContent).not.toContain(failure);+ expect(panel).toHaveTextContent('Restore evidence');+ expect(screen.getByTestId('proxmox-coverage-detail')).toBe(panel);+ expect(toggle.closest('tr')).toBe(summary);+ expect(document.activeElement).toBe(toggle);+ expect(api.fetch).toHaveBeenCalledTimes(8);+ });++ it('finds scoped possible-task errors and IDs through the existing saved-view search', async () => {+ setAmbiguous();+ mount();+ await open();+ const input = screen.getByPlaceholderText(+ 'Search backups by workload, node, source, or status',+ );+ fireEvent.input(input, { target: { value: 'uncertain-failure' } });+ await waitFor(() =>+ expect(document.querySelectorAll('[data-proxmox-backup-row="coverage"]')).toHaveLength(1),+ );+ await waitFor(() => expect(window.location.search).toContain('q=uncertain-failure'));+ expect(screen.getByTestId('proxmox-coverage-detail').textContent).toContain(failure);+ fireEvent.input(input, { target: { value: 'backup target unavailable' } });+ await waitFor(() => expect(window.location.search).toContain('backup+target+unavailable'));+ expect(document.querySelectorAll('[data-proxmox-backup-row="coverage"]')).toHaveLength(1);+ expect(api.fetch).toHaveBeenCalledTimes(2);+ });+});diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.branchcov0724pm.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.branchcov0724pm.test.tsindex 75959b6b37..005d65a1bd 100644--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.branchcov0724pm.test.ts+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.branchcov0724pm.test.ts@@ -193,10 +193,7 @@ describe('snapshot artifact detail fallback chain (||)', () => {});// ----------------------------------------------------------------------------// latestTask replacement comparison (line 548). Existing specs add at most one-// task per workload, so `!row.latestTask` always short-circuits and the-// `(candidateTask.startedMs ?? 0) > (row.latestTask.startedMs ?? 0)` comparison-// is never evaluated. We add multiple tasks for one workload.+// Multiple task observations must not invent a chronology for unknown starts.// ---------------------------------------------------------------------------describe('latestTask replacement comparison', () => {@@ -222,8 +219,7 @@ describe('latestTask replacement comparison', () => {expect(model.coverageRows[0].latestTask?.id).toBe('t-new');});- it('treats a task with an unparseable start time as epoch (0) when comparing', () => {- // startedMs is undefined for the garbage timestamp -> ?? 0 -> always older.+ it('retains an unparseable start as a possible latest task, not an epoch date', () => {const model = buildModel({workloads: [workload({})],tasks: [@@ -231,13 +227,14 @@ describe('latestTask replacement comparison', () => {task({ id: 't-garbage', startTime: 'not-a-date' }),],});- expect(model.coverageRows[0].latestTask?.id).toBe('t-valid');- expect(model.coverageRows[0].latestTask?.startedMs).toBe(Date.parse(isoDaysAgo(2)));+ expect(model.coverageRows[0].latestTask).toBeUndefined();+ expect(model.coverageRows[0].taskCandidates?.map((task) => task.id)).toEqual([+ 't-garbage',+ 't-valid',+ ]);});- it('treats the stored task as epoch (0) when its start time is unparseable', () => {- // The first task wins the slot with an undefined startedMs; the second- // task's comparison then evaluates `(row.latestTask.startedMs ?? 0)`.+ it('does not let a later input displace an unparseable task start', () => {const later = isoDaysAgo(1);const model = buildModel({workloads: [workload({})],@@ -246,8 +243,11 @@ describe('latestTask replacement comparison', () => {task({ id: 't-valid-later', startTime: later }),],});- expect(model.coverageRows[0].latestTask?.id).toBe('t-valid-later');- expect(model.coverageRows[0].latestTask?.startedMs).toBe(Date.parse(later));+ expect(model.coverageRows[0].latestTask).toBeUndefined();+ expect(model.coverageRows[0].taskCandidates?.map((task) => task.id)).toEqual([+ 't-garbage-first',+ 't-valid-later',+ ]);});});diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupTaskChronology.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupTaskChronology.test.tsnew file mode 100644index 0000000000..808a0e4682--- /dev/null+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupTaskChronology.test.ts@@ -0,0 +1,95 @@+import { describe, expect, it } from 'vitest';+import type { BackupTask } from '@/types/api';+import {+ buildProxmoxBackupRecoveryModel,+ coverageRowMatchesSearch,+} from '../proxmoxBackupRecoveryModel';+import { BACKUP_IDENTITY_NOW, identityGuest, identityTask } from '../__fixtures__/backupIdentity';++const invalidStarts = ['', 'invalid', '2027-01-01T00:00:00Z', '1970-01-01T00:00:00Z'];+const guests = ['east', 'west'].map((instance) =>+ identityGuest(`guest-${instance}`, instance, 'pve-1'),+);+function build(tasks: BackupTask[]) {+ return buildProxmoxBackupRecoveryModel({+ workloads: guests,+ pbsBackups: [],+ archives: [],+ snapshots: [],+ tasks,+ nowMs: BACKUP_IDENTITY_NOW,+ }).coverageRows;+}+const failed = (startTime: string) =>+ identityTask({ id: 'undated-failure', status: 'failed', error: 'retained error', startTime });+const ok = identityTask({ id: 'dated-ok' });++describe('backup task chronology', () => {+ it.each(invalidStarts.flatMap((start) => [false, true].map((reverse) => ({ start, reverse }))))(+ 'never ranks an unknown start against a dated OK: $start, reversed=$reverse',+ ({ start, reverse }) => {+ const tasks = [failed(start), ok];+ const [east, west] = build(reverse ? tasks.reverse() : tasks);+ expect(east.latestTask).toBeUndefined();+ expect(east.taskCandidates?.map((task) => task.id)).toEqual(['undated-failure', 'dated-ok']);+ expect(east.taskCandidates?.[0].startedMs).toBeUndefined();+ expect(east.taskCandidates?.[0].error).toBe('retained error');+ expect(coverageRowMatchesSearch(east, 'RETAINED ERROR')).toBe(true);+ expect(coverageRowMatchesSearch(east, 'undated-failure')).toBe(true);+ expect(west.latestTask).toBeUndefined();+ expect(west.taskCandidates).toBeUndefined();+ expect(coverageRowMatchesSearch(west, 'retained error')).toBe(false);+ expect(east.posture).toBe('unknown');+ },+ );++ it.each([false, true])(+ 'does not break equal starts by status or input order: reversed=%s',+ (reverse) => {+ const tasks = [failed(ok.startTime), ok];+ const [east] = build(reverse ? tasks.reverse() : tasks);+ expect(east.latestTask).toBeUndefined();+ expect(east.taskCandidates?.map((task) => task.id)).toEqual(['dated-ok', 'undated-failure']);+ expect(+ east.taskCandidates?.every((task) => task.startedMs === Date.parse(ok.startTime)),+ ).toBe(true);+ },+ );++ it('retains all unknown starts and only the newest dated candidates in a stable non-time order', () => {+ const tasks = [+ failed('invalid'),+ identityTask({ id: 'other-unknown', startTime: '' }),+ ok,+ identityTask({ id: 'same-time-failure', status: 'error' }),+ identityTask({ id: 'older', startTime: '2026-10-03T11:00:00Z' }),+ ];+ const [east] = build(tasks);+ expect(east.latestTask).toBeUndefined();+ expect(east.taskCandidates?.map((task) => task.id)).toEqual([+ 'other-unknown',+ 'undated-failure',+ 'dated-ok',+ 'same-time-failure',+ ]);+ expect(build(tasks.reverse())[0].taskCandidates).toEqual(east.taskCandidates);+ });++ it.each(invalidStarts)(+ 'keeps a sole observed task status without inventing a start: %s',+ (start) => {+ const [east] = build([failed(start)]);+ expect(east.taskCandidates).toBeUndefined();+ expect(east.latestTask).toMatchObject({ id: 'undated-failure', label: 'Failed' });+ expect(east.latestTask?.startedMs).toBeUndefined();+ },+ );++ it('selects a strictly newer valid task and leaves no task when none was read', () => {+ const [east] = build([failed('2026-10-03T11:00:00Z'), ok]);+ expect(east.latestTask?.id).toBe('dated-ok');+ expect(east.taskCandidates).toBeUndefined();+ expect(build([])[0].latestTask).toBeUndefined();+ expect(build([])[0].taskCandidates).toBeUndefined();+ });+});diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts b/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.tsindex 2c61ea2454..25424defe7 100644--- a/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts+++ b/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts@@ -83,6 +83,8 @@ export interface WorkloadCoverageRow {/** Unknown chronology is not an absent backup, nor an older dated backup. */ageUnknown?: Record<'backup' | 'pbs' | 'archive' | 'snapshot', boolean>;latestTask?: CoverageTask;+ /** Possible latest tasks when missing/future or tied starts prevent ordering. */+ taskCandidates?: CoverageTask[];pbsCount: number;archiveCount: number;snapshotCount: number;@@ -545,6 +547,29 @@ function taskDurationSeconds(task: BackupTask): number | undefined {return Math.round((end - start) / 1000);}+function selectLatestTask(+ tasks: readonly CoverageTask[],+): Pick<WorkloadCoverageRow, 'latestTask' | 'taskCandidates'> {+ const unknown = tasks.filter((task) => task.startedMs === undefined);+ const newestMs = tasks.reduce((latest, task) => Math.max(latest, task.startedMs ?? 0), 0);+ // An undated task might be newer than any dated task. Equal starts do not+ // order distinct observations either. Retain all possible latest tasks;+ // never choose by API input order, status, ID or an invented zero date.+ const candidates = tasks.filter(+ (task) => task.startedMs === undefined || task.startedMs === newestMs,+ );+ if (candidates.length === 1) return { latestTask: candidates[0] };+ if (candidates.length === 0) return {};+ return {+ taskCandidates: [+ ...unknown.sort((left, right) => left.id.localeCompare(right.id)),+ ...candidates+ .filter((task) => task.startedMs !== undefined)+ .sort((left, right) => left.id.localeCompare(right.id)),+ ],+ };+}+function protectionPostureRank(posture: WorkloadRecoveryPosture): number {if (posture === 'attention') return 0;if (posture === 'unprotected') return 1;@@ -719,26 +744,30 @@ export function buildProxmoxBackupRecoveryModel(});}+ const tasksByWorkload = new Map<string, CoverageTask[]>();for (const task of input.tasks) {const workload = resolveTaskWorkload(candidateIndex, pveWorkloadsByVmid, task);if (!workload) continue;const row = ensureRow(workload, true);+ const parsedStart = parseTimestampMs(task.startTime);const candidateTask: CoverageTask = {id: task.id,status: task.status,label: taskLabel(task),startedAt: task.startTime,- startedMs: parseTimestampMs(task.startTime),+ startedMs:+ getRecoveryAgeBand(parsedStart, input.nowMs) === 'unknown' ? undefined : parsedStart,durationSeconds: taskDurationSeconds(task),error: task.error,};- if (!row.latestTask || (candidateTask.startedMs ?? 0) > (row.latestTask.startedMs ?? 0)) {- row.latestTask = candidateTask;- }+ const rowTasks = tasksByWorkload.get(row.key) ?? [];+ rowTasks.push(candidateTask);+ tasksByWorkload.set(row.key, rowTasks);}for (const row of rows.values()) {Object.assign(row, selectWorkloadRecoveryArtifacts(row.artifacts, input.nowMs));+ Object.assign(row, selectLatestTask(tasksByWorkload.get(row.key) ?? []));}const coverageRows = Array.from(rows.values()).map((row) => {@@ -808,6 +837,7 @@ export function coverageRowMatchesSearch(row: WorkloadCoverageRow, term: string)getWorkloadRecoveryPostureLabel(row.posture),row.latestTask?.label,row.latestTask?.error,+ ...(row.taskCandidates ?? []).flatMap((task) => [task.label, task.error, task.id]),...row.artifacts.flatMap((artifact) => [artifact.sourceLabel,artifact.sourceTitle,