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.

Keep uncertain backup evidence inspectable in Coverage

pulse-triage[bot]91ad6d185d98
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index fa66961484..b1d883e166 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -20,6 +20,19 @@
## Purpose
+### Coverage evidence remains inspectable without a pointer
+
+The bounded Coverage preview includes undated source/state witnesses and a
+plain count of dates which cannot be ordered. Its native expansion button adds
+eight evidence entries at a time without another read. The same control keeps
+keyboard focus and reports when all entries are shown, including after polling;
+closing or switching workload resets the preview. Provider text wraps literally
+at narrow widths. `coverageEvidenceInspection.test.tsx` and
+`ProxmoxCoverageTable.test.tsx` check real and direct consumers, preview bounds,
+literal origins, scope, focus, recovery/recurrence and reset. Desktop keyboard
+and narrow touch proof must inspect the production table and actual pixels.
+This does not change shared primitives, protection policy or guest operations.
+
### Backup age and completion do not normalise malformed strings
The backup badge, shield disclosure and guest drawer share Backups inventory's
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 3da26f8451..faae1d8dc8 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -21,6 +21,26 @@
## Purpose
+### Coverage previews retain the evidence behind uncertainty
+
+The existing Coverage restore-evidence preview retains the newest observed and
+completed point of each source, plus one undated observation of each source and
+completion state. Unknown dates cannot be silently sorted out behind a burst of
+dated backups or snapshots while the row tells the operator to inspect them.
+The preview states the number of unavailable/future dates without implying a
+time order or complete listing. Explicit bounded expansion makes every retained
+entry inspectable in the same panel, including literal origin and state.
+Expansion survives ordinary polling, resets on row close/change, and adds no
+read, route, restore/guest operation, identity or protection decision.
+
+Normal-suite `coverageEvidencePreview.test.ts` checks uncertain witnesses,
+deterministic bounded selection and valid newest/completed controls.
+`coverageEvidenceInspection.test.tsx` exercises parsed inventories through the
+real Coverage consumer, repeated expansion, namesake isolation, literal text,
+polling recovery/recurrence and closing/reopening. Desktop/narrow browser proof
+must inspect actual pixels and keyboard/touch expansion. This makes uncertain
+evidence usable, not original stale-date causality or native guest recovery.
+
### Backup completion strings share one strict instant rule
Backups inventory and Workloads use the same calendar-checked, explicitly zoned
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index aa71163dfd..c2f15c1450 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -23,6 +23,19 @@ and sort the complete canonical change table while startup and ingestion wait.
## Purpose
+### Coverage evidence expansion preserves workload ownership
+
+An uncertain backup date remains inspectable beside the newest dated evidence
+in the same workload's bounded Coverage preview. Explicit expansion reveals
+retained entries without another read, changing ownership, or replacing the
+server's protection rating. Unmatched and namesake guests must not borrow those
+entries. Expansion and focus survive polling; closing or changing the workload
+resets the preview. `coverageEvidenceInspection.test.tsx` and
+`ProxmoxCoverageTable.test.tsx` check scoped inventory/model/consumer behaviour,
+literal origins, bounded expansion, reset and live recovery/recurrence. Actual
+desktop/narrow browser consumers must be inspected. No canonical resource ID,
+association, owner link, API, storage or guest operation changes.
+
### Latest backup task evidence stays separate from recovery
Coverage’s existing expanded detail shows the scoped latest PVE task’s reported
diff --git a/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
index 8eb7112c31..9e9ab39b9b 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
@@ -1,4 +1,13 @@
-import { For, Show, createMemo, type Accessor, type JSX } from 'solid-js';
+import {
+ For,
+ Show,
+ createEffect,
+ createMemo,
+ createSignal,
+ on,
+ type Accessor,
+ type JSX,
+} from 'solid-js';
import {
InlineDetailPanel,
@@ -56,6 +65,7 @@ import {
getCoverageLayoutForContainer,
isCoverageEvidenceColumnVisible,
selectCoverageRestoreEvidence,
+ COVERAGE_RESTORE_EVIDENCE_PAGE_SIZE,
type CoverageColumnId,
} from './proxmoxBackupsTablePresentation';
import { PlatformWindowedRows } from '@/features/platformPage/PlatformWindowedRows';
@@ -323,6 +333,15 @@ export function ProxmoxCoverageTable(props: {
historyReadIncomplete?: boolean;
layoutWidth?: Accessor<number | null | undefined>;
}) {
+ const [evidenceLimit, setEvidenceLimit] = createSignal(COVERAGE_RESTORE_EVIDENCE_PAGE_SIZE);
+ // There is one open workload. Keep its deliberate preview expansion across
+ // polling, but start bounded again when a different row is opened or closed.
+ createEffect(
+ on(
+ () => props.expandedKey,
+ () => setEvidenceLimit(COVERAGE_RESTORE_EVIDENCE_PAGE_SIZE),
+ ),
+ );
const observedWidth = useObservedElementWidth();
const layoutMode = createMemo(() => {
const width = props.layoutWidth?.() ?? observedWidth.width();
@@ -447,7 +466,11 @@ export function ProxmoxCoverageTable(props: {
>
{(row) => {
const isExpanded = () => props.expandedKey === row.key;
- const evidence = () => selectCoverageRestoreEvidence(row.artifacts);
+ const evidence = createMemo(() =>
+ selectCoverageRestoreEvidence(row.artifacts, evidenceLimit()),
+ );
+ const undatedCount = () =>
+ row.artifacts.filter((artifact) => artifact.createdMs === undefined).length;
const backupHistoryComplete = () =>
!props.historyReadIncomplete && hasCompleteBackupHistory(row);
const detailRowId = () => `proxmox-coverage-evidence-${row.key}`;
@@ -711,6 +734,19 @@ export function ProxmoxCoverageTable(props: {
</span>
</Show>
</div>
+ <Show when={undatedCount() > 0}>
+ <p class="px-2 py-2 text-[11px] leading-snug text-amber-700 dark:text-amber-300 whitespace-normal wrap-anywhere">
+ {undatedCount()}{' '}
+ {undatedCount() === 1 ? 'entry has' : 'entries have'} an
+ unavailable or future date. These entries cannot be placed in
+ time.
+ <Show when={row.artifacts.length > evidence().length}>
+ {' '}
+ The preview includes a sample from each affected source and
+ state.
+ </Show>
+ </p>
+ </Show>
<PlatformDetailTable class="table-fixed text-[11px]">
<PlatformDetailTableHeader>
<TableHead class={getPlatformTableHeadClassForKind('name')}>
@@ -850,6 +886,37 @@ export function ProxmoxCoverageTable(props: {
</For>
</PlatformDetailTableBody>
</PlatformDetailTable>
+ <Show
+ when={row.artifacts.length > COVERAGE_RESTORE_EVIDENCE_PAGE_SIZE}
+ >
+ <div class="border-t border-border px-2 py-2">
+ <button
+ type="button"
+ class="rounded-sm px-2 py-1 text-xs font-medium text-accent hover:bg-surface-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent"
+ aria-disabled={evidence().length >= row.artifacts.length}
+ onClick={() => {
+ if (evidence().length < row.artifacts.length)
+ setEvidenceLimit(
+ evidence().length + COVERAGE_RESTORE_EVIDENCE_PAGE_SIZE,
+ );
+ }}
+ >
+ <Show
+ when={evidence().length < row.artifacts.length}
+ fallback={
+ <>All {evidence().length} evidence entries shown</>
+ }
+ >
+ Show{' '}
+ {Math.min(
+ COVERAGE_RESTORE_EVIDENCE_PAGE_SIZE,
+ row.artifacts.length - evidence().length,
+ )}{' '}
+ more evidence entries
+ </Show>
+ </button>
+ </div>
+ </Show>
</div>
</Show>
</InlineDetailPanel>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx
index e6bd01a084..e458873e0d 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx
@@ -70,6 +70,53 @@ const headerTexts = () =>
afterEach(cleanup);
describe('ProxmoxCoverageTable column visibility', () => {
+ it('keeps uncertain archive evidence inspectable without changing server posture or its owner', () => {
+ const model = buildProxmoxBackupRecoveryModel({
+ workloads: [identityGuest('east-100', 'east', 'pve-1')],
+ pbsBackups: [],
+ snapshots: [],
+ tasks: [],
+ nowMs: BACKUP_IDENTITY_NOW,
+ archives: [
+ ...Array.from({ length: 12 }, (_, index) => identityArchive({ id: `dated-${index}` })),
+ identityArchive({ id: 'unknown', time: '2026-09-31T10:00:00Z', storage: 'undated-disk' }),
+ ],
+ });
+ const current = model.coverageRows[0];
+ renderInRouter(() => (
+ <ProxmoxCoverageTable
+ rows={[current]}
+ hasAnyRows
+ emptyIcon={<span />}
+ emptyTitle=""
+ emptyDescription=""
+ sortKey={() => 'posture'}
+ sortDirection={() => 'asc'}
+ onSort={() => {}}
+ expandedKey={current.key}
+ onToggleExpand={() => {}}
+ showTaskColumn={false}
+ layoutWidth={() => 390}
+ />
+ ));
+ const panel = screen.getByTestId('proxmox-coverage-detail');
+ const evidence = () =>
+ within(within(panel).getByText('Restore evidence').closest('div')!.parentElement!).getByRole(
+ 'table',
+ );
+ expect(evidence().querySelectorAll('tbody > tr')).toHaveLength(8);
+ expect(evidence()).toHaveTextContent('undated-disk');
+ expect(panel).toHaveTextContent('1 entry has an unavailable or future date');
+ expect(current.workload.resourceId).toBe('east-100');
+ expect(current.posture).toBe('unknown');
+ fireEvent.click(within(panel).getByRole('button', { name: 'Show 5 more evidence entries' }));
+ expect(evidence().querySelectorAll('tbody > tr')).toHaveLength(13);
+ expect(
+ within(panel).getByRole('button', { name: 'All 13 evidence entries shown' }),
+ ).toHaveAttribute('aria-disabled', 'true');
+ expect(model.coverageRows[0]).toBe(current);
+ });
+
it('keeps full-width identity columns alongside the workload connection', () => {
renderInRouter(() => (
<ProxmoxCoverageTable
diff --git a/frontend-modern/src/features/proxmox/__tests__/coverageEvidenceInspection.test.tsx b/frontend-modern/src/features/proxmox/__tests__/coverageEvidenceInspection.test.tsx
new file mode 100644
index 0000000000..b2c74a495e
--- /dev/null
+++ b/frontend-modern/src/features/proxmox/__tests__/coverageEvidenceInspection.test.tsx
@@ -0,0 +1,189 @@
+import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
+import { Route, Router } from '@solidjs/router';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';
+import { protectionPolicy } from '@/utils/__fixtures__/protectionPosture';
+import { ProxmoxBackupsTable } from '../ProxmoxBackupsTable';
+import {
+ BACKUP_IDENTITY_NOW,
+ identityArchive,
+ identityGuest,
+ identityPBS,
+ identitySnapshot,
+} from '../__fixtures__/backupIdentity';
+
+const api = vi.hoisted(() => ({ fetch: vi.fn(), json: vi.fn(), width: 390 }));
+vi.mock('@/utils/apiClient', () => ({ apiFetch: api.fetch, apiFetchJSON: api.json }));
+vi.mock('@/hooks/useObservedElementWidth', () => ({
+ useObservedElementWidth: () => ({ setElement: () => {}, width: () => api.width }),
+}));
+const east = identityGuest('east-100', 'east', 'pve-1');
+const west = identityGuest('west-100', 'west', 'pve-1');
+const literal = 'undated-a <img src=x onerror=alert(1)>';
+let repaired: boolean;
+const time = (index: number) => new Date(BACKUP_IDENTITY_NOW - (index + 1) * 60_000).toISOString();
+const unknownTime = (index: number) =>
+ repaired ? time(index) : index === 0 ? '2026-09-31T10:00:00Z' : '2026-10-04T10:00:00';
+function inventories() {
+ return {
+ backups: [
+ ...Array.from({ length: 12 }, (_, index) =>
+ identityPBS({ id: `pbs-${index}`, namespace: 'east', backupTime: time(index) }),
+ ),
+ ...[0, 1].map((index) =>
+ identityPBS({
+ id: `pbs-unknown-${index}`,
+ namespace: 'east',
+ backupTime: unknownTime(index),
+ datastore: index === 0 ? literal : 'undated-b',
+ }),
+ ),
+ ...(['running', 'failed'] as const).map((state, index) =>
+ identityPBS({
+ id: `pbs-${state}`,
+ namespace: 'east',
+ backupTime: unknownTime(index),
+ datastore: state,
+ inProgress: true,
+ writeActivityObserved: true,
+ writeActive: state === 'running',
+ }),
+ ),
+ ],
+ storageBackups: [
+ ...Array.from({ length: 12 }, (_, index) =>
+ identityArchive({ id: `archive-${index}`, time: time(index) }),
+ ),
+ ...[0, 1].map((index) =>
+ identityArchive({
+ id: `archive-unknown-${index}`,
+ time: unknownTime(index),
+ storage: `archive-undated-${index}`,
+ }),
+ ),
+ ],
+ guestSnapshots: [
+ ...Array.from({ length: 12 }, (_, index) =>
+ identitySnapshot({ id: `snapshot-${index}`, time: time(index) }),
+ ),
+ ...[0, 1].map((index) =>
+ identitySnapshot({ id: `snapshot-unknown-${index}`, time: unknownTime(index) }),
+ ),
+ ],
+ backupTasks: [],
+ };
+}
+function mount() {
+ api.fetch.mockImplementation((url: string) => {
+ const points = inventories();
+ return Promise.resolve(
+ new Response(
+ JSON.stringify({ data: url === '/api/backups/pbs' ? { backups: points.backups } : points }),
+ {
+ headers: { 'Content-Type': 'application/json' },
+ },
+ ),
+ );
+ });
+ api.json.mockResolvedValue({ data: [], policy: protectionPolicy });
+ render(() => (
+ <Router>
+ <Route
+ path="/*"
+ component={() => <ProxmoxBackupsTable emptyIcon={<span />} workloads={[east, west]} />}
+ />
+ </Router>
+ ));
+}
+const evidenceTable = (panel: HTMLElement) =>
+ within(
+ within(panel).getByText('Restore evidence', { exact: true }).closest('div')!.parentElement!,
+ ).getByRole('table');
+const entries = (panel: HTMLElement) => evidenceTable(panel).querySelectorAll('tbody > tr');
+async function open(name = 'east-100') {
+ fireEvent.click(
+ await screen.findByRole('button', { name: new RegExp(`Expand details for ${name}`) }),
+ );
+ return screen.findByTestId('proxmox-coverage-detail');
+}
+beforeEach(() => {
+ vi.resetAllMocks();
+ vi.useFakeTimers({ now: BACKUP_IDENTITY_NOW, toFake: ['Date', 'setInterval', 'clearInterval'] });
+ resetCreateNonSuspendingQueryCacheForTest();
+ api.width = 390;
+ repaired = false;
+ window.history.replaceState({}, '', '/proxmox/backups/coverage');
+});
+afterEach(() => {
+ cleanup();
+ resetCreateNonSuspendingQueryCacheForTest();
+ vi.useRealTimers();
+});
+
+describe('Coverage uncertain evidence inspection through parsed inventory', () => {
+ it.each([1200, 390, 320])(
+ 'keeps uncertainty inspectable and progressively exposes every entry at %ipx',
+ async (width) => {
+ api.width = width;
+ mount();
+ const panel = await open();
+ expect(panel).toHaveTextContent('8 entries have an unavailable or future date');
+ expect(panel).toHaveTextContent('sample from each affected source and state');
+ expect(entries(panel)).toHaveLength(8);
+ const evidence = evidenceTable(panel);
+ expect(within(evidence).getAllByText('Unknown', { exact: true })).toHaveLength(5);
+ expect(evidence).toHaveTextContent('Running');
+ expect(evidence).toHaveTextContent('Incomplete');
+ expect(evidence).toHaveTextContent(literal);
+ expect(evidence.querySelector('img')).toBeNull();
+ expect(evidence).toHaveTextContent('archive-undated-0');
+ expect(evidence).not.toHaveTextContent('undated-b');
+ const more = within(panel).getByRole('button', { name: 'Show 8 more evidence entries' });
+ more.focus();
+ for (const count of [16, 24, 32, 40, 44]) {
+ fireEvent.click(more);
+ expect(entries(panel)).toHaveLength(count);
+ expect(document.activeElement).toBe(more);
+ }
+ expect(more).toHaveTextContent('All 44 evidence entries shown');
+ expect(more).toHaveAttribute('aria-disabled', 'true');
+ expect(panel).not.toHaveTextContent('sample from each affected source and state');
+ expect(evidenceTable(panel)).toHaveTextContent('undated-b');
+ expect(within(evidenceTable(panel)).getAllByText('Unknown', { exact: true })).toHaveLength(8);
+ fireEvent.click(more);
+ expect(entries(panel)).toHaveLength(44);
+ expect(api.fetch).toHaveBeenCalledTimes(2);
+ fireEvent.click(screen.getByRole('button', { name: /Collapse details for east-100/ }));
+ const peer = await open('west-100');
+ expect(peer).not.toHaveTextContent('Restore evidence');
+ expect(peer).not.toHaveTextContent(literal);
+ fireEvent.click(screen.getByRole('button', { name: /Expand details for east-100/ }));
+ expect(entries(await screen.findByTestId('proxmox-coverage-detail'))).toHaveLength(8);
+ },
+ );
+
+ it('preserves expanded evidence and focus while polling removes and restores uncertainty', async () => {
+ mount();
+ const panel = await open();
+ const more = within(panel).getByRole('button', { name: 'Show 8 more evidence entries' });
+ more.focus();
+ fireEvent.click(more);
+ expect(entries(panel)).toHaveLength(16);
+ repaired = true;
+ await vi.advanceTimersByTimeAsync(30_000);
+ await waitFor(() => expect(panel).not.toHaveTextContent('unavailable or future date'));
+ expect(entries(panel)).toHaveLength(16);
+ expect(within(evidenceTable(panel)).queryByText('Unknown', { exact: true })).toBeNull();
+ expect(document.activeElement).toBe(more);
+ expect(screen.getByTestId('proxmox-coverage-detail')).toBe(panel);
+ repaired = false;
+ await vi.advanceTimersByTimeAsync(30_000);
+ await waitFor(() =>
+ expect(panel).toHaveTextContent('8 entries have an unavailable or future date'),
+ );
+ expect(entries(panel)).toHaveLength(16);
+ expect(evidenceTable(panel)).toHaveTextContent(literal);
+ expect(document.activeElement).toBe(more);
+ expect(api.fetch).toHaveBeenCalledTimes(6);
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/__tests__/coverageEvidencePreview.test.ts b/frontend-modern/src/features/proxmox/__tests__/coverageEvidencePreview.test.ts
new file mode 100644
index 0000000000..ec220384c9
--- /dev/null
+++ b/frontend-modern/src/features/proxmox/__tests__/coverageEvidencePreview.test.ts
@@ -0,0 +1,92 @@
+import { describe, expect, it } from 'vitest';
+import { selectCoverageRestoreEvidence } from '../proxmoxBackupsTablePresentation';
+
+interface Entry {
+ id: string;
+ sourceKind: string;
+ createdMs?: number;
+ running?: boolean;
+ failed?: boolean;
+}
+const kinds = ['pbs', 'archive', 'snapshot'] as const;
+const dated = (sourceKind: string, length = 12): Entry[] =>
+ Array.from({ length }, (_, index) => ({
+ id: `${sourceKind}-dated-${index}`,
+ sourceKind,
+ createdMs: 1_000 + index,
+ }));
+const ids = (entries: readonly Entry[]) => entries.map((entry) => entry.id);
+
+describe('Coverage uncertain evidence preview', () => {
+ it.each(kinds)(
+ 'retains an undated completed %s point beside newer dated observations',
+ (kind) => {
+ const unknown: Entry = { id: `${kind}-undated`, sourceKind: kind };
+ const input = [
+ ...dated(kind),
+ ...dated(kind === 'snapshot' ? 'archive' : 'snapshot', 15),
+ unknown,
+ ];
+ const result = selectCoverageRestoreEvidence(input);
+ expect(ids(result)).toContain(unknown.id);
+ expect(result).toHaveLength(8);
+ expect(ids(result)).toContain(`${kind}-dated-11`);
+ },
+ );
+
+ it.each(['running', 'failed'] as const)(
+ 'retains an undated %s point without hiding completion',
+ (state) => {
+ const unknown: Entry = { id: `pbs-${state}`, sourceKind: 'pbs', [state]: true };
+ const input = [...dated('pbs'), ...dated('snapshot', 15), unknown];
+ const result = selectCoverageRestoreEvidence(input);
+ expect(ids(result)).toContain(unknown.id);
+ expect(ids(result)).toContain('pbs-dated-11');
+ expect(result.find((entry) => entry.id === unknown.id)?.[state]).toBe(true);
+ expect(result).toHaveLength(8);
+ },
+ );
+
+ it('keeps a witness for every uncertain source and state even beyond the normal preview cap', () => {
+ const input: Entry[] = kinds.flatMap((kind) => [
+ ...dated(kind),
+ { id: `${kind}-completed`, sourceKind: kind },
+ { id: `${kind}-running`, sourceKind: kind, running: true },
+ { id: `${kind}-failed`, sourceKind: kind, failed: true },
+ ]);
+ const result = selectCoverageRestoreEvidence(input);
+ expect(result).toHaveLength(12);
+ for (const kind of kinds) {
+ for (const suffix of ['completed', 'running', 'failed', 'dated-11'])
+ expect(ids(result)).toContain(`${kind}-${suffix}`);
+ }
+ });
+
+ it('chooses the same bounded witnesses when an unordered inventory is reversed', () => {
+ const input: Entry[] = [
+ ...dated('pbs'),
+ ...Array.from({ length: 10_000 }, (_, index) => ({
+ id: `unknown-${String(index).padStart(5, '0')}`,
+ sourceKind: 'pbs',
+ })),
+ ];
+ const result = selectCoverageRestoreEvidence(input);
+ expect(result).toHaveLength(8);
+ expect(ids(result)).toContain('unknown-00000');
+ expect(ids(selectCoverageRestoreEvidence([...input].reverse()))).toEqual(ids(result));
+ expect(input[0].id).toBe('pbs-dated-0');
+ });
+
+ it('preserves the newest dated and completed controls and only expands at the caller limit', () => {
+ const input: Entry[] = [
+ ...dated('pbs', 20),
+ { id: 'newest-running', sourceKind: 'pbs', createdMs: 2_000, running: true },
+ ];
+ const preview = selectCoverageRestoreEvidence(input);
+ expect(preview).toHaveLength(8);
+ expect(ids(preview).slice(0, 2)).toEqual(['newest-running', 'pbs-dated-19']);
+ expect(selectCoverageRestoreEvidence(input, 16)).toHaveLength(16);
+ expect(selectCoverageRestoreEvidence(input, 24)).toHaveLength(21);
+ expect(selectCoverageRestoreEvidence([])).toEqual([]);
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts b/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
index b94b2a2802..9c6cf2c440 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
@@ -377,13 +377,15 @@ const formatPostureWindow = (seconds: number): string => {
return hours === 1 ? '1 hour' : `${hours} hours`;
};
-const COVERAGE_RESTORE_EVIDENCE_LIMIT = 8;
+export const COVERAGE_RESTORE_EVIDENCE_PAGE_SIZE = 8;
// Newest restore points for a coverage row's expansion. The newest point and
// the newest completed point of every source always make the cut, so neither a
// burst of recent guest snapshots nor a running or failed job can hide the
// latest usable PBS or PVE backup now that the table carries no per-source
-// age columns.
+// age columns. Undated entries cannot be ordered behind those points: retain
+// one witness of each source/completion state so the reason for an Unknown
+// age (or an incomplete observation) is inspectable in the initial preview.
export const selectCoverageRestoreEvidence = <
T extends {
id: string;
@@ -394,14 +396,16 @@ export const selectCoverageRestoreEvidence = <
},
>(
artifacts: readonly T[],
- limit = COVERAGE_RESTORE_EVIDENCE_LIMIT,
+ limit = COVERAGE_RESTORE_EVIDENCE_PAGE_SIZE,
): T[] => {
const newestFirst = [...artifacts].sort(
- (left, right) => (right.createdMs ?? 0) - (left.createdMs ?? 0),
+ (left, right) =>
+ (right.createdMs ?? 0) - (left.createdMs ?? 0) || left.id.localeCompare(right.id),
);
const picked = new Set<string>();
const newestSeen = new Set<string>();
const completedSeen = new Set<string>();
+ const undatedSeen = new Set<string>();
for (const artifact of newestFirst) {
if (!newestSeen.has(artifact.sourceKind)) {
newestSeen.add(artifact.sourceKind);
@@ -411,6 +415,14 @@ export const selectCoverageRestoreEvidence = <
completedSeen.add(artifact.sourceKind);
picked.add(artifact.id);
}
+ if (artifact.createdMs === undefined) {
+ const state = artifact.running ? 'running' : artifact.failed ? 'failed' : 'completed';
+ const key = `${artifact.sourceKind}:${state}`;
+ if (!undatedSeen.has(key)) {
+ undatedSeen.add(key);
+ picked.add(artifact.id);
+ }
+ }
}
const cap = Math.max(limit, picked.size);
for (const artifact of newestFirst) {