From 36badcbfb09509bf05abde5f89255d08cf83f889 Mon Sep 17 00:00:00 2001 From: rcourtman <8825017+rcourtman@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:58:15 +0000 Subject: [PATCH] Lead the Backups page with a verdict and grouped exceptions The Backup health strip answered "is everything backed up?" with a coloured bar and six posture counts. On a real install it read "0 protected, 38 attention", and finding out why meant opening drawers one guest at a time: the cause lived only in each explanation sentence. The protection posture now carries a server-owned reason code, set in DeriveProtectionPostureAt beside the explanation it summarizes, so a surface can group guests by cause without parsing sentences. The strip states one verdict ("47 of 49 protected") and lists one line per cause with its count ("No successful backup 2"). A line opens Coverage filtered to exactly those guests through a new ?reason= URL filter. Postures stored before reasons existed, or carrying a reason this build lacks, group under their state instead of being dropped. The posture bar and per-posture count toggles are removed; the inline posture pills still filter by posture. No posture, freshness or protection rule changes. This stacks on #3706, which keeps re-read backups protected when one storage is unreadable and names that storage once. --- .../OPERATIONAL_TRUST_IMPLEMENTATION_SPEC.md | 9 + .../subsystems/frontend-primitives.md | 17 +- .../internal/subsystems/storage-recovery.md | 43 ++-- .../internal/subsystems/unified-resources.md | 10 +- .../5d2a131d66ee73d1.json | 49 +++++ .../proxmox/ProxmoxBackupsCoverageStrip.tsx | 192 +++++++++--------- .../features/proxmox/ProxmoxBackupsTable.tsx | 130 ++++-------- .../__tests__/ProxmoxBackupsTable.test.tsx | 152 +++++++++----- .../backupRetentionPresentation.test.tsx | 2 +- .../__tests__/backupSizeEvidence.test.tsx | 2 +- .../__tests__/backupSourceConnection.test.tsx | 2 +- .../__tests__/backupTaskEvidence.test.tsx | 12 +- .../backupTimestampEvidence.test.tsx | 4 +- .../__tests__/backupWorkloadIdentity.test.tsx | 4 +- .../coverageRestorePointIdentity.test.tsx | 4 +- .../__tests__/proxmoxBackupVerdict.test.ts | 124 +++++++++++ .../recoverableIdentityAccess.test.tsx | 2 +- .../features/proxmox/proxmoxBackupVerdict.ts | 152 ++++++++++++++ .../proxmoxBackupsTablePresentation.ts | 2 +- .../__tests__/useProtectionPostures.test.ts | 28 +++ .../routing/__tests__/resourceLinks.test.ts | 1 + frontend-modern/src/routing/resourceLinks.ts | 2 + frontend-modern/src/types/recovery.ts | 16 ++ .../src/utils/protectionPostureResponse.ts | 1 + internal/recovery/model/posture.go | 46 +++++ internal/recovery/posture.go | 13 ++ internal/recovery/posture_test.go | 35 ++++ internal/recovery/types.go | 17 ++ 28 files changed, 801 insertions(+), 270 deletions(-) create mode 100644 frontend-modern/browser-verification/5d2a131d66ee73d1.json create mode 100644 frontend-modern/src/features/proxmox/__tests__/proxmoxBackupVerdict.test.ts create mode 100644 frontend-modern/src/features/proxmox/proxmoxBackupVerdict.ts 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 +### Backup health states a verdict and groups exceptions by reason (1 November 2026) -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. +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 = { + 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 = (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 ( -
+
{props.title} @@ -52,71 +61,70 @@ export const ProxmoxBackupsCoverageStrip: Component = (props
{props.tail}
- 0} - fallback={