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.

Lead the Backups page with a verdict and grouped exceptions

rcourtman36badcbfb095
diff --git a/docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md b/docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md
index a8584c9df2..906ab98489 100644
--- a/docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md
+++ b/docs/release-control/v6/internal/OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md
@@ -328,6 +328,12 @@ ProtectionPosture
providerStates[]
repositoryResourceIds[]
evidenceIds[]
+ reason recent-verified | recent | source-failed |
+ backup-future-dated | stale |
+ verification-future-dated | verification-overdue |
+ history-partial | history-unreadable | no-history |
+ snapshots-only | no-backup (omitted when stored
+ before reasons existed)
explanation
evaluatedAt
```
@@ -364,6 +370,9 @@ Derivation rules:
evidence, but it must not silently become subject-level protection
8. the posture explanation names the strongest evidence and the limiting
uncertainty in plain language
+9. `reason` names the derivation branch that set `state`, so a surface can
+ group subjects by cause without parsing the explanation; each reason
+ belongs to exactly one state
The existing recovery-point and protection-rollup models must be migrated or
adapted into this contract without breaking supported clients.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index f0c63d7a7c..21aea8d155 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -7307,7 +7307,7 @@ title on narrow screens. A wrapped context must not retain an auto margin that
creates an apparent empty column.
That surface also keeps asynchronous posture presentation explicit: an
unresolved canonical posture request uses a neutral `Checking` row state and
-coverage segment, while host and orphan recovery rows without a canonical
+verdict note, while host and orphan recovery rows without a canonical
workload identity use neutral `Not evaluated`. Neither presentation state may
reuse the server-owned `Unknown` label, enter the posture filter contract, or
be styled as a protection success or failure.
@@ -9376,14 +9376,15 @@ ZFS dataset table rows inside `StoragePoolDetail` inherit their separator from
the shared `STORAGE_DETAIL_ROW_CLASS` presentation constant. The component
must not reintroduce a raw border-token class for dataset rows.
-### Coverage strip segments can be filter toggles
+### Coverage strip exception groups are filter toggles
-`ProxmoxBackupsCoverageStrip` segments may carry `onSelect` and `pressed`.
-Such a segment renders as a bordered toggle button with `aria-pressed`, 28px
-tall below `sm` and 24px from `sm`, with the segment's count and label as
-its accessible name (the colour dot is decorative); segments without
-`onSelect` stay plain legend text. The strip owns no filter state; its
-caller decides which segments map to a filter.
+`ProxmoxBackupsCoverageStrip` renders a `BackupVerdict`: one headline with a
+tone dot, then one line per exception group. With `onSelectGroup`, a group
+renders as a button with `aria-pressed`, 28px tall below `sm` and 24px from
+`sm`, whose accessible name is its count and reason ("163 no successful backup");
+the colour dot is decorative and the preview names, shown from `sm`, are
+visual context only. Without `onSelectGroup` a group stays plain text. The
+strip owns no filter state; its caller maps a group key to a filter.
### The settings nav gates Infrastructure, and the blocked-route fallback is capability-aware
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 1597872b98..3212d54636 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -4995,25 +4995,32 @@ presentation and sort change only; it adds no backup, restore, or retention
authority. Pinned by `proxmoxBackupRecoveryModel.test.ts` and
`ProxmoxCoverageTable.test.tsx`.
-### Backup health counts filter Coverage to their workloads
-
-The Backups health strip's protected, attention, unprotected and unknown
-counts are toggles for the Coverage posture filter (`?posture=`), the same
-URL state the inline posture pills and the phone Filters sheet set. In
-Coverage a count toggles that filter; from By date it opens Coverage already
-filtered, through the same view path the tabs use, so date-only facets drop
-and scope facets stay. On the bare Backups route, where Coverage was chosen
-only because something needs attention, a count also navigates to the
-Coverage route so the view cannot fall back to By date when the counts
-change. The legend keeps each item's node across updates, so a focused count
-that stays a button keeps focus when it toggles. A zero count stays text
-unless it is the active filter, and checking and not-evaluated have no
-filter, so they stay text. On a 375px phone the coverage list starts below
-the fold and the posture filter sits behind Filters, so "which 11 are
-unprotected?" took three taps through a sheet; it is now one tap on the
-count. The posture rule, the posture sort (attention before unprotected)
-and the servers table are unchanged, and no posture, freshness or protection
-evaluation changes.
+### Backup health states a verdict and groups exceptions by reason (1 November 2026)
+
+The Backups health strip opens with one sentence, "47 of 49 protected" (or
+"All 49 protected"), then one line per cause for everything that is not:
+"No successful backup 2", "Not verified recently 723". The cause is the
+protection posture's server-owned `reason`, set in `DeriveProtectionPostureAt`
+beside the explanation it summarizes, so the page groups workloads without
+parsing sentences or re-deriving the posture rules. Each reason belongs to
+exactly one state; a posture stored before reasons existed, or a reason the
+browser does not know, groups under its state ("Needs attention", "Not
+protected", "Status unknown") rather than being dropped. The rating counts
+active backup targets only: orphaned records, workloads still `checking` and
+`not-evaluated` host and orphan rows stay out of both numbers, and the last two
+are named beside the sentence.
+
+A group line toggles Coverage to exactly its workloads through the `?reason=`
+URL state. From By date it opens Coverage already filtered, through the same
+view path the tabs use; on the bare Backups route it also pins the Coverage
+route, so the view cannot fall back to By date when the exceptions clear.
+Choosing a posture pill drops `?reason=`, and By date drops both, so the two
+filters never combine into an empty list. The posture bar and the
+per-posture count toggles are gone; the inline posture pills and the phone
+Filters sheet still filter by posture. On the production install the strip
+read "0 protected, 38 attention", which left the operator counting rows to
+find the cause; on the 932-guest mock it now reads as five lines. No posture,
+freshness or protection evaluation changes.
### Backups page states its answer before its caveats (1 November 2026)
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 8fb56d73b2..d4b281c640 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -3323,10 +3323,12 @@ projection; they must not cause provider nodes or availability endpoints to
enter the Machines membership bucket.
`PROXMOX_BACKUPS_QUERY_PARAMS` in the same shared route-helper module is
storage/recovery-owned filter and workspace state for the Proxmox Backups
-surface. Its query, view, node, type, source, posture, and day keys may
-narrow already-correlated backup rows, but they do not add unified-resource
-membership, change canonical workload identity, or turn recovery evidence
-into a provider-resource projection.
+surface. Its query, view, node, type, source, posture, reason, and day keys
+may narrow already-correlated backup rows, but they do not add
+unified-resource membership, change canonical workload identity, or turn
+recovery evidence into a provider-resource projection. `reason` names one
+exception group from the Backup health verdict: a server posture reason, or
+the bare posture state for an assessment that carries none.
The Proxmox backup workspace's chronological and coverage views are
canonical route state under `/proxmox/backups/date` and
`/proxmox/backups/coverage`. The shared route helper owns those path
diff --git a/frontend-modern/browser-verification/5d2a131d66ee73d1.json b/frontend-modern/browser-verification/5d2a131d66ee73d1.json
new file mode 100644
index 0000000000..69a4fdd339
--- /dev/null
+++ b/frontend-modern/browser-verification/5d2a131d66ee73d1.json
@@ -0,0 +1,49 @@
+{
+ "version": 1,
+ "base_sha": "c86ca8d308f1216a63cea049a0120caa6058f346",
+ "verified_at": "2026-11-01T20:40:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/proxmox/ProxmoxBackupsCoverageStrip.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx",
+ "frontend-modern/src/features/proxmox/proxmoxBackupVerdict.ts",
+ "frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts",
+ "frontend-modern/src/routing/resourceLinks.ts",
+ "frontend-modern/src/types/recovery.ts",
+ "frontend-modern/src/utils/protectionPostureResponse.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/proxmox/ProxmoxBackupsCoverageStrip.tsx": "da66e90865ea22028525e4bd0f6b8bc749f72bfb38c5e6f6070fffa6f1f9b236",
+ "frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx": "a4ae2f7a230c296ab6409205a7f1d74b3454902c1b0ccbda60bd26a6601ed724",
+ "frontend-modern/src/features/proxmox/proxmoxBackupVerdict.ts": "572bcd528cdd97a2ccfa057709e1ee7cf6b5b0945b7cc7bc8b8eed4c383951a2",
+ "frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts": "281b5e06d55dae874dc0386f7b101890aaedc6d0bad15b59595a3b3ff95f5af1",
+ "frontend-modern/src/routing/resourceLinks.ts": "49aa58a9b56efa0a9b99cd139039d05c1e7177aa9651046e2243de472f5e97b5",
+ "frontend-modern/src/types/recovery.ts": "dc63a51abf99082fe7bb6f7ca2c21a10fd30ba0a847c1f74edc0faf522b61286",
+ "frontend-modern/src/utils/protectionPostureResponse.ts": "49a5fe04a110ff26f05d79aa5e0bb5fe711e721f82c15438b9d8727011992930"
+ },
+ "routes": [
+ "/proxmox/backups/date",
+ "/proxmox/backups/coverage?reason=no-backup"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 1000
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "mock rig with 932 Proxmox backup targets: 0 protected, 3 not evaluated, the rest split across five posture reasons",
+ "posture reasons added to the rig's /api/recovery/postures responses from each explanation, as the new evaluator sets them",
+ "dark theme, desktop and phone layouts"
+ ],
+ "interactions": [
+ "signed in and opened Backups By date at 1440x1000 and 375x812",
+ "read the verdict (0 of 929 protected, 3 not evaluated) and the five exception lines with counts and, on desktop, preview names",
+ "clicked the No successful backup line: Coverage opened with ?reason=no-backup, the line pressed, 86 of 932 targets listed",
+ "measured exception lines (24px desktop, 28px phone, none clipped) and confirmed no horizontal page overflow"
+ ]
+}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsCoverageStrip.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsCoverageStrip.tsx
index 90dafd6ace..e76015919f 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsCoverageStrip.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsCoverageStrip.tsx
@@ -1,49 +1,58 @@
-import { For, Index, Show, type Component, type JSX } from 'solid-js';
+import { For, Show, type Component, type JSX } from 'solid-js';
import ChevronRightIcon from 'lucide-solid/icons/chevron-right';
+import type {
+ BackupExceptionGroup,
+ BackupVerdict,
+ BackupVerdictTone,
+} from './proxmoxBackupVerdict';
-// A single horizontal bar broken into proportional segments, followed by
-// a one-line legend of labels + counts. Visually integrated with the page
-// chrome (no tile border per metric) so it reads as a status line, not a
-// stat-card grid. Used at the top of Snapshots and Backup files to answer
-// the "is my backup posture healthy?" question on sight.
-
-export interface CoverageStripSegment {
- key: string;
- // Value used to compute the segment's proportional width.
- value: number;
- label: string;
- // Tailwind class applied to the segment bar (e.g. `bg-emerald-500`).
- toneClass: string;
- // Optional formatted display value; defaults to the raw `value`.
- display?: string;
- // When true the segment is rendered with a neutral tone for "absent".
- muted?: boolean;
- // A segment that names a list filter is a toggle: selecting "11
- // unprotected" shows those workloads instead of leaving the count as text.
- onSelect?: () => void;
- pressed?: boolean;
-}
+// The Backup health strip answers "is everything backed up?" in one sentence,
+// then names what is not: one line per posture reason with its count, so the
+// answer never depends on counting rows. Each line toggles a Coverage filter
+// to exactly those workloads; the strip owns no filter state itself.
export interface CoverageStripProps {
title: string;
- segments: readonly CoverageStripSegment[];
+ verdict: BackupVerdict;
// Compact context shown to the right of the title (e.g. "1.2 TB on disk").
tail?: JSX.Element;
- // The rule behind the segments, so a count such as "17 attention" can say
- // what it is counting. Collapsed by default: the counts are the answer, and
- // each workload's own drawer explains its state.
+ // The rule behind the verdict. Collapsed by default: the sentence is the
+ // answer, and each workload's own drawer explains its state.
rule?: JSX.Element;
+ isGroupPressed?: (key: string) => boolean;
+ onSelectGroup?: (key: string) => void;
}
+const TONE_DOT_CLASS: Record<BackupVerdictTone, string> = {
+ protected: 'bg-emerald-500',
+ attention: 'bg-amber-500',
+ unprotected: 'bg-red-500',
+ unknown: 'bg-slate-400',
+ checking: 'bg-blue-400',
+};
+
+const PREVIEW_NAMES = 3;
+
+const previewNames = (group: BackupExceptionGroup): string => {
+ const names = group.rows.slice(0, PREVIEW_NAMES).map((row) => row.workload.label);
+ const more = group.rows.length - names.length;
+ return more > 0 ? `${names.join(', ')} and ${more} more` : names.join(', ');
+};
+
+// The preview names are visual context; the button's name is its count and
+// reason ("163 no successful backup"), which stays stable as names change.
+const accessibleName = (group: BackupExceptionGroup): string =>
+ `${group.rows.length} ${group.label.charAt(0).toLowerCase()}${group.label.slice(1)}`;
+
export const ProxmoxBackupsCoverageStrip: Component<CoverageStripProps> = (props) => {
- const total = () =>
- props.segments.reduce(
- (sum, seg) => sum + (Number.isFinite(seg.value) ? Math.max(0, seg.value) : 0),
- 0,
- );
+ const asides = () =>
+ [
+ props.verdict.checking > 0 ? `${props.verdict.checking} checking` : null,
+ props.verdict.notEvaluated > 0 ? `${props.verdict.notEvaluated} not evaluated` : null,
+ ].filter(Boolean) as string[];
return (
- <div class="rounded-lg border border-border-subtle px-3 py-2">
+ <div class="rounded-lg border border-border-subtle px-3 py-2" data-coverage-strip>
<div class="flex flex-wrap items-baseline gap-x-3 gap-y-1">
<div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted">
{props.title}
@@ -52,71 +61,70 @@ export const ProxmoxBackupsCoverageStrip: Component<CoverageStripProps> = (props
<div class="w-full text-[11px] text-muted sm:ml-auto sm:w-auto">{props.tail}</div>
</Show>
</div>
- <Show
- when={total() > 0}
- fallback={<div class="mt-2 h-2 w-full rounded-full bg-surface" aria-hidden="true" />}
+ <p
+ class="mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-0.5"
+ data-backup-verdict={props.verdict.tone}
>
- <div class="mt-2 flex h-2 w-full overflow-hidden rounded-full bg-surface">
- <For each={props.segments}>
- {(segment) => {
- const widthPct = () =>
- total() > 0 ? Math.max(0, (segment.value / total()) * 100) : 0;
- return (
- <Show when={widthPct() > 0}>
- <div
- class={segment.toneClass}
- style={{ width: `${widthPct()}%` }}
- role="presentation"
+ <span
+ class={`h-2 w-2 shrink-0 rounded-full ${TONE_DOT_CLASS[props.verdict.tone]}`}
+ aria-hidden="true"
+ />
+ <span class="text-sm font-medium text-base-content">{props.verdict.headline}</span>
+ <Show when={asides().length > 0}>
+ <span class="text-[11px] text-muted">{asides().join(' · ')}</span>
+ </Show>
+ </p>
+ <Show when={props.verdict.exceptions.length > 0}>
+ <ul class="mt-1 space-y-0.5" aria-label="Backups that are not protected">
+ <For each={props.verdict.exceptions}>
+ {(group) => {
+ const pressed = () => props.isGroupPressed?.(group.key) ?? false;
+ const content = () => (
+ <>
+ <span
+ class={`h-2 w-2 shrink-0 rounded-xs ${TONE_DOT_CLASS[group.tone]}`}
+ aria-hidden="true"
/>
- </Show>
+ <span class="min-w-0 truncate text-base-content">{group.label}</span>
+ <span class="shrink-0 tabular-nums text-muted">{group.rows.length}</span>
+ {/* Names help on a wide screen; a phone keeps the reason and count. */}
+ <span class="hidden min-w-0 flex-1 truncate text-muted sm:block">
+ {previewNames(group)}
+ </span>
+ </>
+ );
+ return (
+ <li class="flex" data-backup-exception={group.key}>
+ <Show
+ when={props.onSelectGroup}
+ fallback={
+ <span class="flex min-h-7 w-full min-w-0 items-center gap-2 px-1.5 text-xs sm:min-h-6">
+ {content()}
+ </span>
+ }
+ >
+ {(onSelect) => (
+ <button
+ type="button"
+ class={`flex min-h-7 w-full min-w-0 items-center gap-2 rounded-md border px-1.5 text-left text-xs hover:bg-surface-hover focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-500 sm:min-h-6 ${
+ pressed()
+ ? 'border-blue-400 bg-blue-50 dark:border-blue-500 dark:bg-blue-900/30'
+ : 'border-transparent'
+ }`}
+ aria-pressed={pressed()}
+ aria-label={accessibleName(group)}
+ onClick={() => onSelect()(group.key)}
+ >
+ {content()}
+ </button>
+ )}
+ </Show>
+ </li>
);
}}
</For>
- </div>
+ </ul>
</Show>
- <ul class="mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px]">
- {/* Index keeps each legend item's node while the caller rebuilds the
- segment objects, so a focused count keeps focus after it toggles. */}
- <Index each={props.segments}>
- {(segment) => {
- const content = () => (
- <>
- <span
- class={`h-2 w-2 shrink-0 rounded-xs ${segment().toneClass}`}
- aria-hidden="true"
- />
- <span class="tabular-nums">
- {segment().display ?? String(Math.max(0, Math.round(segment().value)))}
- </span>
- <span class="text-muted">{segment().label}</span>
- </>
- );
- return (
- <li class={`inline-flex items-center ${segment().muted ? '' : 'text-base-content'}`}>
- <Show
- when={segment().onSelect}
- fallback={<span class="inline-flex items-center gap-1.5">{content()}</span>}
- >
- {(onSelect) => (
- <button
- type="button"
- class={`inline-flex min-h-7 items-center gap-1.5 rounded-md border px-1.5 hover:bg-surface-hover focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-500 sm:min-h-6 ${
- segment().pressed
- ? 'border-blue-400 bg-blue-50 dark:border-blue-500 dark:bg-blue-900/30'
- : 'border-border'
- }`}
- aria-pressed={segment().pressed ?? false}
- onClick={() => onSelect()()}
- >
- {content()}
- </button>
- )}
- </Show>
- </li>
- );
- }}
- </Index>
- </ul>
<Show when={props.rule}>
<details class="group mt-1 text-[11px] text-muted" data-coverage-strip-rule>
<summary class="inline-flex cursor-pointer list-none items-center gap-1 rounded-sm hover:text-base-content focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-500 [&::-webkit-details-marker]:hidden">
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
index ba9be5aa35..ad8d1ce6c3 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
@@ -80,6 +80,7 @@ import {
} from './proxmoxBackupsTableShared';
import { getProxmoxBackupSourcePresentation } from './proxmoxBackupSourcePresentation';
import { ProxmoxBackupsCoverageStrip } from './ProxmoxBackupsCoverageStrip';
+import { backupExceptionGroupKey, buildBackupVerdict } from './proxmoxBackupVerdict';
import {
collectUnreadBackupSources,
describeUnreadBackupSources,
@@ -238,13 +239,19 @@ export const ProxmoxBackupsTable: Component<{
? value
: 'all';
};
+ // A posture choice replaces an exception group: combined they would only
+ // narrow to an empty list.
const setCoverageFilter = (value: CoverageFilterValue): void =>
setSearchParams(
{
[PROXMOX_BACKUPS_QUERY_PARAMS.posture]: value === 'all' ? null : value,
+ [PROXMOX_BACKUPS_QUERY_PARAMS.reason]: null,
},
{ replace: true },
);
+ // An exception group selected from the Backup health verdict.
+ const exceptionFilter = (): string | null =>
+ queryValue(PROXMOX_BACKUPS_QUERY_PARAMS.reason).trim() || null;
const recoverableFilter = (): RecoverableFilterValue => {
const value = queryValue(PROXMOX_BACKUPS_QUERY_PARAMS.source);
return value === 'pbs' ||
@@ -474,10 +481,12 @@ export const ProxmoxBackupsTable: Component<{
const filteredCoverageRows = createMemo(() => {
const term = search().trim().toLowerCase();
const filter = coverageFilter();
+ const exception = exceptionFilter();
const list = coverageRowsForLocation().filter((row) => {
if (!nodeMatches(row.workload.node)) return false;
if (!typeMatches(row.workload.type)) return false;
if (filter !== 'all' && row.posture !== filter) return false;
+ if (exception && backupExceptionGroupKey(row) !== exception) return false;
return coverageRowMatchesSearch(row, term);
});
const sortKey = coverageSortKey();
@@ -515,24 +524,16 @@ export const ProxmoxBackupsTable: Component<{
() => recoveryModel().coverageRows.filter((row) => row.isOrphaned).length,
);
- // Health strip counts active backup targets only — orphaned records are all
- // stale and would otherwise inflate the "attention" segment with dead data.
- const liveHealthSummary = createMemo(() => {
- const live = recoveryModel().coverageRows.filter((row) => !row.isOrphaned);
- return {
- protected: live.filter((row) => row.posture === 'protected').length,
- attention: live.filter((row) => row.posture === 'attention').length,
- unprotected: live.filter((row) => row.posture === 'unprotected').length,
- unknown: live.filter((row) => row.posture === 'unknown').length,
- checking: live.filter((row) => row.posture === 'checking').length,
- notEvaluated: live.filter((row) => row.posture === 'not-evaluated').length,
- };
- });
+ // The verdict rates active backup targets only — orphaned records are all
+ // stale and would otherwise add dead data to the exceptions.
+ const backupVerdict = createMemo(() =>
+ buildBackupVerdict(recoveryModel().coverageRows, protectionPostures.policy()),
+ );
const view = (): BackupView =>
routeView() ??
legacyQueryView() ??
- (liveHealthSummary().attention + liveHealthSummary().unprotected + liveHealthSummary().unknown >
- 0
+ // A saved exception filter keeps Coverage even once that group is empty.
+ (exceptionFilter() !== null || backupVerdict().exceptions.length > 0
? 'coverage'
: PROXMOX_BACKUPS_DEFAULT_VIEW);
@@ -541,6 +542,7 @@ export const ProxmoxBackupsTable: Component<{
params.delete(PROXMOX_BACKUPS_QUERY_PARAMS.view);
if (next === 'date') {
params.delete(PROXMOX_BACKUPS_QUERY_PARAMS.posture);
+ params.delete(PROXMOX_BACKUPS_QUERY_PARAMS.reason);
} else {
params.delete(PROXMOX_BACKUPS_QUERY_PARAMS.source);
params.delete(PROXMOX_BACKUPS_QUERY_PARAMS.day);
@@ -548,8 +550,8 @@ export const ProxmoxBackupsTable: Component<{
const query = params.toString();
return `${buildProxmoxBackupsPath(next)}${query ? `?${query}` : ''}`;
};
- // The health strip's counts that name a posture filter toggle it. From the
- // date view a count opens Coverage already filtered to those workloads.
+ // Each exception group in the health strip toggles a Coverage filter to its
+ // workloads. From the date view a group opens Coverage already filtered.
const navigate = useNavigate();
// Old bookmarks can enter without a view segment. Pick their useful default
// only after the first assessment settles, then let the existing URL own it.
@@ -565,26 +567,27 @@ export const ProxmoxBackupsTable: Component<{
}
navigate(`${backupViewPath(view())}${location.hash}`, { replace: true, scroll: false });
});
- const postureSegmentFilter = (posture: Exclude<CoverageFilterValue, 'all'>) => {
- const pressed = view() === 'coverage' && coverageFilter() === posture;
- // A zero count would only open an empty list.
- if (!pressed && liveHealthSummary()[posture] === 0) return {};
- return {
- pressed,
- onSelect: () => {
- const next = coverageFilter() === posture && view() === 'coverage' ? 'all' : posture;
- if (routeView() === 'coverage') {
- setCoverageFilter(next);
- return;
- }
- // By date, or Coverage chosen only by the health fallback: land on the
- // Coverage route so the view cannot flip back when the counts change.
- const target = new URL(backupViewPath('coverage'), 'https://pulse.invalid');
- if (next === 'all') target.searchParams.delete(PROXMOX_BACKUPS_QUERY_PARAMS.posture);
- else target.searchParams.set(PROXMOX_BACKUPS_QUERY_PARAMS.posture, next);
- navigate(`${target.pathname}${target.search}`);
- },
- };
+ const exceptionGroupPressed = (key: string): boolean =>
+ view() === 'coverage' && exceptionFilter() === key;
+ const selectExceptionGroup = (key: string): void => {
+ const next = exceptionGroupPressed(key) ? null : key;
+ if (routeView() === 'coverage') {
+ setSearchParams(
+ {
+ [PROXMOX_BACKUPS_QUERY_PARAMS.reason]: next,
+ [PROXMOX_BACKUPS_QUERY_PARAMS.posture]: null,
+ },
+ { replace: true },
+ );
+ return;
+ }
+ // By date, or Coverage chosen only by the health fallback: land on the
+ // Coverage route so the view cannot flip back when the exceptions clear.
+ const target = new URL(backupViewPath('coverage'), 'https://pulse.invalid');
+ target.searchParams.delete(PROXMOX_BACKUPS_QUERY_PARAMS.posture);
+ if (next) target.searchParams.set(PROXMOX_BACKUPS_QUERY_PARAMS.reason, next);
+ else target.searchParams.delete(PROXMOX_BACKUPS_QUERY_PARAMS.reason);
+ navigate(`${target.pathname}${target.search}`);
};
const backupViewTabs = createMemo(() =>
BACKUP_VIEW_TABS.map((tab) => ({ ...tab, path: backupViewPath(tab.id) })),
@@ -757,6 +760,7 @@ export const ProxmoxBackupsTable: Component<{
locationFilter() ||
typeFilter() ||
coverageFilter() !== 'all' ||
+ exceptionFilter() !== null ||
recoverableFilter() !== 'all' ||
selectedDateKey(),
);
@@ -770,6 +774,7 @@ export const ProxmoxBackupsTable: Component<{
[PROXMOX_BACKUPS_QUERY_PARAMS.type]: null,
[PROXMOX_BACKUPS_QUERY_PARAMS.source]: null,
[PROXMOX_BACKUPS_QUERY_PARAMS.posture]: null,
+ [PROXMOX_BACKUPS_QUERY_PARAMS.reason]: null,
[PROXMOX_BACKUPS_QUERY_PARAMS.day]: null,
},
{ replace: true },
@@ -896,7 +901,6 @@ export const ProxmoxBackupsTable: Component<{
}
tail={
<span>
- {liveTotalCount()} targets ·{' '}
{recoveryModel().coverageSummary.recoverableArtifacts} completed restore{' '}
{recoveryModel().coverageSummary.recoverableArtifacts === 1 ? 'point' : 'points'}
{inventoryIncomplete() ? ' read' : ''}
@@ -919,53 +923,9 @@ export const ProxmoxBackupsTable: Component<{
</Show>
</span>
}
- segments={[
- {
- key: 'protected',
- value: liveHealthSummary().protected,
- ...postureSegmentFilter('protected'),
- label: 'protected',
- toneClass: 'bg-emerald-500',
- },
- {
- key: 'attention',
- value: liveHealthSummary().attention,
- ...postureSegmentFilter('attention'),
- label: 'attention',
- toneClass: 'bg-amber-500',
- muted: liveHealthSummary().attention === 0,
- },
- {
- key: 'unprotected',
- value: liveHealthSummary().unprotected,
- ...postureSegmentFilter('unprotected'),
- label: 'unprotected',
- toneClass: 'bg-red-500',
- muted: liveHealthSummary().unprotected === 0,
- },
- {
- key: 'unknown',
- value: liveHealthSummary().unknown,
- ...postureSegmentFilter('unknown'),
- label: 'unknown',
- toneClass: 'bg-slate-400',
- muted: liveHealthSummary().unknown === 0,
- },
- {
- key: 'checking',
- value: liveHealthSummary().checking,
- label: 'checking',
- toneClass: 'bg-blue-400',
- muted: liveHealthSummary().checking === 0,
- },
- {
- key: 'not-evaluated',
- value: liveHealthSummary().notEvaluated,
- label: 'not evaluated',
- toneClass: 'bg-slate-300 dark:bg-slate-600',
- muted: liveHealthSummary().notEvaluated === 0,
- },
- ]}
+ verdict={backupVerdict()}
+ isGroupPressed={exceptionGroupPressed}
+ onSelectGroup={selectExceptionGroup}
/>
<Show when={unreadBackupSourcesNotice()}>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
index 7a7dce17fc..93cdd04e12 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
@@ -153,10 +153,11 @@ function mockBackupAPIs(
providerStates: [],
repositoryResourceIds: [],
evidenceIds: ['evidence-1'],
+ reason: state === 'protected' ? 'recent-verified' : 'source-failed',
explanation:
state === 'protected'
? 'A current verified backup is available.'
- : 'The latest provider job needs attention.',
+ : 'A backup exists, but one of its backup sources has reported a failure.',
evaluatedAt: '2026-05-25T02:05:00Z',
},
],
@@ -607,7 +608,7 @@ describe('ProxmoxBackupsTable', () => {
await screen.findAllByText('pbs-docker');
- const healthSummary = screen.getByText(/targets · .*restore points/);
+ const healthSummary = screen.getByText(/^\d+ completed restore point/);
expect(healthSummary.parentElement).toHaveClass('w-full', 'sm:ml-auto', 'sm:w-auto');
expect(healthSummary.parentElement).not.toHaveClass('ml-auto');
@@ -760,9 +761,31 @@ describe('ProxmoxBackupsTable', () => {
});
});
- it('lets a backup health count filter Coverage to those workloads', async () => {
+ it('states the verdict and names each exception group by its reason', async () => {
+ mockBackupAPIs('attention');
+ window.history.replaceState({}, '', '/proxmox/backups/date');
+
+ renderInRouter(() => (
+ <ProxmoxBackupsTable emptyIcon={<span />} workloads={[workloadResource]} />
+ ));
+
+ const verdict = await waitFor(() => {
+ const element = document.querySelector('[data-backup-verdict]');
+ expect(element).toHaveTextContent('0 of 1 protected');
+ return element!;
+ });
+ expect(verdict).toHaveAttribute('data-backup-verdict', 'attention');
+ const exceptions = within(screen.getByRole('list', { name: 'Backups that are not protected' }));
+ const group = exceptions.getByRole('button', { name: '1 backup source reported a failure' });
+ expect(group).toHaveTextContent('Backup source reported a failure');
+ expect(group).toHaveTextContent('pbs-docker');
+ // The old posture bar and per-posture counts are gone: the sentence is the answer.
+ expect(screen.queryByRole('button', { name: '1 attention' })).toBeNull();
+ });
+
+ it('lets a backup exception group filter Coverage to those workloads', async () => {
// "17 attention" was text: finding which workloads it counted took the
- // Filters sheet on a phone.
+ // Filters sheet on a phone. A group is one tap to exactly its workloads.
mockBackupAPIs('attention');
window.history.replaceState({}, '', '/proxmox/backups/date');
@@ -770,42 +793,63 @@ describe('ProxmoxBackupsTable', () => {
<ProxmoxBackupsTable emptyIcon={<span />} workloads={[workloadResource]} />
));
- // Keep accessible-role queries in the health legend so unrelated table
+ // Keep accessible-role queries in the exception list so unrelated table
// rows do not add lookup work to the unchanged five-second test budget.
- const legend = within((await screen.findByText('unprotected')).closest('ul')!);
- const attention = await legend.findByRole('button', { name: '1 attention' });
- expect(attention).toHaveAttribute('aria-pressed', 'false');
- // A zero count would open an empty list, so it stays text.
- expect(legend.queryByRole('button', { name: '0 unprotected' })).toBeNull();
- expect(legend.getByText('unprotected')).toBeInTheDocument();
-
- await fireEvent.click(attention);
+ const exceptions = within(
+ await screen.findByRole('list', { name: 'Backups that are not protected' }),
+ );
+ const group = await exceptions.findByRole('button', {
+ name: '1 backup source reported a failure',
+ });
+ expect(group).toHaveAttribute('aria-pressed', 'false');
+
+ await fireEvent.click(group);
await waitFor(() => {
expect(window.location.pathname).toBe('/proxmox/backups/coverage');
- expect(new URLSearchParams(window.location.search).get('posture')).toBe('attention');
+ expect(new URLSearchParams(window.location.search).get('reason')).toBe('source-failed');
});
- expect(legend.getByRole('button', { name: '1 attention' })).toHaveAttribute(
- 'aria-pressed',
- 'true',
- );
+ expect(new URLSearchParams(window.location.search).get('posture')).toBeNull();
+ expect(
+ exceptions.getByRole('button', { name: '1 backup source reported a failure' }),
+ ).toHaveAttribute('aria-pressed', 'true');
expect(screen.getAllByText('pbs-docker').length).toBeGreaterThan(0);
// Toggling off keeps the same focused control rather than rebuilding it.
- const pressed = legend.getByRole('button', { name: '1 attention' });
- expect(pressed).toBe(attention);
+ const pressed = exceptions.getByRole('button', { name: '1 backup source reported a failure' });
+ expect(pressed).toBe(group);
pressed.focus();
await fireEvent.click(pressed);
await waitFor(() =>
- expect(new URLSearchParams(window.location.search).get('posture')).toBeNull(),
+ expect(new URLSearchParams(window.location.search).get('reason')).toBeNull(),
);
expect(window.location.pathname).toBe('/proxmox/backups/coverage');
expect(pressed).toHaveAttribute('aria-pressed', 'false');
expect(pressed).toHaveFocus();
});
- it('pins Coverage when a health count is used on the bare Backups route', async () => {
+ it('drops an exception group when a posture is chosen, so the two never narrow to nothing', async () => {
+ mockBackupAPIs('attention');
+ window.history.replaceState({}, '', '/proxmox/backups/coverage?reason=source-failed');
+
+ renderInRouter(() => (
+ <ProxmoxBackupsTable emptyIcon={<span />} workloads={[workloadResource]} />
+ ));
+
+ await screen.findByRole('button', {
+ name: '1 backup source reported a failure',
+ pressed: true,
+ });
+ await fireEvent.click(screen.getByRole('button', { name: /^protected$/i }));
+ await waitFor(() => {
+ const params = new URLSearchParams(window.location.search);
+ expect(params.get('posture')).toBe('protected');
+ expect(params.get('reason')).toBeNull();
+ });
+ });
+
+ it('pins Coverage when an exception group is used on the bare Backups route', async () => {
// Coverage was chosen only because something needs attention; without the
- // route segment the view would flip to By date once the counts reached zero.
+ // route segment the view would flip to By date once the exceptions cleared.
mockBackupAPIs('attention');
window.history.replaceState({}, '', '/proxmox/backups');
@@ -813,10 +857,12 @@ describe('ProxmoxBackupsTable', () => {
<ProxmoxBackupsTable emptyIcon={<span />} workloads={[workloadResource]} />
));
- await fireEvent.click(await screen.findByRole('button', { name: '1 attention' }));
+ await fireEvent.click(
+ await screen.findByRole('button', { name: '1 backup source reported a failure' }),
+ );
await waitFor(() => {
expect(window.location.pathname).toBe('/proxmox/backups/coverage');
- expect(new URLSearchParams(window.location.search).get('posture')).toBe('attention');
+ expect(new URLSearchParams(window.location.search).get('reason')).toBe('source-failed');
});
});
@@ -1946,7 +1992,7 @@ describe('backup-identity: connected Coverage and By date', () => {
expect(coverage).toHaveTextContent('PBS');
expect(coverage).toHaveTextContent('PVE file');
expect(coverage).toHaveTextContent('Snapshot');
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(apiFetchMock).toHaveBeenCalledTimes(2);
fireEvent.input(search, { target: { value: 'absent-native-point' } });
@@ -2204,7 +2250,7 @@ describe('Coverage withdraws failed protection assessments', () => {
await screen.findByText(/Protection posture is unavailable/);
expect(row()).toHaveTextContent('Unknown');
expect(row()).not.toHaveTextContent('Protected');
- expect(screen.getByRole('button', { name: '1 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '1 status unknown' })).toBeInTheDocument();
expect(detail).not.toHaveTextContent('A current verified backup is available.');
expect(detail).toHaveTextContent('Restore evidence');
expect(within(detail).getByText('PVE file', { exact: true })).toBeInTheDocument();
@@ -2237,7 +2283,7 @@ describe('Coverage withdraws failed protection assessments', () => {
document.querySelector('[data-proxmox-backup-row="coverage"]') as HTMLElement;
await waitFor(() => expect(row()).toHaveTextContent('Protected'));
const accepted = (await apiFetchJSONMock.mock.results[0].value) as ProtectionPosturesResponse;
- expect(screen.getByRole('button', { name: '1 protected' })).toBeInTheDocument();
+ expect(document.querySelector('[data-backup-verdict]')).toHaveTextContent('1 of 1 protected');
fireEvent.click(within(row()).getByRole('button', { name: /expand details/i }));
const detail = await screen.findByTestId('proxmox-coverage-detail');
expect(detail).toHaveTextContent('A current verified backup is available.');
@@ -2247,10 +2293,8 @@ describe('Coverage withdraws failed protection assessments', () => {
await screen.findByText(/Protection posture is unavailable/);
expect(row()).toHaveTextContent('Unknown');
expect(row()).not.toHaveTextContent('Protected');
- expect(screen.getByText('protected', { exact: true }).closest('li')).toHaveTextContent(
- /0\s*protected/,
- );
- expect(screen.getByRole('button', { name: '1 unknown' })).toBeInTheDocument();
+ expect(document.querySelector('[data-backup-verdict]')).toHaveTextContent('0 of 1 protected');
+ expect(screen.getByRole('button', { name: '1 status unknown' })).toBeInTheDocument();
expect(detail).not.toHaveTextContent('A current verified backup is available.');
expect(detail).not.toHaveTextContent('History Complete');
expect(detail).toHaveTextContent('Restore evidence');
@@ -2277,7 +2321,7 @@ describe('Coverage withdraws failed protection assessments', () => {
await waitFor(() => expect(row()).toHaveTextContent(/attention/i));
expect(detail).toHaveTextContent('The current backup verification needs attention.');
expect(screen.queryByText(/Protection posture is unavailable/)).not.toBeInTheDocument();
- expect(screen.getByRole('button', { name: '1 attention' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '1 needs attention' })).toBeInTheDocument();
expect(document.querySelector('[data-coverage-posture-rule]')).not.toBeNull();
expect(apiFetchMock.mock.calls.filter(([url]) => url === '/api/backups/pve')).toHaveLength(2);
expect(apiFetchMock.mock.calls.filter(([url]) => url === '/api/backups/pbs')).toHaveLength(2);
@@ -2854,8 +2898,8 @@ describe('location-scoped evidence keeps workload-wide protection explicit', ()
expect(note).toHaveTextContent(
'Protection assessments and task history are workload-wide, not a rating of this location.',
);
- expect(screen.getByRole('button', { name: '1 protected' })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: '1 unprotected' })).toBeInTheDocument();
+ expect(document.querySelector('[data-backup-verdict]')).toHaveTextContent('1 of 2 protected');
+ expect(screen.getByRole('button', { name: '1 not protected' })).toBeInTheDocument();
const row = document.querySelector<HTMLElement>('[data-proxmox-backup-row="coverage"]')!;
expect(document.querySelectorAll('[data-proxmox-backup-row="coverage"]')).toHaveLength(1);
expect(row).toHaveTextContent('Protected');
@@ -2884,7 +2928,7 @@ describe('location-scoped evidence keeps workload-wide protection explicit', ()
).not.toBeInTheDocument();
expect(pointTable(panel)).toHaveTextContent('current-local');
expect(pointTable(panel).querySelectorAll('tbody > tr')).toHaveLength(2);
- expect(screen.getByRole('button', { name: '1 protected' })).toBeInTheDocument();
+ expect(document.querySelector('[data-backup-verdict]')).toHaveTextContent('1 of 2 protected');
expect(apiFetchMock).toHaveBeenCalledTimes(2);
expect(apiFetchJSONMock).toHaveBeenCalledTimes(1);
},
@@ -3133,6 +3177,13 @@ describe('bare Backups entry retains its assessed workspace', () => {
data: [{ ...protectionPosture('ct-112'), state, explanation: `Observed ${state} posture.` }],
policy: protectionPolicy,
});
+ // The health strip's settled reading for one assessed workload.
+ const verdictShows = (state: 'protected' | 'attention') =>
+ state === 'protected'
+ ? expect(document.querySelector('[data-backup-verdict]')).toHaveTextContent(
+ '1 of 1 protected',
+ )
+ : expect(screen.getByRole('button', { name: '1 needs attention' })).toBeInTheDocument();
it.each([
{ initial: 'attention', next: 'protected', view: 'coverage', table: 'coverage' },
@@ -3159,9 +3210,7 @@ describe('bare Backups entry retains its assessed workspace', () => {
state = next;
await vi.advanceTimersByTimeAsync(30_000);
- await waitFor(() =>
- expect(screen.getByRole('button', { name: `1 ${next}` })).toBeInTheDocument(),
- );
+ await waitFor(() => verdictShows(next));
expect(window.location.pathname).toBe(`/proxmox/backups/${view}`);
expect(
screen.getByRole('link', { name: view === 'date' ? /by date/i : /coverage/i }),
@@ -3206,15 +3255,17 @@ describe('bare Backups entry retains its assessed workspace', () => {
await waitFor(() => expect(window.location.pathname).toBe('/proxmox/backups/coverage'));
await screen.findByText(/Protection posture is unavailable/);
await fireEvent.click(screen.getByRole('button', { name: 'Retry protection posture' }));
- await screen.findByRole('button', { name: '1 protected' });
+ await waitFor(() => verdictShows('protected'));
expect(window.location.pathname).toBe('/proxmox/backups/coverage');
await fireEvent.click(screen.getByRole('link', { name: /by date/i }));
await settleNavigation();
- const protectedCount = screen.getByRole('button', { name: '1 protected' });
- await fireEvent.click(protectedCount);
+ expect(window.location.pathname).toBe('/proxmox/backups/date');
+ apiFetchJSONMock.mockResolvedValue(responseFor('attention'));
+ await vi.advanceTimersByTimeAsync(30_000);
+ await fireEvent.click(await screen.findByRole('button', { name: '1 needs attention' }));
await settleNavigation();
await waitFor(() => expect(window.location.pathname).toBe('/proxmox/backups/coverage'));
- expect(new URLSearchParams(window.location.search).get('posture')).toBe('protected');
+ expect(new URLSearchParams(window.location.search).get('reason')).toBe('attention');
});
it.each([
@@ -3227,7 +3278,7 @@ describe('bare Backups entry retains its assessed workspace', () => {
apiFetchJSONMock.mockResolvedValue(responseFor('attention'));
mountBackupReadState();
await settleNavigation();
- await screen.findByRole('button', { name: '1 attention' });
+ await screen.findByRole('button', { name: '1 needs attention' });
expect(window.location.pathname + window.location.search).toBe(path);
});
@@ -3239,11 +3290,20 @@ describe('bare Backups entry retains its assessed workspace', () => {
await fireEvent.click(await screen.findByRole('link', { name: /by date/i }));
pending.resolve(responseFor('attention'));
await settleNavigation();
- await screen.findByRole('button', { name: '1 attention' });
+ await screen.findByRole('button', { name: '1 needs attention' });
expect(window.location.pathname).toBe('/proxmox/backups/date');
expect(screen.getByRole('link', { name: /by date/i })).toHaveAttribute('aria-current', 'page');
});
+ it('keeps a saved exception filter on Coverage once that group is empty', async () => {
+ window.history.replaceState({}, '', '/proxmox/backups?reason=stale');
+ apiFetchJSONMock.mockResolvedValue(responseFor('protected'));
+ mountBackupReadState();
+ await settleNavigation();
+ await waitFor(() => expect(window.location.pathname).toBe('/proxmox/backups/coverage'));
+ expect(new URLSearchParams(window.location.search).get('reason')).toBe('stale');
+ });
+
it('does not navigate after the pending entry is unmounted', async () => {
const pending = deferred<ProtectionPosturesResponse>();
apiFetchJSONMock.mockReturnValue(pending.promise);
diff --git a/frontend-modern/src/features/proxmox/__tests__/backupRetentionPresentation.test.tsx b/frontend-modern/src/features/proxmox/__tests__/backupRetentionPresentation.test.tsx
index 71d1338a95..b0da9760aa 100644
--- a/frontend-modern/src/features/proxmox/__tests__/backupRetentionPresentation.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/backupRetentionPresentation.test.tsx
@@ -71,7 +71,7 @@ describe('prune protection is independent of backup verification', () => {
const row = await restorePointRow();
expect(within(row).getByText(label)).toHaveClass(tone);
expect(within(row).queryByText('Protected')).not.toBeInTheDocument();
- expect(screen.getByRole('button', { name: '1 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '1 status unknown' })).toBeInTheDocument();
await fireEvent.click(within(row).getByRole('button', { name: /expand details/i }));
const detail = screen.getByTestId('proxmox-recoverable-detail');
expect(within(detail).getByText('Prune protection')).toBeInTheDocument();
diff --git a/frontend-modern/src/features/proxmox/__tests__/backupSizeEvidence.test.tsx b/frontend-modern/src/features/proxmox/__tests__/backupSizeEvidence.test.tsx
index 64c2858d18..bf8c9ed613 100644
--- a/frontend-modern/src/features/proxmox/__tests__/backupSizeEvidence.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/backupSizeEvidence.test.tsx
@@ -127,7 +127,7 @@ describe('restore-point size evidence through parsed inventory', () => {
expect(panel).not.toHaveTextContent('0 B');
}
expect(document.body).toHaveTextContent('3 completed restore points');
- expect(screen.getByRole('button', { name: '1 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '1 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(2);
},
);
diff --git a/frontend-modern/src/features/proxmox/__tests__/backupSourceConnection.test.tsx b/frontend-modern/src/features/proxmox/__tests__/backupSourceConnection.test.tsx
index ae94960456..bfe5e62116 100644
--- a/frontend-modern/src/features/proxmox/__tests__/backupSourceConnection.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/backupSourceConnection.test.tsx
@@ -174,7 +174,7 @@ describe('restore-point source connections in real inventory consumers', () => {
expect(evidence).toHaveTextContent('main / pve-1');
expect(evidence).toHaveTextContent('Verified');
}
- expect(screen.getByRole('button', { name: '1 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '1 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(2);
});
diff --git a/frontend-modern/src/features/proxmox/__tests__/backupTaskEvidence.test.tsx b/frontend-modern/src/features/proxmox/__tests__/backupTaskEvidence.test.tsx
index fc01232510..ad0ac2bb4b 100644
--- a/frontend-modern/src/features/proxmox/__tests__/backupTaskEvidence.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/backupTaskEvidence.test.tsx
@@ -104,7 +104,7 @@ describe('latest backup task evidence through the inventory consumer', () => {
within(section).getByText('Task status does not verify a restore or guest responsiveness.'),
).toHaveClass('whitespace-normal');
expect(panel).toHaveTextContent('Restore evidence');
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(2);
fireEvent.click(within(panel).getByRole('button', { name: 'Collapse same-name details' }));
@@ -156,7 +156,7 @@ describe('latest backup task evidence through the inventory consumer', () => {
if (extra.duration === 'Unknown') expect(timingNotice).toBeInTheDocument();
else expect(timingNotice).toBeNull();
expect(within(section).queryByText('Error', { exact: true, selector: 'td' })).toBeNull();
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(document.body).not.toHaveTextContent('A current verified backup is available.');
});
@@ -181,7 +181,7 @@ describe('latest backup task evidence through the inventory consumer', () => {
expect(taskSection(panel)).not.toHaveTextContent('do not establish a completed duration');
expect(document.activeElement).toBe(toggle);
expect(screen.getByTestId('proxmox-coverage-detail')).toBe(panel);
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(6);
});
@@ -214,7 +214,7 @@ describe('latest backup task evidence through the inventory consumer', () => {
expect(screen.getByTestId('proxmox-coverage-detail')).toBe(panel);
expect(toggle.closest('tr')).toBe(summary);
expect(document.activeElement).toBe(toggle);
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(4);
tasks = [];
@@ -280,7 +280,7 @@ describe('uncertain task chronology through the inventory consumer', () => {
expect(summary).not.toHaveTextContent('OK');
expect(panel).toHaveTextContent('dated-ok');
expect(panel).toHaveTextContent('Restore evidence');
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(2);
fireEvent.click(within(panel).getByRole('button', { name: 'Collapse same-name details' }));
@@ -404,7 +404,7 @@ describe('bounded uncertain-task inspection', () => {
expect(panel.querySelector('svg[onload]')).toBeNull();
expect(panel).toHaveTextContent('It is not a time order.');
expect(panel).not.toHaveTextContent('history-150');
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(2);
},
);
diff --git a/frontend-modern/src/features/proxmox/__tests__/backupTimestampEvidence.test.tsx b/frontend-modern/src/features/proxmox/__tests__/backupTimestampEvidence.test.tsx
index fcb3e9cac2..a93c813fa6 100644
--- a/frontend-modern/src/features/proxmox/__tests__/backupTimestampEvidence.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/backupTimestampEvidence.test.tsx
@@ -113,7 +113,7 @@ describe('malformed timestamp evidence through the parsed HTTP consumer', () =>
const evidence = evidenceTable(panel);
expect(within(evidence).getAllByText('Unknown', { exact: true })).toHaveLength(3);
expect(document.body).toHaveTextContent('3 completed restore points');
- expect(screen.getByRole('button', { name: '1 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '1 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(2);
});
@@ -160,7 +160,7 @@ describe('malformed timestamp evidence through the parsed HTTP consumer', () =>
expect(within(evidence).queryByText('Unknown', { exact: true })).toBeNull();
expect(screen.getByTestId('proxmox-coverage-detail')).toBe(panel);
expect(document.activeElement).toBe(toggle);
- expect(screen.getByRole('button', { name: '1 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '1 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(4);
});
});
diff --git a/frontend-modern/src/features/proxmox/__tests__/backupWorkloadIdentity.test.tsx b/frontend-modern/src/features/proxmox/__tests__/backupWorkloadIdentity.test.tsx
index 581453006e..0b801b4f32 100644
--- a/frontend-modern/src/features/proxmox/__tests__/backupWorkloadIdentity.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/backupWorkloadIdentity.test.tsx
@@ -104,7 +104,7 @@ describe('backup workload identity in real inventory consumers', () => {
expect(detail).not.toHaveTextContent('Unverified');
fireEvent.click(toggle);
}
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(2);
},
);
@@ -161,7 +161,7 @@ describe('backup workload identity in real inventory consumers', () => {
fireEvent.click(toggle);
}
expect(api.fetch).toHaveBeenCalledTimes(2);
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
},
);
diff --git a/frontend-modern/src/features/proxmox/__tests__/coverageRestorePointIdentity.test.tsx b/frontend-modern/src/features/proxmox/__tests__/coverageRestorePointIdentity.test.tsx
index 64de062db9..d19c673dbc 100644
--- a/frontend-modern/src/features/proxmox/__tests__/coverageRestorePointIdentity.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/coverageRestorePointIdentity.test.tsx
@@ -146,7 +146,7 @@ describe('Coverage restore-point identity through parsed inventory', () => {
}
expect(panel.querySelector('img')).toBeNull();
expect(panel).toHaveTextContent('entries cannot be placed in time');
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
const before = evidenceRows(panel);
const toggle = screen.getByRole('button', { name: /Collapse details for east-100/ });
toggle.focus();
@@ -200,7 +200,7 @@ describe('Coverage restore-point identity through parsed inventory', () => {
}
expect(panel.querySelector('img')).toBeNull();
expect(within(panel).getByText('Failed', { exact: true })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
expect(screen.getByText(/5 completed restore points/)).toBeInTheDocument();
expect(api.fetch).toHaveBeenCalledTimes(2);
await fireEvent.click(screen.getByRole('button', { name: /Expand details for west-100/ }));
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupVerdict.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupVerdict.test.ts
new file mode 100644
index 0000000000..d634795ee7
--- /dev/null
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupVerdict.test.ts
@@ -0,0 +1,124 @@
+import { describe, expect, it } from 'vitest';
+import type { ProtectionPosture } from '@/types/recovery';
+import { protectionPolicy, protectionPosture } from '@/utils/__fixtures__/protectionPosture';
+import type { WorkloadCoverageRow, WorkloadRecoveryPosture } from '../proxmoxBackupRecoveryModel';
+import { backupExceptionGroupKey, buildBackupVerdict } from '../proxmoxBackupVerdict';
+
+const row = (
+ label: string,
+ posture: WorkloadRecoveryPosture,
+ reason?: string,
+ extra: Partial<WorkloadCoverageRow> = {},
+): WorkloadCoverageRow => {
+ const assessment: ProtectionPosture | undefined =
+ posture === 'checking' || posture === 'not-evaluated'
+ ? undefined
+ : { ...protectionPosture(`vm:${label}`), state: posture, reason };
+ return {
+ key: `resource:${label}`,
+ workload: {
+ key: `resource:${label}`,
+ resourceId: `vm:${label}`,
+ type: 'vm',
+ typeLabel: 'VM',
+ vmid: '100',
+ label,
+ name: label,
+ },
+ artifacts: [],
+ pbsCount: 0,
+ archiveCount: 0,
+ snapshotCount: 0,
+ posture,
+ postureRank: 0,
+ protectionPosture: assessment,
+ isOrphaned: false,
+ ...extra,
+ };
+};
+
+describe('buildBackupVerdict', () => {
+ it('says all are protected when nothing is an exception', () => {
+ const verdict = buildBackupVerdict(
+ [row('a', 'protected', 'recent-verified'), row('b', 'protected', 'recent')],
+ protectionPolicy,
+ );
+ expect(verdict.headline).toBe('All 2 protected');
+ expect(verdict.tone).toBe('protected');
+ expect(verdict.exceptions).toEqual([]);
+ });
+
+ it('groups exceptions by reason, worst state first, then by size', () => {
+ const verdict = buildBackupVerdict(
+ [
+ row('web-01', 'protected', 'recent-verified'),
+ row('db-02', 'attention', 'verification-overdue'),
+ row('db-01', 'attention', 'verification-overdue'),
+ row('mail', 'attention', 'stale'),
+ row('scratch', 'unprotected', 'no-backup'),
+ row('lab', 'unknown', 'history-unreadable'),
+ ],
+ protectionPolicy,
+ );
+ expect(verdict.headline).toBe('1 of 6 protected');
+ expect(verdict.tone).toBe('unprotected');
+ expect(verdict.exceptions.map((group) => [group.label, group.rows.length])).toEqual([
+ ['No successful backup', 1],
+ ['Not verified recently', 2],
+ ['No backup in 7 days', 1],
+ ['Backup history unreadable', 1],
+ ]);
+ expect(verdict.exceptions[1].rows.map((r) => r.workload.label)).toEqual(['db-01', 'db-02']);
+ });
+
+ it('falls back to one group per state when the reason is missing or unknown', () => {
+ const verdict = buildBackupVerdict(
+ [row('old', 'attention'), row('future', 'attention', 'a-reason-from-a-newer-server')],
+ protectionPolicy,
+ );
+ expect(verdict.exceptions).toHaveLength(1);
+ expect(verdict.exceptions[0]).toMatchObject({ key: 'attention', label: 'Needs attention' });
+ expect(verdict.tone).toBe('attention');
+ });
+
+ it('leaves checking, not-evaluated and orphaned rows out of the rating', () => {
+ const verdict = buildBackupVerdict(
+ [
+ row('a', 'protected', 'recent'),
+ row('b', 'checking'),
+ row('host', 'not-evaluated'),
+ row('gone', 'attention', 'stale', { isOrphaned: true }),
+ ],
+ protectionPolicy,
+ );
+ expect(verdict).toMatchObject({
+ headline: '1 of 1 protected',
+ rated: 1,
+ checking: 1,
+ notEvaluated: 1,
+ exceptions: [],
+ });
+ });
+
+ it('says it is still checking before any assessment arrives', () => {
+ const verdict = buildBackupVerdict([row('a', 'checking')], protectionPolicy);
+ expect(verdict.headline).toBe('Checking backups…');
+ expect(verdict.tone).toBe('checking');
+ });
+
+ it('names the stale window only when the policy gives one', () => {
+ const verdict = buildBackupVerdict([row('a', 'attention', 'stale')], null);
+ expect(verdict.exceptions[0].label).toBe('Backup overdue');
+ });
+});
+
+describe('backupExceptionGroupKey', () => {
+ it('has no group for protected or presentation-only states', () => {
+ expect(backupExceptionGroupKey(row('a', 'protected', 'recent'))).toBeNull();
+ expect(backupExceptionGroupKey(row('b', 'checking'))).toBeNull();
+ expect(backupExceptionGroupKey(row('c', 'not-evaluated'))).toBeNull();
+ expect(backupExceptionGroupKey(row('d', 'unprotected', 'snapshots-only'))).toBe(
+ 'snapshots-only',
+ );
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/__tests__/recoverableIdentityAccess.test.tsx b/frontend-modern/src/features/proxmox/__tests__/recoverableIdentityAccess.test.tsx
index 17106c4c21..22de335a23 100644
--- a/frontend-modern/src/features/proxmox/__tests__/recoverableIdentityAccess.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/recoverableIdentityAccess.test.tsx
@@ -219,7 +219,7 @@ describe('restore-point identity without hover', () => {
);
}
expect(api.fetch).toHaveBeenCalledTimes(2);
- expect(screen.getByRole('button', { name: '2 unknown' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: '2 status unknown' })).toBeInTheDocument();
},
);
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupVerdict.ts b/frontend-modern/src/features/proxmox/proxmoxBackupVerdict.ts
new file mode 100644
index 0000000000..454a5ae9af
--- /dev/null
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupVerdict.ts
@@ -0,0 +1,152 @@
+import type { ProtectionPosturePolicy } from '@/types/recovery';
+import type { WorkloadCoverageRow } from './proxmoxBackupRecoveryModel';
+import { formatPostureWindow } from './proxmoxBackupsTablePresentation';
+
+// The Backups page answers "is everything backed up?" with one sentence, then
+// lists what is not, grouped by the server's posture reason so 700 guests with
+// overdue verification read as one line instead of 700 amber rows.
+
+export type BackupVerdictTone = 'protected' | 'attention' | 'unprotected' | 'unknown' | 'checking';
+export type BackupExceptionTone = 'attention' | 'unprotected' | 'unknown';
+
+export interface BackupExceptionGroup {
+ /** The posture reason, or the bare state when the assessment named none. */
+ key: string;
+ label: string;
+ tone: BackupExceptionTone;
+ rows: WorkloadCoverageRow[];
+}
+
+export interface BackupVerdict {
+ headline: string;
+ tone: BackupVerdictTone;
+ rated: number;
+ protected: number;
+ checking: number;
+ notEvaluated: number;
+ exceptions: BackupExceptionGroup[];
+}
+
+// Short, plain words: on a phone the label shares one line with its count.
+const reasonLabel = (reason: string, policy: ProtectionPosturePolicy | null): string | null => {
+ switch (reason) {
+ case 'source-failed':
+ return 'Backup source reported a failure';
+ case 'backup-future-dated':
+ return 'Backup dated in the future';
+ case 'stale': {
+ const seconds = policy?.freshnessWindowSeconds ?? 0;
+ return Number.isFinite(seconds) && seconds > 0
+ ? `No backup in ${formatPostureWindow(seconds)}`
+ : 'Backup overdue';
+ }
+ case 'verification-future-dated':
+ return 'Verification dated in the future';
+ case 'verification-overdue':
+ return 'Not verified recently';
+ case 'history-partial':
+ return 'Backup history partly unreadable';
+ case 'history-unreadable':
+ return 'Backup history unreadable';
+ case 'no-history':
+ return 'No backup history';
+ case 'snapshots-only':
+ return 'Snapshots only, no backup';
+ case 'no-backup':
+ return 'No successful backup';
+ default:
+ return null;
+ }
+};
+
+const STATE_FALLBACK_LABEL: Record<BackupExceptionTone, string> = {
+ attention: 'Needs attention',
+ unprotected: 'Not protected',
+ unknown: 'Status unknown',
+};
+
+// Each server reason belongs to exactly one state. A reason this build does
+// not know, or an assessment stored before reasons existed, falls back to a
+// group per state rather than being dropped or guessed.
+export const backupExceptionGroupKey = (row: WorkloadCoverageRow): string | null => {
+ if (row.posture !== 'attention' && row.posture !== 'unprotected' && row.posture !== 'unknown') {
+ return null;
+ }
+ const reason = row.protectionPosture?.reason;
+ return reason && reasonLabel(reason, null) ? reason : row.posture;
+};
+
+const TONE_ORDER: Record<BackupExceptionTone, number> = {
+ unprotected: 0,
+ attention: 1,
+ unknown: 2,
+};
+
+export function buildBackupVerdict(
+ rows: readonly WorkloadCoverageRow[],
+ policy: ProtectionPosturePolicy | null,
+): BackupVerdict {
+ let protectedCount = 0;
+ let checking = 0;
+ let notEvaluated = 0;
+ let hasUnprotected = false;
+ let hasAttention = false;
+ const groups = new Map<string, BackupExceptionGroup>();
+ for (const row of rows) {
+ if (row.isOrphaned) continue;
+ if (row.posture === 'protected') protectedCount += 1;
+ else if (row.posture === 'checking') checking += 1;
+ else if (row.posture === 'not-evaluated') notEvaluated += 1;
+ const key = backupExceptionGroupKey(row);
+ if (!key) continue;
+ const tone = row.posture as BackupExceptionTone;
+ hasUnprotected ||= tone === 'unprotected';
+ hasAttention ||= tone === 'attention';
+ let group = groups.get(key);
+ if (!group) {
+ group = {
+ key,
+ label: reasonLabel(key, policy) ?? STATE_FALLBACK_LABEL[tone],
+ tone,
+ rows: [],
+ };
+ groups.set(key, group);
+ }
+ group.rows.push(row);
+ }
+
+ const exceptions = [...groups.values()].sort(
+ (a, b) =>
+ TONE_ORDER[a.tone] - TONE_ORDER[b.tone] ||
+ b.rows.length - a.rows.length ||
+ a.label.localeCompare(b.label),
+ );
+ for (const group of exceptions) {
+ group.rows.sort((a, b) => a.workload.label.localeCompare(b.workload.label));
+ }
+ const exceptionCount = exceptions.reduce((sum, group) => sum + group.rows.length, 0);
+ const rated = protectedCount + exceptionCount;
+
+ let headline: string;
+ let tone: BackupVerdictTone;
+ if (rated === 0) {
+ headline = checking > 0 ? 'Checking backups…' : 'Nothing to rate yet';
+ tone = checking > 0 ? 'checking' : 'unknown';
+ } else if (exceptionCount === 0) {
+ headline = rated === 1 ? '1 of 1 protected' : `All ${rated} protected`;
+ tone = 'protected';
+ } else {
+ headline = `${protectedCount} of ${rated} protected`;
+ tone = hasUnprotected ? 'unprotected' : hasAttention ? 'attention' : 'unknown';
+ }
+
+ return {
+ headline,
+ tone,
+ rated,
+ protected: protectedCount,
+ checking,
+ notEvaluated,
+ exceptions,
+ };
+}
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts b/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
index 795010f68e..fd0407a4a7 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTablePresentation.ts
@@ -357,7 +357,7 @@ export const getBackupPostureRuleText = (
return `Attention: the newest backup is older than ${formatPostureWindow(seconds)}, a newer backup job failed, expected verification is missing or overdue, or Pulse can see only part of the backup history. Unprotected: Pulse sees the full history and no backup it can count. Guest snapshots alone do not count. Unknown: Pulse cannot read the backup history or has no backup source linked to the guest.`;
};
-const formatPostureWindow = (seconds: number): string => {
+export const formatPostureWindow = (seconds: number): string => {
if (seconds >= 86_400 && seconds % 86_400 === 0) {
const days = seconds / 86_400;
return days === 1 ? '1 day' : `${days} days`;
diff --git a/frontend-modern/src/hooks/__tests__/useProtectionPostures.test.ts b/frontend-modern/src/hooks/__tests__/useProtectionPostures.test.ts
index 147e8bbed4..fc60267998 100644
--- a/frontend-modern/src/hooks/__tests__/useProtectionPostures.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useProtectionPostures.test.ts
@@ -209,6 +209,34 @@ describe('useProtectionPostures transport', () => {
}
});
+ it('keeps the posture reason, accepts one this build lacks or none, and rejects a non-string', async () => {
+ const named = { ...protectionPosture('vm:1'), state: 'attention' as const, reason: 'stale' };
+ const newer = { ...protectionPosture('vm:2'), reason: 'reason-from-a-newer-server' };
+ const stored = protectionPosture('vm:3');
+ apiFetchJSONMock.mockResolvedValue({ data: [named, newer, stored], policy: protectionPolicy });
+ let dispose = () => {};
+ const hook = createRoot((rootDispose) => {
+ dispose = rootDispose;
+ return useProtectionPostures(() => ['vm:1', 'vm:2', 'vm:3']);
+ });
+ try {
+ await vi.waitFor(() => expect(hook.postures()).toHaveLength(3));
+ expect(hook.postureByResourceID().get('vm:1')?.reason).toBe('stale');
+ expect(hook.postureByResourceID().get('vm:2')?.reason).toBe('reason-from-a-newer-server');
+ expect(hook.postureByResourceID().get('vm:3')?.reason).toBeUndefined();
+
+ apiFetchJSONMock.mockResolvedValue({
+ data: [{ ...named, reason: 7 }],
+ policy: protectionPolicy,
+ });
+ await hook.refetch();
+ expect(hook.response.error).toBeInstanceOf(ProtectionPostureFormatError);
+ expect(hook.postures()).toEqual([]);
+ } finally {
+ dispose();
+ }
+ });
+
it('does not restore a failed cached assessment when Coverage remounts', async () => {
apiFetchJSONMock.mockResolvedValue({
data: [protectionPosture('vm:1')],
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index 2d9d691585..843513243d 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -175,6 +175,7 @@ describe('resource link routing contract', () => {
source: 'source',
location: 'location',
posture: 'posture',
+ reason: 'reason',
day: 'day',
});
expect(buildProxmoxPath()).toBe('/proxmox/overview');
diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts
index 3a1e6464fc..0d1df5277a 100644
--- a/frontend-modern/src/routing/resourceLinks.ts
+++ b/frontend-modern/src/routing/resourceLinks.ts
@@ -36,6 +36,8 @@ export const PROXMOX_BACKUPS_QUERY_PARAMS = {
source: 'source',
location: 'location',
posture: 'posture',
+ // An exception group from the backup verdict: guests sharing one posture reason.
+ reason: 'reason',
day: 'day',
} as const;
export const DOCKER_PATH = '/docker';
diff --git a/frontend-modern/src/types/recovery.ts b/frontend-modern/src/types/recovery.ts
index c08a3b26c2..253410fec4 100644
--- a/frontend-modern/src/types/recovery.ts
+++ b/frontend-modern/src/types/recovery.ts
@@ -88,6 +88,21 @@ export type ProtectionState = 'protected' | 'attention' | 'unprotected' | 'unkno
export type ProtectionFreshness = 'current' | 'stale' | 'unknown';
export type ProtectionVerification = 'verified' | 'unverified' | 'stale' | 'unknown';
export type ProtectionCoverage = 'complete' | 'partial' | 'none' | 'unknown';
+// Which posture rule decided the state. Absent on assessments stored before the
+// server named reasons; a newer server may send a reason this build lacks.
+export type ProtectionReason =
+ | 'recent-verified'
+ | 'recent'
+ | 'source-failed'
+ | 'backup-future-dated'
+ | 'stale'
+ | 'verification-future-dated'
+ | 'verification-overdue'
+ | 'history-partial'
+ | 'history-unreadable'
+ | 'no-history'
+ | 'snapshots-only'
+ | 'no-backup';
export type ProtectionHistoryCompleteness = 'complete' | 'partial' | 'unavailable' | 'unknown';
export type ProtectionUnreadScopeKind = 'node' | 'storage' | 'datastore' | 'namespace';
@@ -129,6 +144,7 @@ export interface ProtectionPosture {
providerStates: ProtectionProviderState[];
repositoryResourceIds: string[];
evidenceIds: string[];
+ reason?: ProtectionReason | (string & {});
explanation: string;
evaluatedAt: string;
}
diff --git a/frontend-modern/src/utils/protectionPostureResponse.ts b/frontend-modern/src/utils/protectionPostureResponse.ts
index 9b99586cf6..c1ba2bc029 100644
--- a/frontend-modern/src/utils/protectionPostureResponse.ts
+++ b/frontend-modern/src/utils/protectionPostureResponse.ts
@@ -88,6 +88,7 @@ const postureShape = {
lastVerifiedAt: optionalTime,
repositoryResourceIds: idList,
evidenceIds: idList,
+ reason: optionalText,
explanation: text,
evaluatedAt: timestamp,
};
diff --git a/internal/recovery/model/posture.go b/internal/recovery/model/posture.go
index 0c1ab056a4..dd0d313d79 100644
--- a/internal/recovery/model/posture.go
+++ b/internal/recovery/model/posture.go
@@ -92,6 +92,48 @@ func (coverage ProtectionCoverage) Valid() bool {
}
}
+// ProtectionReason names which rule decided a posture, so a surface can group
+// resources by cause without parsing the explanation sentence.
+type ProtectionReason string
+
+const (
+ ProtectionReasonRecentVerified ProtectionReason = "recent-verified"
+ ProtectionReasonRecent ProtectionReason = "recent"
+ ProtectionReasonSourceFailed ProtectionReason = "source-failed"
+ ProtectionReasonBackupFutureDated ProtectionReason = "backup-future-dated"
+ ProtectionReasonStale ProtectionReason = "stale"
+ ProtectionReasonVerificationFutureDated ProtectionReason = "verification-future-dated"
+ ProtectionReasonVerificationOverdue ProtectionReason = "verification-overdue"
+ ProtectionReasonHistoryPartial ProtectionReason = "history-partial"
+ ProtectionReasonHistoryUnreadable ProtectionReason = "history-unreadable"
+ ProtectionReasonNoHistory ProtectionReason = "no-history"
+ ProtectionReasonSnapshotsOnly ProtectionReason = "snapshots-only"
+ ProtectionReasonNoBackup ProtectionReason = "no-backup"
+)
+
+// Valid accepts the empty reason: postures stored before reasons existed
+// carry none until their next evaluation.
+func (reason ProtectionReason) Valid() bool {
+ switch reason {
+ case "",
+ ProtectionReasonRecentVerified,
+ ProtectionReasonRecent,
+ ProtectionReasonSourceFailed,
+ ProtectionReasonBackupFutureDated,
+ ProtectionReasonStale,
+ ProtectionReasonVerificationFutureDated,
+ ProtectionReasonVerificationOverdue,
+ ProtectionReasonHistoryPartial,
+ ProtectionReasonHistoryUnreadable,
+ ProtectionReasonNoHistory,
+ ProtectionReasonSnapshotsOnly,
+ ProtectionReasonNoBackup:
+ return true
+ default:
+ return false
+ }
+}
+
type ProtectionHistoryCompleteness string
const (
@@ -279,6 +321,7 @@ type ProtectionPosture struct {
ProviderStates []ProtectionProviderState `json:"providerStates"`
RepositoryResourceIDs []string `json:"repositoryResourceIds"`
EvidenceIDs []string `json:"evidenceIds"`
+ Reason ProtectionReason `json:"reason,omitempty"`
Explanation string `json:"explanation"`
EvaluatedAt time.Time `json:"evaluatedAt"`
}
@@ -313,6 +356,9 @@ func (posture ProtectionPosture) Validate() error {
if !posture.Coverage.Valid() {
return fmt.Errorf("protection posture coverage %q is invalid", posture.Coverage)
}
+ if !posture.Reason.Valid() {
+ return fmt.Errorf("protection posture reason %q is invalid", posture.Reason)
+ }
if posture.EvaluatedAt.IsZero() {
return errors.New("protection posture evaluation time is required")
}
diff --git a/internal/recovery/posture.go b/internal/recovery/posture.go
index 87ec92913b..0908acc97a 100644
--- a/internal/recovery/posture.go
+++ b/internal/recovery/posture.go
@@ -427,6 +427,7 @@ func DeriveProtectionPostureAt(
ProviderStates: []ProtectionProviderState{},
RepositoryResourceIDs: []string{},
EvidenceIDs: []string{},
+ Reason: ProtectionReasonNoHistory,
Explanation: "Pulse has no readable backup history for this resource, so it cannot say whether it is protected.",
EvaluatedAt: now,
}
@@ -612,8 +613,10 @@ func DeriveProtectionPostureAt(
// A backup the latest collection read stays a backup when some other
// storage could not be read; coverage carries that gap.
posture.State = ProtectionStateProtected
+ posture.Reason = ProtectionReasonRecent
switch {
case posture.Verification == ProtectionVerificationVerified:
+ posture.Reason = ProtectionReasonRecentVerified
posture.Explanation = "A recent backup is available and it was verified recently."
case hasPartial || hasUnknownBlock:
posture.Explanation = "A recent backup is available."
@@ -631,23 +634,31 @@ func DeriveProtectionPostureAt(
posture.State = ProtectionStateAttention
switch {
case hasInvalidatingFailure:
+ posture.Reason = ProtectionReasonSourceFailed
posture.Explanation = "A backup exists, but one of its backup sources has reported a failure."
case stateLastSuccessAt != nil && stateLastSuccessAt.After(now):
+ posture.Reason = ProtectionReasonBackupFutureDated
posture.Explanation = "The newest backup is dated in the future, so Pulse cannot confirm its age. Check the backup source and Pulse server clocks."
case posture.Freshness == ProtectionFreshnessStale:
+ posture.Reason = ProtectionReasonStale
posture.Explanation = fmt.Sprintf("The newest confirmed backup is older than %s.", formatPostureWindow(policy.FreshnessWindow))
case stateVerificationExpected && stateLastVerifiedAt != nil && stateLastVerifiedAt.After(now):
+ posture.Reason = ProtectionReasonVerificationFutureDated
posture.Explanation = "The backup verification is dated in the future, so Pulse cannot confirm it. Check the backup source and Pulse server clocks."
case stateVerificationExpected && posture.Verification != ProtectionVerificationVerified:
+ posture.Reason = ProtectionReasonVerificationOverdue
posture.Explanation = "A recent backup exists, but its verification is missing or overdue."
default:
+ posture.Reason = ProtectionReasonHistoryPartial
posture.Explanation = "A backup exists, but Pulse can see only part of the backup history or cannot read all of it."
}
case hasUnknownBlock:
posture.State = ProtectionStateUnknown
+ posture.Reason = ProtectionReasonHistoryUnreadable
posture.Explanation = "Pulse cannot read the backup history (it is unavailable or Pulse lacks permission), so it cannot say whether this is protected."
case hasQualifyingSuccess || hasPartial:
posture.State = ProtectionStateAttention
+ posture.Reason = ProtectionReasonHistoryPartial
if hasQualifyingSuccess {
posture.Explanation = "A backup exists, but Pulse can see only part of the backup history or cannot read all of it."
} else {
@@ -658,7 +669,9 @@ func DeriveProtectionPostureAt(
}
case hasCompleteHistory:
posture.State = ProtectionStateUnprotected
+ posture.Reason = ProtectionReasonNoBackup
if hasSnapshotsOnly {
+ posture.Reason = ProtectionReasonSnapshotsOnly
posture.Explanation = "Only snapshots were found. A snapshot is not a separate backup, so it does not count."
} else {
posture.Explanation = "Pulse can see the full backup history, but found no successful, completed backup for this resource."
diff --git a/internal/recovery/posture_test.go b/internal/recovery/posture_test.go
index c4204acecd..01c444a0a2 100644
--- a/internal/recovery/posture_test.go
+++ b/internal/recovery/posture_test.go
@@ -50,6 +50,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify ProtectionVerification
wantCoverage ProtectionCoverage
wantText string
+ wantReason ProtectionReason
}{
{
name: "current verified PBS backup is protected",
@@ -59,6 +60,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationVerified,
wantCoverage: ProtectionCoverageComplete,
wantText: "A recent backup is available",
+ wantReason: ProtectionReasonRecentVerified,
},
{
name: "stale success needs attention",
@@ -70,6 +72,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationStale,
wantCoverage: ProtectionCoverageComplete,
wantText: "newest confirmed backup is older than 7 days",
+ wantReason: ProtectionReasonStale,
},
{
name: "missing expected verification needs attention",
@@ -83,6 +86,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationUnverified,
wantCoverage: ProtectionCoverageComplete,
wantText: "verification is missing or overdue",
+ wantReason: ProtectionReasonVerificationOverdue,
},
{
name: "newer provider failure invalidates protected claim",
@@ -98,6 +102,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationVerified,
wantCoverage: ProtectionCoverageComplete,
wantText: "one of its backup sources has reported a failure",
+ wantReason: ProtectionReasonSourceFailed,
},
{
name: "complete snapshot-only history is unprotected",
@@ -118,6 +123,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationUnknown,
wantCoverage: ProtectionCoverageNone,
wantText: "A snapshot is not a separate backup",
+ wantReason: ProtectionReasonSnapshotsOnly,
},
{
name: "partial provider history is attention when a backup exists",
@@ -132,6 +138,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationVerified,
wantCoverage: ProtectionCoveragePartial,
wantText: "only part of the backup history",
+ wantReason: ProtectionReasonHistoryPartial,
},
{
name: "partial history without any backup does not claim one exists",
@@ -146,6 +153,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationUnknown,
wantCoverage: ProtectionCoveragePartial,
wantText: "cannot confirm a backup",
+ wantReason: ProtectionReasonHistoryPartial,
},
{
name: "partial history with unknown access is attention when a backup exists",
@@ -160,6 +168,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationVerified,
wantCoverage: ProtectionCoveragePartial,
wantText: "only part of the backup history",
+ wantReason: ProtectionReasonHistoryPartial,
},
{
name: "partial history with unknown access and no backup does not claim one exists",
@@ -175,6 +184,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationUnknown,
wantCoverage: ProtectionCoveragePartial,
wantText: "cannot confirm a backup",
+ wantReason: ProtectionReasonHistoryPartial,
},
{
name: "unavailable history with unknown access is unknown",
@@ -189,6 +199,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationVerified,
wantCoverage: ProtectionCoverageUnknown,
wantText: "cannot read the backup history",
+ wantReason: ProtectionReasonHistoryUnreadable,
},
{
name: "permission denied is unknown",
@@ -203,6 +214,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationVerified,
wantCoverage: ProtectionCoverageUnknown,
wantText: "cannot read the backup history",
+ wantReason: ProtectionReasonHistoryUnreadable,
},
{
name: "confirmed PBS recovery is not invalidated by an unknown legacy provider",
@@ -227,6 +239,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationVerified,
wantCoverage: ProtectionCoverageUnknown,
wantText: "does not change this backup",
+ wantReason: ProtectionReasonRecentVerified,
},
{
name: "no provider evidence is unknown",
@@ -236,6 +249,7 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
wantVerify: ProtectionVerificationUnknown,
wantCoverage: ProtectionCoverageUnknown,
wantText: "no readable backup history",
+ wantReason: ProtectionReasonNoHistory,
},
}
@@ -264,6 +278,9 @@ func TestDeriveProtectionPostureTruthTable(t *testing.T) {
if !strings.Contains(got.Explanation, test.wantText) {
t.Fatalf("explanation = %q, want substring %q", got.Explanation, test.wantText)
}
+ if got.Reason != test.wantReason {
+ t.Fatalf("reason = %q, want %q", got.Reason, test.wantReason)
+ }
if err := got.Validate(); err != nil {
t.Fatalf("Validate() error = %v", err)
}
@@ -401,6 +418,9 @@ func TestBuildProtectionPostureDoesNotTreatSuccessfulTaskAsAvailableBackup(t *te
if !strings.Contains(got.Explanation, "found no successful, completed backup") {
t.Fatalf("explanation = %q, want no qualifying backup", got.Explanation)
}
+ if got.Reason != ProtectionReasonNoBackup {
+ t.Fatalf("reason = %q, want %q", got.Reason, ProtectionReasonNoBackup)
+ }
}
func TestNewProtectionProviderObservationRequiresTypedLimitation(t *testing.T) {
@@ -597,6 +617,18 @@ func TestBuildProtectionPostureUsesCanonicalPointIdentity(t *testing.T) {
}
}
+var clockBoundReason = map[string]ProtectionReason{
+ "future-backup": ProtectionReasonBackupFutureDated,
+ "future-backup-without-verification": ProtectionReasonBackupFutureDated,
+ "one-nanosecond-ahead": ProtectionReasonBackupFutureDated,
+ "future-verification": ProtectionReasonVerificationFutureDated,
+ "optional-future-verification": ProtectionReasonRecent,
+ "exactly-now": ProtectionReasonRecentVerified,
+ "exact-window-boundary": ProtectionReasonRecentVerified,
+ "expired-window": ProtectionReasonStale,
+ "missing-verification": ProtectionReasonVerificationOverdue,
+}
+
func TestProtectionPostureClockBounds(t *testing.T) {
t.Parallel()
now := time.Date(2026, 10, 25, 12, 0, 0, 0, time.FixedZone("source", 3600))
@@ -640,6 +672,9 @@ func TestProtectionPostureClockBounds(t *testing.T) {
if !strings.Contains(posture.Explanation, tc.wantText) {
t.Errorf("explanation=%q, want %q", posture.Explanation, tc.wantText)
}
+ if want := clockBoundReason[tc.name]; posture.Reason != want {
+ t.Errorf("reason=%q, want %q", posture.Reason, want)
+ }
if posture.Coverage != ProtectionCoverageComplete || !posture.LastSuccessfulPointAt.Equal(tc.success) || len(posture.ProviderStates) != 1 || !posture.ProviderStates[0].LastSuccessAt.Equal(tc.success) || !reflect.DeepEqual(summary, before) {
t.Error("clock assessment changed source evidence or collection coverage")
}
diff --git a/internal/recovery/types.go b/internal/recovery/types.go
index 860ce652ce..9c8714635d 100644
--- a/internal/recovery/types.go
+++ b/internal/recovery/types.go
@@ -101,6 +101,23 @@ const (
ProtectionCoverageUnknown ProtectionCoverage = model.ProtectionCoverageUnknown
)
+type ProtectionReason = model.ProtectionReason
+
+const (
+ ProtectionReasonRecentVerified ProtectionReason = model.ProtectionReasonRecentVerified
+ ProtectionReasonRecent ProtectionReason = model.ProtectionReasonRecent
+ ProtectionReasonSourceFailed ProtectionReason = model.ProtectionReasonSourceFailed
+ ProtectionReasonBackupFutureDated ProtectionReason = model.ProtectionReasonBackupFutureDated
+ ProtectionReasonStale ProtectionReason = model.ProtectionReasonStale
+ ProtectionReasonVerificationFutureDated ProtectionReason = model.ProtectionReasonVerificationFutureDated
+ ProtectionReasonVerificationOverdue ProtectionReason = model.ProtectionReasonVerificationOverdue
+ ProtectionReasonHistoryPartial ProtectionReason = model.ProtectionReasonHistoryPartial
+ ProtectionReasonHistoryUnreadable ProtectionReason = model.ProtectionReasonHistoryUnreadable
+ ProtectionReasonNoHistory ProtectionReason = model.ProtectionReasonNoHistory
+ ProtectionReasonSnapshotsOnly ProtectionReason = model.ProtectionReasonSnapshotsOnly
+ ProtectionReasonNoBackup ProtectionReason = model.ProtectionReasonNoBackup
+)
+
type ProtectionHistoryCompleteness = model.ProtectionHistoryCompleteness
const (