Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep recovered checks and ageing monitoring views truthful
pulse-triage[bot]bd6e21ca4086
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 630ff53a58..ff8bf9115f 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -4753,3 +4753,13 @@ Notifications owner, proving a late result cannot notify or start readbacksin its replacement while the replacement's own action still works. Browsercontrols use the actual Overview/Notifications components, API adapters,toast and CSS with synthetic local endpoints at desktop/phone widths.++### Mounted held readings follow the shared clock (10 October 2026)++Node, guest and Mail Gateway drawer attention, and the Proxmox node temperature+hover, age an unchanged metric evaluation on the existing shared clock. The+metric presentation requires an explicit clock; drawer copy reads an accessor+only for usable live status, leaving non-metric rows unchanged. The ten-minute+stale boundary, evaluated breach date, legacy fallback, clear rule and operator+memory basis remain independent. This does not infer collection or recovery.+Mounted drawer controls and lazy-copy tests cover this boundary.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 7494b1203c..f46404af3b 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -12101,3 +12101,15 @@ and `TestAlertConnectionSnapshotsKeepConfiguredPlatformRowsWithoutTheHosts` infinding's resource reference through `Monitor.GetUnifiedStructureReadState`; inmock mode that is the view built for the current fixture structure, outside itthe read state it used before.++### Loaded availability Settings honours evidence expiry (10 October 2026)++The existing availability Settings client passes the shared current time to+loaded-resource health classification, count, colour, label and status tooltip. Time+alone can move a healthy retained observation to attention; it performs no+new target read, test, mutation or authentication/scope change. Target-only+fallback, intentional pause, wire fields and configured failure threshold remain+unchanged. The mounted Settings test holds source/target identities fixed and+checks one initial list call while the expiry is crossed.+An expired loaded check reads Stale rather than Online in an amber badge;+intentional pause and the dedicated stopped-probe label still take precedence.diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 07168babfd..0ad05f621e 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -9229,3 +9229,17 @@ retired reads/callbacks and a replacement owner's independent accepted action.Desktop/phone browser controls use the real Overview/Notifications surfaces,API adapters, toast and CSS with synthetic responses, not native delivery orpublished queue recovery.++### Existing monitoring surfaces stay truthful while mounted (10 October 2026)++Availability table order/filter/status, fleet status, open probe card and loaded+Settings count/colour/label age the same retained evidence on the shared clock, not+only after new props or a reload. Clock readers retire with their owners. Probe+path verdicts and persisted history are not inferred from time alone. Held node,+guest and Mail Gateway metric attention uses that clock; non-metric copy does+not depend on its tick. Existing notification view lifetime boundaries remain.++VmwareOverview retains the page-owned workload state and renders an h2 VMs+through the WorkloadsSurface tableTitle slot. Kiosk may remove the filter bar,+not this name. The count is filtered rows once shared-toolbar readiness holds,+including zero; no extra state, toolbar, route or hidden input is added.diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex c2843f6f58..a01d223d6b 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -4080,3 +4080,14 @@ Its connected monitor control fills each ceiling independently and checkscomplete stored/live windows, measured zero, unchanged original times, readerownership and renewed admission after Reset. It uses an ordinary temporaryhistory store, not an installed workload or process-memory measurement.++### Mounted health consumes the existing bounded clock (10 October 2026)++Availability tables/fleet/cards and held guest/node/gateway metric attention+subscribe to the existing 30-second shared clock and release their subscription+with their owner. Usable metric status reads a supplied accessor; non-metric+attention copy does not read it. No per-row timer, new poll, probe, retry or+notification is introduced. Current snapshot/delta fast paths retain their+existing scope; only availability complete-record replacement changes, never+other partial provider facets or independent metric updates. This is truthful+presentation and scoped invalidation, not a measured whole-fleet CPU saving.diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 8b6b812a3c..21fb83bb54 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -8319,3 +8319,20 @@ Verification: `truenasPageModel.test.ts`,`browser-tests/truenas-disk-thresholds.cjs` cover disk overrides, TrueNAS-widelimits, Off and last-known readings. Synthetic browser observations do notestablish sustained native metrics, History, revocation or release availability.++### Availability recovery replaces complete check records (10 October 2026)++A present availability summary, its platformData mirror and plural check set+replace the previous complete record. Optional failure/application/certificate/+location fields omitted after recovery or summary-target change are withdrawn;+an absent record retains enrichment only while its explicit source remains.+The plural mirror must leave with that source and cannot reappear on hydration.+Other provider facets keep their own partial/native-withdrawal rules, including+linked-agent and guest filesystems. Snapshot, rebuilt websocket merge-patch and+source-removal controls cover both canonical and mirrored records.++The availability table, fleet, open probe card and loaded Settings resource+classification use the existing shared clock for freshness and ages. No clock+tick initiates a probe, grants health, changes thresholds or widens token scope.+The vSphere VM table has one h2 title, including kiosk and filtered-empty state;+its count follows filtered rows only when the page-owned toolbar state is ready.diff --git a/frontend-modern/browser-verification/4a748fa5edf2d53d.json b/frontend-modern/browser-verification/4a748fa5edf2d53d.jsonnew file mode 100644index 0000000000..ae68d79c90--- /dev/null+++ b/frontend-modern/browser-verification/4a748fa5edf2d53d.json@@ -0,0 +1,78 @@+{+ "version": 1,+ "base_sha": "1322db3fed15b0bd2616cd359e4e5e44d7509b8b",+ "verified_at": "2026-10-10T18:24:12Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/components/Infrastructure/AvailabilityProbeStatusCard.tsx",+ "frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsx",+ "frontend-modern/src/components/Settings/availabilitySettingsModel.ts",+ "frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx",+ "frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx",+ "frontend-modern/src/components/Workloads/guestDrawerModel.ts",+ "frontend-modern/src/features/alerts/metricAlertPresentation.ts",+ "frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx",+ "frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx",+ "frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx",+ "frontend-modern/src/features/standalone/AvailabilityFleetView.tsx",+ "frontend-modern/src/features/vmware/VmwarePageSurface.tsx",+ "frontend-modern/src/utils/availabilityProbePresentation.ts",+ "frontend-modern/src/utils/resourceStateAdapters.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/components/Infrastructure/AvailabilityProbeStatusCard.tsx": "d3f125e7e5a735314bb427ce8bdb99e2575a0f65e8564617fe9ebb80014f112a",+ "frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsx": "6dccdfeee862fba2f68c61026e5c3f7a0d8c8f916dd86a2385c843443e22313b",+ "frontend-modern/src/components/Settings/availabilitySettingsModel.ts": "041b9ad9c0a1bc9b1ba4a05f31340ed24b892ec46add48821ab851224e9db41b",+ "frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx": "d6b6422b4adbc8bee235905dc8db7874e699ff6cb753fa43e972bb1a133cd29c",+ "frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx": "f55809164a9f744ba86fbf779888e3faaf4186e22214edff5adf9f1a958c92a9",+ "frontend-modern/src/components/Workloads/guestDrawerModel.ts": "dd78725083f57b020a9c5ebe364cc3693b72bfa303796857a5d8c1263482cce9",+ "frontend-modern/src/features/alerts/metricAlertPresentation.ts": "69a853de4a91ccf56ec693b843450488c64a0684712567835a0d09f5a283db28",+ "frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx": "31812d106672cb92f6c613dca711ee76c99de2d194508f044d0423af8ea49b02",+ "frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx": "48e103c8de9856ff453d0cbeeb0132b14b83efccfbe4257936b14ce01912354c",+ "frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx": "d823a3319821fb3f663cb3a8873c500f1b29c4605ad3707fccdae6c61cb93588",+ "frontend-modern/src/features/standalone/AvailabilityFleetView.tsx": "b1a6b50023cadd36a1ed67380190a2fd742f2cca9acc6e11423d3ec77341c53f",+ "frontend-modern/src/features/vmware/VmwarePageSurface.tsx": "9922485f9b09a6c2ec7015436e366cba3dbf137aab9329f35cd10f3b71c909be",+ "frontend-modern/src/utils/availabilityProbePresentation.ts": "23cdd66303fea43cbccd577ae96d985d25e4bb84a1eb83ff9b635a3aa732032f",+ "frontend-modern/src/utils/resourceStateAdapters.ts": "a3d49a539f2ba173f58050b3c7161e5e9cb5f458360f8c12a851ff89997664c5"+ },+ "routes": [+ "/tmp/reading-recovery/index.html?surface=table",+ "/tmp/reading-recovery/index.html?surface=fleet",+ "/tmp/reading-recovery/index.html?surface=card",+ "/tmp/reading-recovery/index.html?surface=settings",+ "/tmp/reading-recovery/index.html?surface=guest",+ "/tmp/reading-recovery/index.html?surface=node",+ "/tmp/reading-recovery/index.html?surface=pmg",+ "/tmp/reading-recovery/index.html?surface=nodes",+ "/tmp/reading-recovery/index.html?surface=vmware"+ ],+ "viewports": [+ {+ "width": 1280,+ "height": 900+ },+ {+ "width": 390,+ "height": 900+ }+ ],+ "states": [+ "Synthetic recovered HTTP check with withdrawn failure fields and platform mirror",+ "Removed availability source without rehydrated check sets",+ "Expired retained availability evidence in table, fleet, card and Settings",+ "Held guest/node/gateway metric reading ages independently of breach date",+ "Legacy attention copy after live status disappears",+ "Desktop temperature hover ages; phone layout retains its intentional omitted column",+ "Filtered VMs table heading in desktop/phone kiosk and filtered-empty state",+ "Inspected light desktop and dark phone captures without page-level overflow"+ ],+ "interactions": [+ "Apply synthetic raw resource merge-patch recovery and source withdrawal through the production websocket store",+ "Advance a controlled shared clock with unchanged observation timestamps",+ "Remove live metric status without clearing the retained alert",+ "Search and commit app-01; enter and exit kiosk with the production page-owned state",+ "Remove the committed search chip (expand Filters on phone), apply an unmatched search and return to empty kiosk",+ "Check no page errors, unexpected endpoints, off-origin or action/probe/mutation requests; allow readonly History POSTs"+ ],+ "notes": "Production components/page with synthetic local inputs. 18 selected completed cases, 62 control blocks and 20 inspected captures across incremental byte-bound proofs. Earlier failed harness expectations are retained separately; this is not full-source, native or published acceptance."+}diff --git a/frontend-modern/src/components/Infrastructure/AvailabilityProbeStatusCard.tsx b/frontend-modern/src/components/Infrastructure/AvailabilityProbeStatusCard.tsxindex d4785c8a47..127abef8a1 100644--- a/frontend-modern/src/components/Infrastructure/AvailabilityProbeStatusCard.tsx+++ b/frontend-modern/src/components/Infrastructure/AvailabilityProbeStatusCard.tsx@@ -1,3 +1,4 @@+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { For, Show, createMemo } from 'solid-js';import { Activity, AlertCircle, Check } from 'lucide-solid';@@ -46,6 +47,7 @@ export function AvailabilityProbeStatusCards(props: AvailabilityProbeStatusCards}export function AvailabilityProbeStatusCard(props: AvailabilityProbeStatusCardProps) {+ const now = useRelativeTimeNow();const aggregateState = () => props.availability.aggregateState;const isUp = () =>aggregateState() ? aggregateState() === 'healthy' : props.availability.available === true;@@ -57,15 +59,18 @@ export function AvailabilityProbeStatusCard(props: AvailabilityProbeStatusCardPrconst ms = props.availability.latencyMillis;return typeof ms === 'number' && Number.isFinite(ms) && ms > 0 ? `${Math.round(ms)}ms` : null;};- const lastChecked = () => formatRelativeTime(props.availability.lastChecked);+ const lastChecked = () => formatRelativeTime(props.availability.lastChecked, { now: now() });const method = () => getAvailabilityProbeMethodLabel(props.availability);const presentation = () =>- getAvailabilityProbePresentation({- type: 'network-endpoint',- platformType: 'availability',- status: isUp() ? 'online' : isDown() ? 'offline' : 'unknown',- availability: props.availability,- });+ getAvailabilityProbePresentation(+ {+ type: 'network-endpoint',+ platformType: 'availability',+ status: isUp() ? 'online' : isDown() ? 'offline' : 'unknown',+ availability: props.availability,+ },+ new Date(now()),+ );const isStale = () => presentation()?.freshnessLabel === 'stale';const isFreshUp = () => isUp() && !isStale();const targetAddr = () => getAvailabilityProbeEndpointLabel(props.availability);@@ -124,7 +129,7 @@ export function AvailabilityProbeStatusCard(props: AvailabilityProbeStatusCardPrif (!value) return null;const expiry = new Date(value);if (!Number.isFinite(expiry.getTime())) return null;- const days = Math.ceil((expiry.getTime() - Date.now()) / 86_400_000);+ const days = Math.ceil((expiry.getTime() - now()) / 86_400_000);const date = expiry.toLocaleDateString(undefined, {day: 'numeric',month: 'short',@@ -223,7 +228,7 @@ export function AvailabilityProbeStatusCard(props: AvailabilityProbeStatusCardPr>{locationLabel(location)}</div>- <Show when={formatRelativeTime(location.lastChecked)}>+ <Show when={formatRelativeTime(location.lastChecked, { now: now() })}>{(checked) => <div class="text-[10px] text-muted">checked {checked()}</div>}</Show></div>diff --git a/frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsx b/frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsxindex b33ccd8116..8ff4de83f1 100644--- a/frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsx+++ b/frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsx@@ -1,3 +1,4 @@+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { Show, createEffect, createMemo, createSignal, onMount, type Component } from 'solid-js';import type { Resource } from '@/types/resource';import { isAgentlessAvailabilityResource } from '@/features/standalone/standalonePageModel';@@ -44,6 +45,7 @@ const sortTargets = (targets: readonly AvailabilityTarget[]): AvailabilityTarget[...targets].sort((left, right) => left.name.localeCompare(right.name));export const AvailabilitySettingsPanel: Component = () => {+ const now = useRelativeTimeNow();const location = useLocation();const navigate = useNavigate();const { resources } = useResources();@@ -201,7 +203,7 @@ export const AvailabilitySettingsPanel: Component = () => {<div class="flex flex-wrap items-center justify-between gap-3"><div class="min-w-0"><div class="text-sm font-semibold text-base-content">- {getAvailabilityTargetsSummary(targets(), resourceForTarget)}+ {getAvailabilityTargetsSummary(targets(), resourceForTarget, now())}</div><p class="mt-1 text-xs leading-5 text-muted">Monitor endpoint-only devices and services with ICMP, TCP, and HTTP probes.@@ -288,13 +290,18 @@ export const AvailabilitySettingsPanel: Component = () => {{target.name}</div><span- class={`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${getAvailabilityTargetStatusClass(target, resourceForTarget(target))}`}+ class={`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${getAvailabilityTargetStatusClass(target, resourceForTarget(target), now())}`}title={getAvailabilityTargetStatusTitle(target,resourceForTarget(target),+ now(),)}>- {getAvailabilityTargetStatusLabel(target)}+ {getAvailabilityTargetStatusLabel(+ target,+ resourceForTarget(target),+ now(),+ )}</span><Showwhen={getAvailabilityTargetProbeSourceLabel(target, probeAgentOptions())}diff --git a/frontend-modern/src/components/Settings/__tests__/AvailabilitySettingsPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/AvailabilitySettingsPanel.test.tsxindex edc8dd4772..a20eec2cf6 100644--- a/frontend-modern/src/components/Settings/__tests__/AvailabilitySettingsPanel.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/AvailabilitySettingsPanel.test.tsx@@ -268,3 +268,61 @@ describe('AvailabilitySettingsPanel', () => {);});});++it('ages loaded availability counts, copy and colour without another target read', async () => {+ const start = Date.parse('2026-10-10T12:00:00Z');+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: start });+ const availability = {+ targetId: 'clock-check',+ name: 'Clock check',+ protocol: 'tcp',+ address: 'clock.example.test',+ enabled: true,+ available: true,+ lastChecked: new Date(start).toISOString(),+ pollIntervalSeconds: 30,+ evidence: { validUntil: new Date(start + 10_000).toISOString() },+ };+ resourceMocks.resources = [+ {+ id: 'clock-check',+ type: 'network-endpoint',+ platformType: 'availability',+ sources: ['availability'],+ name: 'Clock check',+ lastSeen: start,+ status: 'online',+ availability,+ },+ ];+ vi.mocked(AvailabilityTargetsAPI.list)+ .mockClear()+ .mockResolvedValue([+ {+ id: 'clock-check',+ name: 'Clock check',+ address: 'clock.example.test',+ protocol: 'tcp',+ enabled: true,+ status: availability,+ },+ ]);+ try {+ const { container } = render(() => <AvailabilitySettingsPanel />);+ expect(await screen.findByText('1 enabled · 1 total')).toBeInTheDocument();+ expect(container.querySelector('span.bg-emerald-100')).not.toBeNull();+ expect(screen.getByText('Online')).toBeInTheDocument();+ vi.advanceTimersByTime(30_000);+ expect(screen.getByText('1 needs attention · 1 enabled')).toBeInTheDocument();+ expect(container.querySelector('span.bg-amber-100')).not.toBeNull();+ expect(screen.getByText('Stale')).toHaveAttribute(+ 'title',+ 'The last check is stale; it does not establish current availability.',+ );+ expect(screen.queryByText('Online')).not.toBeInTheDocument();+ expect(AvailabilityTargetsAPI.list).toHaveBeenCalledOnce();+ } finally {+ cleanup();+ vi.useRealTimers();+ }+});diff --git a/frontend-modern/src/components/Settings/__tests__/availabilitySettingsModel.test.ts b/frontend-modern/src/components/Settings/__tests__/availabilitySettingsModel.test.tsindex 024ef01073..5f3b8b3043 100644--- a/frontend-modern/src/components/Settings/__tests__/availabilitySettingsModel.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/availabilitySettingsModel.test.ts@@ -314,6 +314,50 @@ describe('availabilitySettingsModel', () => {expect(getAvailabilityTargetHealth(unavailable(2))).toBe('offline');});+ it('names expired loaded evidence without overriding pause or stopped-probe copy', () => {+ const start = Date.parse('2026-10-10T12:00:00Z');+ const check = target({+ status: {+ ...target(),+ targetId: 'mqtt-broker',+ available: true,+ aggregateState: 'healthy',+ expectedLocations: 2,+ lastChecked: new Date(start).toISOString(),+ },+ });+ const resource = {+ type: 'network-endpoint',+ platformType: 'availability',+ status: 'online',+ availability: {+ ...check.status,+ evidence: { validUntil: new Date(start + 10_000).toISOString() },+ },+ } as never;+ expect(getAvailabilityTargetStatusLabel(check, resource, start)).toBe(+ 'Available from all 2 locations',+ );+ expect(getAvailabilityTargetStatusLabel(check, resource, start + 30_000)).toBe('Stale');+ expect(+ getAvailabilityTargetStatusLabel({ ...check, enabled: false }, resource, start + 30_000),+ ).toBe('Paused');+ expect(+ getAvailabilityTargetStatusLabel(+ {+ ...check,+ status: {+ ...check.status!,+ outcome: 'indeterminate',+ lastError: 'no recent report from probe agent',+ },+ },+ resource,+ start + 30_000,+ ),+ ).toBe('No recent probe report');+ });+it('defers to the Machines status of the loaded resource', () => {const healthyTarget = target({status: {diff --git a/frontend-modern/src/components/Settings/availabilitySettingsModel.ts b/frontend-modern/src/components/Settings/availabilitySettingsModel.tsindex 9d8c09edd5..f0c54b5f0b 100644--- a/frontend-modern/src/components/Settings/availabilitySettingsModel.ts+++ b/frontend-modern/src/components/Settings/availabilitySettingsModel.ts@@ -106,10 +106,17 @@ export function getAvailabilityTargetAddressLabel(target: AvailabilityTarget): sreturn target.address;}-export function getAvailabilityTargetStatusLabel(target: AvailabilityTarget): string {+export function getAvailabilityTargetStatusLabel(+ target: AvailabilityTarget,+ resource?: Resource,+ nowMs: number = Date.now(),+): string {if (!target.enabled) return 'Paused';const status = target.status;if (!status) return 'Not checked yet';+ if (resource && getStandaloneResourceStatusIndicator(resource, nowMs).label === 'Stale') {+ return isProbeAgentStaleStatus(status) ? PROBE_AGENT_STALE_LABEL : 'Stale';+ }if (status.aggregateState === 'degraded') return 'Observation paths disagree';if (status.aggregateState === 'unknown') {return `${status.reportingLocations ?? 0}/${status.expectedLocations ?? status.locations?.length ?? 0} locations reporting`;@@ -152,10 +159,11 @@ const availabilityFailureThreshold = (target: AvailabilityTarget): number => {export function getAvailabilityTargetHealth(target: AvailabilityTarget,resource?: Resource,+ nowMs: number = Date.now(),): AvailabilityTargetHealth {if (!target.enabled) return 'paused';if (resource) {- const variant = getStandaloneResourceStatusIndicator(resource).variant;+ const variant = getStandaloneResourceStatusIndicator(resource, nowMs).variant;if (variant === 'success') return 'healthy';if (variant === 'warning') return 'attention';if (variant === 'danger') return 'offline';@@ -180,12 +188,16 @@ export function getAvailabilityTargetHealth(return thresholdReached ? 'offline' : 'attention';}-/** Hover text for a check that is failing but not yet offline. */+/** Explain stale evidence or a check that is failing but not yet offline. */export function getAvailabilityTargetStatusTitle(target: AvailabilityTarget,resource?: Resource,+ nowMs: number = Date.now(),): string | undefined {- if (getAvailabilityTargetHealth(target, resource) !== 'attention') return undefined;+ if (getAvailabilityTargetHealth(target, resource, nowMs) !== 'attention') return undefined;+ if (resource && getStandaloneResourceStatusIndicator(resource, nowMs).label === 'Stale') {+ return 'The last check is stale; it does not establish current availability.';+ }const status = target.status;const failures = status?.consecutiveFailures;if (status?.available !== false || typeof failures !== 'number' || failures <= 0) {@@ -206,8 +218,9 @@ const AVAILABILITY_HEALTH_CLASS: Record<AvailabilityTargetHealth, string> = {export function getAvailabilityTargetStatusClass(target: AvailabilityTarget,resource?: Resource,+ nowMs: number = Date.now(),): string {- return AVAILABILITY_HEALTH_CLASS[getAvailabilityTargetHealth(target, resource)];+ return AVAILABILITY_HEALTH_CLASS[getAvailabilityTargetHealth(target, resource, nowMs)];}/**@@ -230,10 +243,13 @@ export function getAvailabilityTargetProbeSourceLabel(export function getAvailabilityTargetsSummary(targets: readonly AvailabilityTarget[],resourceFor: (target: AvailabilityTarget) => Resource | undefined = () => undefined,+ nowMs: number = Date.now(),): string {if (targets.length === 0) return 'No availability checks configured';const enabled = targets.filter((target) => target.enabled).length;- const health = targets.map((target) => getAvailabilityTargetHealth(target, resourceFor(target)));+ const health = targets.map((target) =>+ getAvailabilityTargetHealth(target, resourceFor(target), nowMs),+ );const offline = health.filter((state) => state === 'offline').length;const attention = health.filter((state) => state === 'attention' || state === 'offline').length;if (attention === 0) return `${enabled} enabled · ${targets.length} total`;diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsxindex 9b3ba8e5e3..7b3ce1a7d3 100644--- a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx@@ -9,14 +9,14 @@ import {} from '@solidjs/testing-library';import { createSignal, Suspense } from 'solid-js';import type { WorkloadGuest } from '@/types/workloads';-import type { Memory, Disk, GuestNetworkInterface } from '@/types/api';+import type { Alert, Memory, Disk, GuestNetworkInterface } from '@/types/api';import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';import { getCanonicalWorkloadId, getWorkloadMetadataId } from '@/utils/workloads';import { resetAIRuntimeState, syncAIRuntimeSettings } from '@/stores/aiRuntimeState';import guestDrawerSource from './GuestDrawer.tsx?raw';import guestDrawerManageSource from './GuestDrawerManage.tsx?raw';import guestDrawerOverviewSource from './GuestDrawerOverview.tsx?raw';-import { getGuestDrawerHistoryRangeBounds } from './guestDrawerModel';+import { getGuestDrawerAlertAttention, getGuestDrawerHistoryRangeBounds } from './guestDrawerModel';// ── Mocks ──────────────────────────────────────────────────────────────@@ -2051,3 +2051,40 @@ describe('GuestDrawer', () => {});});});++it('forwards the mounted guest clock without changing the evaluated breach or clear rule', () => {+ const at = '2026-10-10T12:00:00Z';+ const alert = {+ id: 'held-cpu',+ resourceId: 'inst1-node1-100',+ resourceName: 'test-vm',+ node: 'node1',+ instance: 'inst1',+ type: 'cpu',+ message: 'Old breach',+ level: 'warning',+ value: 92,+ threshold: 80,+ startTime: at,+ acknowledged: false,+ metricStatus: {+ phase: 'latched',+ value: 72,+ unit: '%',+ observedAt: at,+ lastBreachAt: '2026-10-10T11:40:00Z',+ trigger: 80,+ recovery: 70,+ },+ } as Alert;+ const now = vi.fn(() => Date.parse(at) + 11 * 60_000);+ const copy = getGuestDrawerAlertAttention(+ alert,+ { guest: makeGuest(), memoryDisplayBasis: 'guest' },+ now,+ );+ expect(copy.message).toBe('Last reading: CPU 72%, 11 mins ago');+ expect(copy.detail).toBe('Stays open until it reaches 70% or lower.');+ expect(copy.title).toContain('Last reading at or above 80%: 92%, 31 mins ago');+ expect(now).toHaveBeenCalledOnce();+});diff --git a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsxindex cd4cd980f1..88325ccf66 100644--- a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx@@ -1,3 +1,4 @@+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { Show, Suspense, lazy } from 'solid-js';import { formatDiscoveryAge } from '@/api/discovery';@@ -75,6 +76,7 @@ interface GuestDrawerOverviewProps {}export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {+ const now = useRelativeTimeNow();const protectionPresentation = () =>getWorkloadsGuestProtectionPresentation({ageLabel: props.backupPresentation?.ageLabel,@@ -332,11 +334,15 @@ export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {<DrawerAttentionSectionitems={(props.alerts ?? []).map((alert) => ({id: alert.id,- ...getGuestDrawerAlertAttention(alert, {- guest: props.guest,- memoryDisplayBasis: props.memoryDisplayBasis,- parentMemoryTotal: props.parentMemoryTotal,- }),+ ...getGuestDrawerAlertAttention(+ alert,+ {+ guest: props.guest,+ memoryDisplayBasis: props.memoryDisplayBasis,+ parentMemoryTotal: props.parentMemoryTotal,+ },+ now,+ ),severity: alert.level,acknowledged: alert.acknowledged,}))}diff --git a/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx b/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsxindex 218cd127ba..3a8cfe813f 100644--- a/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx+++ b/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx@@ -1,3 +1,4 @@+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { TechnicalDetailsSection } from '@/components/shared/TechnicalDetailsDisclosure';import { DrawerAttentionSection } from '@/components/shared/DrawerAttentionSection';import {@@ -181,6 +182,7 @@ const toDetailRows = (rows: NodeOverviewRow[]): DetailRow[] =>);export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {+ const now = useRelativeTimeNow();const versionLabel = () => getNodeVersionLabel(props.node);const linkedAgentId = () => cleanText(props.node.linkedAgentId);const clusterLabel = () =>@@ -371,7 +373,7 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {<DrawerAttentionSectionitems={(props.alerts ?? []).map((alert) => ({id: alert.id,- ...getAlertAttentionCopy(alert),+ ...getAlertAttentionCopy(alert, now),subject:cleanText(alert.resourceName) ||cleanText(alert.nodeDisplayName) ||diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerOverview.clock.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerOverview.clock.test.tsxnew file mode 100644index 0000000000..8783312af1--- /dev/null+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerOverview.clock.test.tsx@@ -0,0 +1,91 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import type { ComponentProps } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type { Alert } from '@/types/api';+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';+import { METRIC_ALERT_STATUS_STALE_MS } from '@/features/alerts/metricAlertPresentation';+import { GuestDrawerOverview } from '../GuestDrawerOverview';++const start = Date.parse('2026-10-09T20:00:00Z');+const alert = {+ id: 'cpu-held',+ resourceId: 'lab:pve-a:101',+ resourceName: 'held-guest',+ type: 'cpu',+ level: 'warning',+ message: 'CPU above threshold',+ value: 92,+ threshold: 80,+ startTime: new Date(start - 60_000).toISOString(),+ acknowledged: false,+ node: 'pve-a',+ metricStatus: {+ phase: 'breaching',+ value: 91,+ unit: '%',+ observedAt: new Date(start - METRIC_ALERT_STATUS_STALE_MS + 5_000).toISOString(),+ trigger: 80,+ recovery: 75,+ },+} as Alert;+const props = {+ guest: {+ id: 'lab:pve-a:101',+ name: 'held-guest',+ vmid: 101,+ instance: 'lab',+ node: 'pve-a',+ type: 'qemu',+ status: 'running',+ memory: { total: 1024, used: 256, free: 768, usage: 25 },+ disk: { total: 1024, used: 256, usage: 25 },+ tags: [],+ cpu: 0.1,+ cpus: 1,+ networkIn: 0,+ networkOut: 0,+ diskRead: 0,+ diskWrite: 0,+ uptime: 3600,+ template: false,+ lastBackup: 0,+ lock: '',+ lastSeen: new Date(start).toISOString(),+ },+ guestOsSummary: '',+ agentHeading: '',+ agentLabel: '',+ agentTitle: '',+ hasAgentInfo: false,+ hasFilesystemDetails: false,+ hasNetworkInterfaces: false,+ hasOsInfo: false,+ hasWorkloadActionAgent: false,+ showInGuestAgentInstallCue: false,+ ipAddresses: [],+ networkInterfaces: [],+ normalizedTags: [],+ backupPresentation: null,+ workloadActionAgentTitle: '',+ alerts: [alert],+} as ComponentProps<typeof GuestDrawerOverview>;++describe('mounted guest drawer attention freshness', () => {+ beforeEach(() => {+ vi.useFakeTimers();+ vi.setSystemTime(start);+ });+ afterEach(() => {+ cleanup();+ vi.useRealTimers();+ });+ it('stops describing an old alert evaluation as now without changing the guest or alert', () => {+ render(() => <GuestDrawerOverview {...props} />);+ expect(screen.getByText('CPU 91%, above the 80% alert level')).toBeInTheDocument();+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);+ expect(screen.queryByText('CPU 91%, above the 80% alert level')).not.toBeInTheDocument();+ expect(screen.getByText('Last reading: CPU 91%, 10 mins ago')).toBeInTheDocument();+ vi.advanceTimersByTime(60_000);+ expect(screen.getByText('Last reading: CPU 91%, 11 mins ago')).toBeInTheDocument();+ });+});diff --git a/frontend-modern/src/components/Workloads/__tests__/NodeDrawerOverview.alertClock.test.tsx b/frontend-modern/src/components/Workloads/__tests__/NodeDrawerOverview.alertClock.test.tsxnew file mode 100644index 0000000000..ee54f7f282--- /dev/null+++ b/frontend-modern/src/components/Workloads/__tests__/NodeDrawerOverview.alertClock.test.tsx@@ -0,0 +1,92 @@+import { cleanup, render, screen, within } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';++import { NodeDrawerOverview } from '@/components/Workloads/NodeDrawerOverview';+import type { Alert, Node } from '@/types/api';++const OPENED_AT = Date.parse('2026-10-07T10:00:00Z');++const node = {+ id: 'homelab-minipc',+ name: 'minipc',+ instance: 'homelab',+ status: 'online',+ type: 'node',+ cpu: 0,+ memory: { total: 1024, used: 256, free: 768, usage: 25 },+ disk: { total: 1024, used: 256, free: 768, usage: 25 },+ uptime: 3600,+ loadAverage: [],+ kernelVersion: '6.8.12',+ pveVersion: 'pve-manager/9.0.1',+ cpuInfo: { model: 'CPU', cores: 4, sockets: 1, mhz: '2400' },+ lastSeen: '2026-10-07T09:59:00Z',+ connectionHealth: 'healthy',+} as unknown as Node;++// The node stopped reporting a minute before the drawer opened: the alert's+// live status, and every prop the drawer receives, never change again.+const heldTemperatureAlert: Alert = {+ id: 'homelab-minipc::metric-threshold:temperature',+ type: 'temperature',+ level: 'warning',+ resourceId: 'homelab-minipc',+ resourceName: 'minipc',+ node: 'minipc',+ instance: 'homelab',+ message: 'Node temperature at 80.0°C',+ value: 80,+ threshold: 80,+ startTime: '2026-10-07T09:40:00Z',+ lastSeen: new Date(OPENED_AT - 5 * 60_000).toISOString(),+ acknowledged: false,+ metricStatus: {+ phase: 'latched',+ value: 76,+ unit: '°C',+ observedAt: new Date(OPENED_AT - 60_000).toISOString(),+ trigger: 80,+ recovery: 75,+ recoveryDelaySeconds: 300,+ },+};++afterEach(() => {+ cleanup();+ vi.useRealTimers();+});++describe('NodeDrawerOverview alert attention clock', () => {+ it('turns a held reading stale and keeps its ages moving while the drawer stays open', () => {+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: OPENED_AT });++ render(() => <NodeDrawerOverview node={node} alerts={[heldTemperatureAlert]} />);+ const attention = within(screen.getByTestId('drawer-attention-section'));++ const live = attention.getByText('Temperature 76°C now, back under the 80°C alert level');+ expect(live).toHaveAttribute(+ 'title',+ expect.stringContaining('Last reading at or above 80°C: 80°C, 5 mins ago'),+ );++ // Past the ten-minute cut-off the reading is no longer "now".+ vi.advanceTimersByTime(10 * 60_000);+ expect(attention.queryByText(/now, back under/)).not.toBeInTheDocument();+ const stale = attention.getByText('Last reading: Temperature 76°C, 11 mins ago');+ expect(stale).toHaveAttribute(+ 'title',+ expect.stringContaining('Last reading at or above 80°C: 80°C, 15 mins ago'),+ );+ expect(+ attention.getByText(+ 'Stays open until it reaches 75°C or lower and stays there for 5 minutes.',+ ),+ ).toBeInTheDocument();++ vi.advanceTimersByTime(5 * 60_000);+ expect(attention.getByText('Last reading: Temperature 76°C, 16 mins ago')).toHaveAttribute(+ 'title',+ expect.stringContaining('Last reading at or above 80°C: 80°C, 20 mins ago'),+ );+ });+});diff --git a/frontend-modern/src/components/Workloads/guestDrawerModel.ts b/frontend-modern/src/components/Workloads/guestDrawerModel.tsindex adb5b4ca04..fb7bf2b107 100644--- a/frontend-modern/src/components/Workloads/guestDrawerModel.ts+++ b/frontend-modern/src/components/Workloads/guestDrawerModel.ts@@ -90,8 +90,9 @@ export const isGuestDrawerVM = (guest: Guest): guest is VM => resolveWorkloadTypexport const getGuestDrawerAlertAttention = (alert: Alert,context: Pick<GuestDrawerProps, 'guest' | 'memoryDisplayBasis' | 'parentMemoryTotal'>,+ now: () => number,): AlertAttentionCopy => {- const copy = getAlertAttentionCopy(alert);+ const copy = getAlertAttentionCopy(alert, now);if (context.memoryDisplayBasis !== 'host' || alert.type.trim().toLowerCase() !== 'memory') {return copy;}diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 819e739901..0e73232e75 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -8784,11 +8784,11 @@ describe('shared primitive guardrails', () => {'src/features/proxmox/ProxmoxMailGatewayDrawer.tsx',]) {const source = readFrontendSource(liveAlertConsumer);- expect(source).toContain('...getAlertAttentionCopy(alert)');+ expect(source).toContain('...getAlertAttentionCopy(alert, now)');expect(source).not.toContain('message: alert.message');}expect(readFrontendSource('src/components/Workloads/guestDrawerModel.ts')).toContain(- 'getAlertAttentionCopy(alert)',+ 'getAlertAttentionCopy(alert, now)',);const overviewConsumers = [diff --git a/frontend-modern/src/features/alerts/__tests__/helpers.test.ts b/frontend-modern/src/features/alerts/__tests__/helpers.test.tsindex 11c934217d..8b1298590d 100644--- a/frontend-modern/src/features/alerts/__tests__/helpers.test.ts+++ b/frontend-modern/src/features/alerts/__tests__/helpers.test.ts@@ -499,3 +499,35 @@ describe('held breach date consumers', () => {expect(getMetricAlertPresentation(alert, NOW)?.lastBreach).toContain('20 mins ago');});});++describe('clock subscription for attention copy', () => {+ it('does not read the clock for a non-metric alert', () => {+ const now = vi.fn(() => 0);+ expect(getAlertAttentionCopy({ type: 'offline', message: 'Offline', value: 0 }, now)).toEqual({+ message: 'Offline',+ });+ expect(now).not.toHaveBeenCalled();+ });+ it('reads the supplied clock for a held live status instead of the wall clock', () => {+ const observedAt = '2026-10-10T12:00:00Z';+ const now = vi.fn(() => Date.parse(observedAt) + 11 * 60_000);+ const copy = getAlertAttentionCopy(+ {+ type: 'temperature',+ message: 'Old breach',+ value: 80,+ metricStatus: {+ phase: 'latched',+ value: 76,+ unit: '°C',+ observedAt,+ trigger: 80,+ recovery: 75,+ },+ },+ now,+ );+ expect(copy.message).toBe('Last reading: Temperature 76°C, 11 mins ago');+ expect(now).toHaveBeenCalledOnce();+ });+});diff --git a/frontend-modern/src/features/alerts/metricAlertPresentation.ts b/frontend-modern/src/features/alerts/metricAlertPresentation.tsindex 5d15b67b27..463a061c5d 100644--- a/frontend-modern/src/features/alerts/metricAlertPresentation.ts+++ b/frontend-modern/src/features/alerts/metricAlertPresentation.ts@@ -125,7 +125,7 @@ export function getMetricAlertLastBreachAt(*/export function getMetricAlertPresentation(alert: Pick<Alert, 'type' | 'value' | 'lastSeen' | 'metricStatus' | 'metadata'>,- now: number = Date.now(),+ now: number,): MetricAlertPresentation | null {const status = alert.metricStatus;if (!isUsableStatus(status)) return null;@@ -200,9 +200,12 @@ export interface AlertAttentionCopy {/** Copy for an alert row in a drawer's "Needs attention" list. */export function getAlertAttentionCopy(alert: Pick<Alert, 'type' | 'message' | 'value' | 'lastSeen' | 'metricStatus' | 'metadata'>,- now: number = Date.now(),+ now: number | (() => number),): AlertAttentionCopy {- const presentation = getMetricAlertPresentation(alert, now);+ // Legacy/non-metric alerts do not subscribe their copy to the shared tick.+ const presentation = isUsableStatus(alert.metricStatus)+ ? getMetricAlertPresentation(alert, typeof now === 'function' ? now() : now)+ : null;if (!presentation) return { message: alert.message };return {message: presentation.summary,diff --git a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.tsindex da5df929d9..d40b0fa96d 100644--- a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts+++ b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts@@ -768,6 +768,8 @@ describe('platform overview layout guardrails', () => {for (const [name, source] of surfacesWithSharedToolbar) {const filterCount = (source.match(/<WorkloadsFilter\b/g) ?? []).length;expect(filterCount, `${name} should render exactly one <WorkloadsFilter>`).toBe(1);+ expect(source, `${name} names its workloads table even in kiosk`).toContain('tableTitle={');+ expect(source, `${name} uses an accessible table heading`).toContain('<h2');expect(source.indexOf('<WorkloadsFilter'),`${name} filter precedes the surface`,diff --git a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsxindex 6211981044..abc1b9b9ed 100644--- a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayDrawer.tsx@@ -1,3 +1,4 @@+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { For, Show, createMemo, createResource, type Component } from 'solid-js';import { DrawerAttentionSection } from '@/components/shared/DrawerAttentionSection';import { alertTypeDisplayLabel } from '@/features/alerts/helpers';@@ -230,6 +231,7 @@ export const ProxmoxMailGatewayDrawer: Component<{};const [instance, { refetch }] = createResource<PMGInstance | null, string>(id, fetchPMGInstance);+ const now = useRelativeTimeNow();const stats = createMemo(() => instance()?.mailStats);const quarantine = createMemo(() => instance()?.quarantine);const nodes = createMemo<PMGNodeStatus[]>(() => instance()?.nodes ?? []);@@ -352,7 +354,7 @@ export const ProxmoxMailGatewayDrawer: Component<{<DrawerAttentionSectionitems={(props.alerts ?? []).map((alert) => ({id: alert.id,- ...getAlertAttentionCopy(alert),+ ...getAlertAttentionCopy(alert, now),subject: name(),metric: alertTypeDisplayLabel(alert.type),severity: alert.level,diff --git a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsxindex 469b881f1e..f50cd36189 100644--- a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx@@ -1,3 +1,4 @@+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import {For,Show,@@ -217,6 +218,7 @@ export const ProxmoxNodesTable: Component<{const { activeAlerts } = useWebSocket();const alertsActivation = useAlertsActivation();const alertsEnabled = alertsActivation.detectionEnabled;+ const now = useRelativeTimeNow();const [selectedNodeId, setSelectedNodeId] = createSignal<string | null>(null);const layoutMode = createMemo(() => {const measuredWidth = props.layoutWidth?.();@@ -468,7 +470,7 @@ export const ProxmoxNodesTable: Component<{};const temperatureAlertTitle = () => {const alert = temperatureAlert();- const presentation = alert ? getMetricAlertPresentation(alert) : null;+ const presentation = alert ? getMetricAlertPresentation(alert, now()) : null;return presentation? `${presentation.summary}. ${presentation.detail}`: alert?.message;diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxMailGatewayDrawer.alertClock.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxMailGatewayDrawer.alertClock.test.tsxnew file mode 100644index 0000000000..233daaa6f5--- /dev/null+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxMailGatewayDrawer.alertClock.test.tsx@@ -0,0 +1,117 @@+import { cleanup, render, screen, within } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';++import type { Alert } from '@/types/api';+import type { Resource } from '@/types/resource';+import { ProxmoxMailGatewayDrawer } from '../ProxmoxMailGatewayDrawer';++vi.mock('@/utils/apiClient', () => ({+ apiFetch: vi.fn(async () => new Response(JSON.stringify(null), { status: 200 })),+}));++const OPENED_AT = Date.parse('2026-10-07T10:00:00Z');++const gateway = {+ id: 'pmg-unified-eu',+ type: 'pmg',+ name: 'mail-gateway-eu',+ displayName: 'mail-gateway-eu',+ platformType: 'proxmox-pmg',+ sourceType: 'api',+ status: 'online',+ lastSeen: OPENED_AT - 60_000,+ canonicalIdentity: {+ primaryId: 'agent:pmg-main',+ aliases: ['pmg-main', 'mail-gateway-eu'],+ },+ pmg: { instanceId: 'pmg-main', nodeCount: 1, mailCountTotal: 10, queueTotal: 3 },+} as unknown as Resource;++// A Pulse agent on the gateway host raises threshold alerts the row matches+// through its identity aliases. The host stopped reporting a minute before the+// drawer opened, so the alert's live status never changes again.+const heldCpuAlert: Alert = {+ id: 'agent:pmg-main::metric-threshold:cpu',+ type: 'cpu',+ level: 'warning',+ resourceId: 'agent:pmg-main',+ resourceName: 'mail-gateway-eu',+ node: 'mail-gateway-eu',+ instance: 'pmg-main',+ message: 'Host cpu at 93.0%',+ value: 93,+ threshold: 90,+ startTime: '2026-10-07T09:40:00Z',+ lastSeen: new Date(OPENED_AT - 5 * 60_000).toISOString(),+ acknowledged: false,+ metricStatus: {+ phase: 'latched',+ value: 72,+ unit: '%',+ observedAt: new Date(OPENED_AT - 60_000).toISOString(),+ trigger: 90,+ recovery: 80,+ },+};++afterEach(() => {+ cleanup();+ vi.useRealTimers();+});++describe('ProxmoxMailGatewayDrawer alert attention clock', () => {+ it('turns a held reading stale and keeps its ages moving while the drawer stays open', () => {+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: OPENED_AT });++ render(() => <ProxmoxMailGatewayDrawer instanceRow={gateway} alerts={[heldCpuAlert]} />);+ const attention = within(screen.getByTestId('drawer-attention-section'));++ expect(attention.getByText('CPU 72% now, back under the 90% alert level')).toHaveAttribute(+ 'title',+ expect.stringContaining('Last reading at or above 90%: 93%, 5 mins ago'),+ );++ // Past the ten-minute cut-off the reading is no longer "now".+ vi.advanceTimersByTime(10 * 60_000);+ expect(attention.queryByText(/now, back under/)).not.toBeInTheDocument();+ expect(attention.getByText('Last reading: CPU 72%, 11 mins ago')).toHaveAttribute(+ 'title',+ expect.stringContaining('Last reading at or above 90%: 93%, 15 mins ago'),+ );++ vi.advanceTimersByTime(5 * 60_000);+ expect(attention.getByText('Last reading: CPU 72%, 16 mins ago')).toHaveAttribute(+ 'title',+ expect.stringContaining('Last reading at or above 90%: 93%, 20 mins ago'),+ );+ });++ it('keeps a list of alerts without a live status in place across clock ticks', () => {+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: OPENED_AT });+ // Mail Gateway alerts come from their own checks and carry no live status,+ // so their copy never depends on the clock.+ const messageAge: Alert = {+ id: 'pmg-main::pmg-main-oldest-message',+ type: 'message-age',+ level: 'warning',+ resourceId: 'pmg-main',+ resourceName: 'mail-gateway-eu',+ node: 'https://pmg.example:8006',+ instance: 'pmg-main',+ message: 'PMG mail-gateway-eu has messages queued for 41 minutes (threshold: 30 minutes)',+ value: 41,+ threshold: 30,+ startTime: '2026-10-07T09:40:00Z',+ lastSeen: '2026-10-07T09:59:00Z',+ acknowledged: false,+ };++ render(() => <ProxmoxMailGatewayDrawer instanceRow={gateway} alerts={[messageAge]} />);+ const attention = within(screen.getByTestId('drawer-attention-section'));+ const row = attention.getByText(messageAge.message).closest('li');+ expect(row).not.toBeNull();++ vi.advanceTimersByTime(5 * 60_000);+ expect(attention.getByText(messageAge.message).closest('li')).toBe(row);+ });+});diff --git a/frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx b/frontend-modern/src/features/standalone/AvailabilityChecksTable.tsxindex 18506c5dc2..a99ccdc40d 100644--- a/frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx+++ b/frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx@@ -1,3 +1,4 @@+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { A } from '@solidjs/router';import {Show,@@ -122,12 +123,13 @@ export const AvailabilityChecksTable: Component<{onExternalStatusChange?: (status: PlatformResourceStatusFilter) => void;onResetFilters?: () => void;}> = (props) => {+ const now = useRelativeTimeNow();const tableState = createPlatformTableFilterState({resources: () => props.resources,initialStatus: 'all' as PlatformResourceStatusFilter,filter: (resources, search, status) =>filterPlatformResources(resources, search, status, (resource) => {- const variant = getStandaloneResourceStatusIndicator(resource).variant;+ const variant = getStandaloneResourceStatusIndicator(resource, now()).variant;if (variant === 'success') return 'online';if (variant === 'danger') return 'offline';return 'degraded';@@ -144,7 +146,9 @@ export const AvailabilityChecksTable: Component<{}tableState.resetFilters();};- const orderedChecks = createMemo(() => sortStandaloneResourcesByAttention(tableState.filtered()));+ const orderedChecks = createMemo(() =>+ sortStandaloneResourcesByAttention(tableState.filtered(), now()),+ );const historyTargetIDs = createMemo(() =>props.resources.map((resource) => availabilityFor(resource)?.targetId)@@ -321,8 +325,8 @@ export const AvailabilityChecksTable: Component<{<PlatformWindowedRows items={orderedChecks} estimatedRowHeight={32}>{(check) => {const availability = () => availabilityFor(check);- const probe = () => getAvailabilityProbePresentation(check);- const indicator = () => getStandaloneResourceStatusIndicator(check);+ const probe = () => getAvailabilityProbePresentation(check, new Date(now()));+ const indicator = () => getStandaloneResourceStatusIndicator(check, now());const method = () =>probe()?.methodLabel ?? availability()?.protocol ?? 'Probe';const result = () => probe()?.resultLabel ?? indicator().label;diff --git a/frontend-modern/src/features/standalone/AvailabilityFleetView.tsx b/frontend-modern/src/features/standalone/AvailabilityFleetView.tsxindex 7a8f963ce0..d4c43e896c 100644--- a/frontend-modern/src/features/standalone/AvailabilityFleetView.tsx+++ b/frontend-modern/src/features/standalone/AvailabilityFleetView.tsx@@ -1,3 +1,4 @@+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import { For, Show, createEffect, createMemo, createSignal, type Component } from 'solid-js';import RefreshCwIcon from 'lucide-solid/icons/refresh-cw';import { ResourceDetailDrawer } from '@/components/Infrastructure/ResourceDetailDrawer';@@ -226,6 +227,7 @@ export const AvailabilityFleetView: Component<{probeAgentOptions?: readonly ProbeAgentOption[];onRetryHistory?: () => void;}> = (props) => {+ const now = useRelativeTimeNow();const [selectedResourceId, setSelectedResourceId] = createSignal<string>();const selectedResource = createMemo(() =>props.resources.find((resource) => resource.id === selectedResourceId()),@@ -275,8 +277,8 @@ export const AvailabilityFleetView: Component<{<For each={props.resources}>{(resource) => {const availability = () => availabilityFor(resource);- const probe = () => getAvailabilityProbePresentation(resource);- const indicator = () => getStandaloneResourceStatusIndicator(resource);+ const probe = () => getAvailabilityProbePresentation(resource, new Date(now()));+ const indicator = () => getStandaloneResourceStatusIndicator(resource, now());const targetID = () => availability()?.targetId ?? resource.platformId ?? resource.id;const history = () => props.historyByTarget.get(targetID());const buckets = () => history()?.buckets ?? [];@@ -295,6 +297,7 @@ export const AvailabilityFleetView: Component<{formatRelativeTime(availability()?.lastChecked, {compact: true,emptyText: 'Not checked',+ now: now(),});const latency = () => {const value = availability()?.latencyMillis;diff --git a/frontend-modern/src/features/standalone/__tests__/AvailabilityChecksTable.clock.test.tsx b/frontend-modern/src/features/standalone/__tests__/AvailabilityChecksTable.clock.test.tsxnew file mode 100644index 0000000000..146d4e174d--- /dev/null+++ b/frontend-modern/src/features/standalone/__tests__/AvailabilityChecksTable.clock.test.tsx@@ -0,0 +1,96 @@+import { Route, Router } from '@solidjs/router';+import { cleanup, render, screen } from '@solidjs/testing-library';+import { createSignal } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type { Resource } from '@/types/resource';+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';+import { AvailabilityChecksTable } from '../AvailabilityChecksTable';++vi.mock('@/contexts/appRuntime', async (importOriginal) => ({+ ...(await importOriginal<typeof import('@/contexts/appRuntime')>()),+ useWebSocket: () => ({ activeAlerts: {} }),+}));+vi.mock('@/api/availabilityHistory', () => ({+ AvailabilityHistoryAPI: { batch: vi.fn(async () => ({ targets: [] })) },+}));++const start = Date.parse('2026-10-09T20:00:00Z');+const check = (id: string, validFor: number): Resource =>+ ({+ id,+ type: 'network-endpoint',+ name: id,+ displayName: id,+ status: 'online',+ lastSeen: start,+ platformType: 'availability',+ sources: ['availability'],+ availability: {+ targetId: id,+ protocol: 'tcp',+ address: `${id}.invalid`,+ port: 443,+ enabled: true,+ available: true,+ lastChecked: new Date(start).toISOString(),+ pollIntervalSeconds: 30,+ evidence: { validUntil: new Date(start + validFor).toISOString() },+ },+ }) as Resource;+const resources = [check('A-fresh', 180_000), check('Z-stalling', 10_000)];+function mount(status: 'all' | 'online' | 'degraded' = 'all') {+ const [filter, setFilter] = createSignal(status);+ const view = render(() => (+ <Router>+ <Route+ path="/"+ component={() => (+ <AvailabilityChecksTable+ resources={resources}+ emptyIcon={<span />}+ emptyTitle="No checks"+ emptyDescription="Add checks"+ externalStatus={filter}+ onExternalStatusChange={setFilter}+ />+ )}+ />+ </Router>+ ));+ return { ...view, setFilter };+}+const names = (container: HTMLElement) =>+ [...container.querySelectorAll('[data-availability-check-row]')].map((row) =>+ row.querySelector('[data-row-action]')?.getAttribute('aria-label'),+ );++describe('mounted availability check freshness', () => {+ beforeEach(() => {+ vi.useFakeTimers();+ vi.setSystemTime(start);+ });+ afterEach(() => {+ cleanup();+ vi.useRealTimers();+ });+ it('updates status, probe detail and attention ordering without a resource refresh', () => {+ const { container } = mount();+ expect(names(container)[0]).toContain('A-fresh');+ expect(container.querySelector('[title="Stale"]')).not.toBeInTheDocument();+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);+ expect(container.querySelector('[title="Stale"]')).toBeInTheDocument();+ expect(names(container)[0]).toContain('Z-stalling');+ const stale = container.querySelector('[data-availability-check-row="Z-stalling"]');+ expect(stale?.querySelector('[title*="stale"]')).not.toBeNull();+ });+ it('moves a stalled check from healthy to degraded filters on the shared tick', () => {+ const { setFilter } = mount('online');+ expect(screen.getByText('Z-stalling')).toBeInTheDocument();+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);+ expect(screen.queryByText('Z-stalling')).not.toBeInTheDocument();+ expect(screen.getByText('A-fresh')).toBeInTheDocument();+ setFilter('degraded');+ expect(screen.getByText('Z-stalling')).toBeInTheDocument();+ expect(screen.queryByText('A-fresh')).not.toBeInTheDocument();+ });+});diff --git a/frontend-modern/src/features/standalone/__tests__/AvailabilityViews.clock.test.tsx b/frontend-modern/src/features/standalone/__tests__/AvailabilityViews.clock.test.tsxnew file mode 100644index 0000000000..c0f6d4da42--- /dev/null+++ b/frontend-modern/src/features/standalone/__tests__/AvailabilityViews.clock.test.tsx@@ -0,0 +1,62 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';+import type { Resource } from '@/types/resource';+import { AvailabilityProbeStatusCard } from '@/components/Infrastructure/AvailabilityProbeStatusCard';+import { AvailabilityFleetView } from '../AvailabilityFleetView';++const start = Date.parse('2026-10-10T12:00:00Z');+const resource = {+ id: 'clock-service',+ type: 'network-endpoint',+ platformType: 'availability',+ sources: ['availability'],+ name: 'Clock service',+ displayName: 'Clock service',+ status: 'online',+ lastSeen: start,+ availability: {+ targetId: 'clock-service',+ name: 'Clock service',+ address: 'clock.example.test',+ protocol: 'https',+ enabled: true,+ available: true,+ lastChecked: new Date(start - 60_000).toISOString(),+ pollIntervalSeconds: 30,+ evidence: { validUntil: new Date(start + 10_000).toISOString() },+ },+} as Resource;++afterEach(() => {+ cleanup();+ vi.useRealTimers();+});++describe('availability views share the mounted freshness clock', () => {+ it('ages unchanged fleet evidence and switches its health without a refresh', () => {+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: start });+ const { container } = render(() => (+ <AvailabilityFleetView+ resources={[resource]}+ historyByTarget={new Map()}+ historyLoading={false}+ />+ ));+ expect(container.querySelector('[title="Stale"]')).toBeNull();+ expect(screen.getByText('Checked 1m ago')).toBeInTheDocument();+ vi.advanceTimersByTime(60_000);+ expect(container.querySelector('[title="Stale"]')).not.toBeNull();+ expect(screen.getByText('Checked 2m ago')).toBeInTheDocument();+ });++ it('ages an open probe card without changing its summary or source paths', () => {+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: start });+ render(() => <AvailabilityProbeStatusCard availability={resource.availability!} />);+ expect(screen.getByText('Up')).toBeInTheDocument();+ expect(screen.getByText('1 min ago')).toBeInTheDocument();+ vi.advanceTimersByTime(60_000);+ expect(screen.queryByText('Up')).not.toBeInTheDocument();+ expect(screen.getByText('Stale')).toBeInTheDocument();+ expect(screen.getByText('2 mins ago')).toBeInTheDocument();+ });+});diff --git a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx b/frontend-modern/src/features/vmware/VmwarePageSurface.tsxindex fe0b2ab24b..b948c83fcd 100644--- a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx+++ b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx@@ -531,6 +531,16 @@ function VmwareOverview(props: VmwareOverviewProps) {state={workloadsState}forcedPlatform={VMWARE_PLATFORM_FILTER}forcedViewMode="vm"+ tableTitle={+ <h2 class="text-[11px] font-semibold text-muted sm:text-xs">+ VMs+ <Show when={showSharedFilterToolbar()}>+ <span class="ml-1.5 font-normal tabular-nums">+ {workloadsState.filteredGuests().length}+ </span>+ </Show>+ </h2>+ }emptyStateTitle="No vSphere VMs"emptyStateDescription="Virtual machines appear here once the vCenter connection enumerates them."/>diff --git a/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx b/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsxindex ebb81d89d2..2e02ae8211 100644--- a/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx+++ b/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx@@ -1,4 +1,5 @@-import { cleanup, render, screen } from '@solidjs/testing-library';+import { createSignal, type JSX } from 'solid-js';+import { cleanup, render, screen, within } from '@solidjs/testing-library';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import type { Resource } from '@/types/resource';import { VmwarePageSurface } from '../VmwarePageSurface';@@ -76,7 +77,9 @@ vi.mock('@/components/Workloads/WorkloadsFilter', () => ({}));vi.mock('@/components/Workloads/WorkloadsSurface', () => ({- WorkloadsSurface: () => <div data-testid="workloads-surface" />,+ WorkloadsSurface: (props: { tableTitle?: JSX.Element }) => (+ <div data-testid="workloads-surface">{props.tableTitle}</div>+ ),}));vi.mock('@/components/Workloads/useWorkloadsState', () => ({@@ -131,6 +134,7 @@ describe('VmwarePageSurface contract', () => {surfaceConnected: () => false,surfaceInitialDataReceived: () => false,allGuests: () => [],+ filteredGuests: () => [],search: () => '',setSearch: vi.fn(),});@@ -160,6 +164,7 @@ describe('VmwarePageSurface contract', () => {surfaceConnected: () => true,surfaceInitialDataReceived: () => true,allGuests: () => [{ id: 'vm-app-01' }],+ filteredGuests: () => [{ id: 'vm-app-01' }],search: () => '',setSearch: vi.fn(),});@@ -173,6 +178,38 @@ describe('VmwarePageSurface contract', () => {).toBeTruthy();});+ it('titles the VM table through the tableTitle slot and counts the filtered rows', () => {+ setResources([makeResource({ id: 'vm-app-01', type: 'vm' })]);+ const [ready, setReady] = createSignal(false);+ const [filtered, setFiltered] = createSignal([{ id: 'vm-app-01' }, { id: 'vm-app-02' }]);+ mockUseWorkloadsState.mockReturnValue({+ surfaceConnected: ready,+ surfaceInitialDataReceived: ready,+ allGuests: () => [{ id: 'vm-app-01' }, { id: 'vm-app-02' }, { id: 'vm-app-03' }],+ filteredGuests: filtered,+ search: () => 'app',+ setSearch: vi.fn(),+ });++ // The mocked surface renders the slot unconditionally; the real one renders+ // it with the table or the empty card. Kiosk unmounts the filter bar that+ // otherwise introduces the table, so the title has to carry the name.+ render(() => <VmwarePageSurface />);+ const heading = () =>+ within(screen.getByTestId('workloads-surface')).getByRole('heading', { level: 2 });+ expect(heading()).toHaveTextContent(/^VMs$/);++ // Once the toolbar is ready the count is the filtered rows (2), not the+ // inventory (3), and it keeps following them.+ setReady(true);+ expect(heading()).toHaveTextContent(/^VMs\s*2$/);+ setFiltered([{ id: 'vm-app-01' }]);+ expect(heading()).toHaveTextContent(/^VMs\s*1$/);+ setFiltered([]);+ expect(heading()).toHaveTextContent(/^VMs\s*0$/);+ expect(screen.getAllByRole('heading', { level: 2 })).toHaveLength(1);+ });+it('surfaces stale in-guest agents on correlated vSphere VMs', () => {mockVersionInfo.mockReturnValue({version: 'v6.0.0-rc.6',diff --git a/frontend-modern/src/stores/__tests__/websocket-unified.test.ts b/frontend-modern/src/stores/__tests__/websocket-unified.test.tsindex 925f76d9fb..74d99c839d 100644--- a/frontend-modern/src/stores/__tests__/websocket-unified.test.ts+++ b/frontend-modern/src/stores/__tests__/websocket-unified.test.ts@@ -2370,6 +2370,94 @@ describe('websocket store unified resource contract', () => {}});+ it('clears availability summary fields a resource delta deletes', async () => {+ const { store, dispose } = await createStoreHarness();+ try {+ await waitForOpenTick();++ emitMessage({+ type: 'initialState',+ data: {+ connectedInfrastructure: [],+ resources: [+ {+ id: 'network-endpoint-shop',+ type: 'network-endpoint',+ name: 'Shop HTTPS',+ platformType: 'availability',+ sourceType: 'api',+ sources: ['availability'],+ status: 'offline',+ lastSeen: 100,+ availability: {+ targetId: 'shop-https',+ address: 'shop.example.test',+ protocol: 'https',+ path: '/health',+ applicationOutcome: 'failed',+ applicationStatusCode: 503,+ applicationFailureCode: 'http_status',+ enabled: true,+ available: false,+ consecutiveFailures: 3,+ lastError: 'HTTP 503 Service Unavailable',+ failureThreshold: 3,+ },+ },+ ],+ lastUpdate: 100,+ activeAlerts: [],+ recentlyResolved: [],+ },+ });++ // The server's JSON merge patch for a recovered check: omitempty fields+ // the new snapshot no longer carries arrive as explicit null deletions.+ emitMessage({+ type: 'rawData',+ data: {+ lastUpdate: 200,+ resourceDelta: {+ upserts: [+ {+ id: 'network-endpoint-shop',+ status: 'online',+ lastSeen: 200,+ availability: {+ applicationOutcome: 'passed',+ applicationStatusCode: 200,+ applicationFailureCode: null,+ available: true,+ consecutiveFailures: null,+ lastError: null,+ latencyMillis: 41,+ },+ },+ ],+ },+ },+ });++ const endpoint = store.state.resources.find(+ (resource) => resource.id === 'network-endpoint-shop',+ );+ expect(endpoint?.availability).toEqual({+ targetId: 'shop-https',+ address: 'shop.example.test',+ protocol: 'https',+ path: '/health',+ applicationOutcome: 'passed',+ applicationStatusCode: 200,+ enabled: true,+ available: true,+ latencyMillis: 41,+ failureThreshold: 3,+ });+ } finally {+ dispose();+ }+ });+it('accepts canonical alertResolved websocket payloads', async () => {const { store, dispose } = await createStoreHarness();try {diff --git a/frontend-modern/src/utils/__tests__/availabilityProbePresentation.test.ts b/frontend-modern/src/utils/__tests__/availabilityProbePresentation.test.tsindex 74f8452552..a831476b8d 100644--- a/frontend-modern/src/utils/__tests__/availabilityProbePresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/availabilityProbePresentation.test.ts@@ -237,3 +237,20 @@ describe('availabilityProbePresentation', () => {expect(presentation?.toneClassName).toContain('amber');});});++it('measures all probe ages from the supplied clock rather than Date.now', () => {+ const clock = new Date('2026-10-10T12:02:00Z');+ const probe = getAvailabilityProbePresentation(+ makeAvailabilityResource({+ availability: {+ protocol: 'https',+ available: false,+ lastChecked: '2026-10-10T12:01:00Z',+ lastSuccess: '2026-10-10T12:00:00Z',+ },+ }),+ clock,+ );+ expect(probe?.detailLabel).toContain('checked 1 min ago');+ expect(probe?.detailLabel).toContain('last success 2 mins ago');+});diff --git a/frontend-modern/src/utils/__tests__/resourceStateAdapters.availability-recovery.test.ts b/frontend-modern/src/utils/__tests__/resourceStateAdapters.availability-recovery.test.tsnew file mode 100644index 0000000000..870b61b9be--- /dev/null+++ b/frontend-modern/src/utils/__tests__/resourceStateAdapters.availability-recovery.test.ts@@ -0,0 +1,269 @@+import { describe, expect, it } from 'vitest';+import type { Resource, ResourceAvailabilityMeta } from '@/types/resource';+import { getAvailabilityProbePresentation } from '@/utils/availabilityProbePresentation';+import {+ mergeCanonicalResourceSnapshot,+ mergeCanonicalResourceDeltaSnapshot,+} from '../resourceStateAdapters';++// REST rows and the websocket baseline the store rebuilds from merge-patch+// deltas carry the availability summary as one whole check record whose+// failure, location and certificate fields are omitempty, so a field missing+// from a facet that is present means "no longer true", not "unchanged".+describe('resourceStateAdapters availability summary facet', () => {+ const failingHttpsCheck: ResourceAvailabilityMeta = {+ targetId: 'shop-https',+ name: 'Shop HTTPS',+ targetKind: 'service',+ address: 'shop.example.test',+ protocol: 'https',+ port: 443,+ path: '/health',+ probeOutcome: 'failed',+ transportOutcome: 'reachable',+ applicationOutcome: 'failed',+ applicationStatusCode: 503,+ applicationFailureCode: 'http_status',+ aggregateState: 'degraded',+ disagreement: true,+ expectedLocations: 2,+ reportingLocations: 2,+ enabled: true,+ available: false,+ lastChecked: '2026-10-07T12:00:00Z',+ lastSuccess: '2026-10-07T11:55:00Z',+ consecutiveFailures: 3,+ lastError: 'HTTP 503 Service Unavailable',+ failureThreshold: 3,+ pollIntervalSeconds: 30,+ timeoutMillis: 5000,+ correlationState: 'standalone',+ };+ const recoveredHttpsCheck: ResourceAvailabilityMeta = {+ targetId: 'shop-https',+ name: 'Shop HTTPS',+ targetKind: 'service',+ address: 'shop.example.test',+ protocol: 'https',+ port: 443,+ path: '/health',+ probeOutcome: 'reachable',+ transportOutcome: 'reachable',+ applicationOutcome: 'passed',+ applicationStatusCode: 200,+ aggregateState: 'healthy',+ expectedLocations: 2,+ reportingLocations: 2,+ enabled: true,+ available: true,+ lastChecked: '2026-10-07T12:01:00Z',+ lastSuccess: '2026-10-07T12:01:00Z',+ latencyMillis: 41,+ failureThreshold: 3,+ pollIntervalSeconds: 30,+ timeoutMillis: 5000,+ correlationState: 'standalone',+ };+ const endpointRow = (availability: ResourceAvailabilityMeta): Resource =>+ ({+ id: 'network-endpoint-shop',+ type: 'network-endpoint',+ name: 'Shop HTTPS',+ displayName: 'Shop HTTPS',+ platformId: 'shop-https',+ platformType: 'availability',+ sourceType: 'api',+ sources: ['availability'],+ status: availability.available ? 'online' : 'offline',+ lastSeen: Date.parse(availability.lastChecked ?? '2026-10-07T12:00:00Z'),+ availability,+ }) as Resource;++ it('drops a recovered check’s failure fields on snapshot and delta merges', () => {+ const [previous] = mergeCanonicalResourceSnapshot([endpointRow(failingHttpsCheck)], []);+ const incoming = endpointRow(recoveredHttpsCheck);++ const [snapshot] = mergeCanonicalResourceSnapshot([structuredClone(incoming)], [previous]);+ const [delta] = mergeCanonicalResourceDeltaSnapshot(+ [structuredClone(incoming)],+ [previous],+ new Set([incoming.id]),+ new Map([[incoming.id, ['status', 'lastSeen', 'availability']]]),+ );++ for (const merged of [snapshot, delta]) {+ expect(merged.availability).toEqual(recoveredHttpsCheck);+ expect((merged.platformData as Record<string, unknown> | undefined)?.availability).toEqual(+ recoveredHttpsCheck,+ );+ const presentation = getAvailabilityProbePresentation(+ merged,+ new Date('2026-10-07T12:01:10Z'),+ );+ expect(presentation?.detailLabel).not.toContain('failures');+ expect(presentation?.detailLabel).not.toContain('503');+ }+ });++ it('replaces a machine summary that switches to another attached check', () => {+ const passingTcpCheck: ResourceAvailabilityMeta = {+ targetId: 'db-1-postgres',+ linkedResourceId: 'agent-db-1',+ name: 'db-1 Postgres',+ targetKind: 'machine',+ address: '192.0.2.40',+ protocol: 'tcp',+ port: 5432,+ probeOutcome: 'reachable',+ transportOutcome: 'reachable',+ aggregateState: 'healthy',+ expectedLocations: 2,+ reportingLocations: 2,+ enabled: true,+ available: true,+ lastChecked: '2026-10-07T12:00:00Z',+ lastSuccess: '2026-10-07T12:00:00Z',+ latencyMillis: 3,+ failureThreshold: 3,+ pollIntervalSeconds: 30,+ timeoutMillis: 2000,+ correlationState: 'attached',+ };+ const failingIcmpCheck: ResourceAvailabilityMeta = {+ targetId: 'db-1-uptime-ping',+ linkedResourceId: 'agent-db-1',+ name: 'db-1 ping',+ targetKind: 'machine',+ address: '192.0.2.40',+ protocol: 'icmp',+ probeOutcome: 'failed',+ transportOutcome: 'unreachable',+ enabled: true,+ available: false,+ lastChecked: '2026-10-07T12:01:00Z',+ consecutiveFailures: 3,+ lastError: 'ping timed out',+ failureThreshold: 3,+ pollIntervalSeconds: 30,+ timeoutMillis: 2000,+ correlationState: 'attached',+ };+ // The backend orders checks by target id and, while both pass, keeps the+ // first as the summary; a confirmed ping outage outranks it.+ const passingIcmpCheck: ResourceAvailabilityMeta = {+ targetId: 'db-1-uptime-ping',+ linkedResourceId: 'agent-db-1',+ name: 'db-1 ping',+ targetKind: 'machine',+ address: '192.0.2.40',+ protocol: 'icmp',+ probeOutcome: 'reachable',+ transportOutcome: 'reachable',+ enabled: true,+ available: true,+ lastChecked: '2026-10-07T12:00:00Z',+ lastSuccess: '2026-10-07T12:00:00Z',+ latencyMillis: 1,+ failureThreshold: 3,+ pollIntervalSeconds: 30,+ timeoutMillis: 2000,+ correlationState: 'attached',+ };+ const machineRow = (checks: ResourceAvailabilityMeta[], summary: ResourceAvailabilityMeta) =>+ ({+ id: 'agent-db-1',+ type: 'agent',+ name: 'db-1',+ displayName: 'db-1',+ platformId: 'db-1',+ platformType: 'agent',+ sourceType: 'agent',+ sources: ['agent', 'availability'],+ status: 'online',+ lastSeen: Date.parse('2026-10-07T12:01:00Z'),+ agent: { agentId: 'agent-db-1', hostname: 'db-1' },+ availability: summary,+ availabilityChecks: checks,+ }) as Resource;++ const [previous] = mergeCanonicalResourceSnapshot(+ [machineRow([passingTcpCheck, passingIcmpCheck], passingTcpCheck)],+ [],+ );+ const incoming = machineRow([passingTcpCheck, failingIcmpCheck], failingIcmpCheck);++ const [snapshot] = mergeCanonicalResourceSnapshot([structuredClone(incoming)], [previous]);+ const [delta] = mergeCanonicalResourceDeltaSnapshot(+ [structuredClone(incoming)],+ [previous],+ new Set([incoming.id]),+ new Map([[incoming.id, ['availability']]]),+ );++ for (const merged of [snapshot, delta]) {+ expect(merged.availability).toEqual(failingIcmpCheck);+ expect((merged.platformData as Record<string, unknown> | undefined)?.availability).toEqual(+ failingIcmpCheck,+ );+ expect(merged.availabilityChecks).toEqual([passingTcpCheck, failingIcmpCheck]);+ }+ });++ it('drops the plural check mirror when the availability source is withdrawn', () => {+ const check: ResourceAvailabilityMeta = {+ targetId: 'db-1-icmp',+ linkedResourceId: 'agent-db-1',+ address: '192.0.2.40',+ protocol: 'icmp',+ enabled: true,+ available: true,+ lastChecked: '2026-10-07T12:00:00Z',+ correlationState: 'attached',+ };+ // REST hydration mirrors both facets into platformData.+ const restRow = {+ id: 'agent-db-1',+ type: 'agent',+ name: 'db-1',+ platformType: 'agent',+ sourceType: 'agent',+ sources: ['agent', 'availability'],+ status: 'online',+ lastSeen: Date.parse('2026-10-07T12:00:00Z'),+ availability: check,+ availabilityChecks: [check],+ platformData: {+ sources: ['agent', 'availability'],+ agent: { agentId: 'agent-db-1', hostname: 'db-1' },+ availability: check,+ availabilityChecks: [check],+ },+ } as unknown as Resource;+ // The check was deleted: the realtime row no longer lists the source.+ const realtimeRow = {+ id: 'agent-db-1',+ type: 'agent',+ name: 'db-1',+ platformType: 'agent',+ sourceType: 'agent',+ sources: ['agent'],+ status: 'online',+ lastSeen: Date.parse('2026-10-07T12:01:00Z'),+ platformData: {+ sources: ['agent'],+ agent: { agentId: 'agent-db-1', hostname: 'db-1' },+ },+ } as unknown as Resource;++ const [merged] = mergeCanonicalResourceSnapshot([realtimeRow], [restRow]);+ // Hydration merges the realtime projection over the REST cache once more.+ const [rehydrated] = mergeCanonicalResourceSnapshot([merged], [restRow]);++ for (const row of [merged, rehydrated]) {+ expect(row.availability).toBeUndefined();+ expect(row.availabilityChecks).toBeUndefined();+ expect((row.platformData as Record<string, unknown>).availability).toBeUndefined();+ expect((row.platformData as Record<string, unknown>).availabilityChecks).toBeUndefined();+ }+ });+});diff --git a/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts b/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.tsindex f318072289..3ce6af64b3 100644--- a/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts+++ b/frontend-modern/src/utils/__tests__/resourceStateAdapters.test.ts@@ -2404,3 +2404,31 @@ describe('fast merge path for metrics-only delta patches', () => {expect(ops.every((op) => op.key !== 'platformData' || op.leaf !== undefined)).toBe(true);});});++it('replaces recovered availability without replacing independent metrics', () => {+ const old = createNodeResource({+ sources: ['proxmox-pve', 'availability'],+ availability: {+ targetId: 'check',+ enabled: true,+ available: false,+ lastError: 'HTTP 503',+ consecutiveFailures: 3,+ },+ });+ const [previous] = mergeCanonicalResourceSnapshot([old], []);+ const incoming = {+ ...old,+ cpu: { current: 44 },+ availability: { targetId: 'check', enabled: true, available: true, latencyMillis: 4 },+ platformData: {+ sources: ['proxmox-pve', 'availability'],+ availability: { targetId: 'check', enabled: true, available: true, latencyMillis: 4 },+ },+ } as Resource;+ const [merged] = mergeCanonicalResourceSnapshot([incoming], [previous]);+ expect(merged.availability).toEqual(incoming.availability);+ expect(merged.cpu).toEqual({ current: 44 });+ expect(merged.memory).toEqual(previous.memory);+ expect(merged.disk).toEqual(previous.disk);+});diff --git a/frontend-modern/src/utils/availabilityProbePresentation.ts b/frontend-modern/src/utils/availabilityProbePresentation.tsindex 74bc43856c..c60da762e1 100644--- a/frontend-modern/src/utils/availabilityProbePresentation.ts+++ b/frontend-modern/src/utils/availabilityProbePresentation.ts@@ -226,7 +226,7 @@ const getFailureCountLabel = (availability: ResourceAvailabilityMeta): string |export const getAvailabilityProbePresentation = (resource: AvailabilityProbeResource,- now = new Date(),+ now = new Date(Date.now()),): AvailabilityProbePresentation | null => {const platformAvailability = resource.platformData?.availability asResourceAvailabilityMeta | undefined;@@ -241,14 +241,14 @@ export const getAvailabilityProbePresentation = (const freshnessLabel = getAvailabilityFreshnessLabel(availability, now);const correlationLabel = getAvailabilityCorrelationLabel(availability);const netIoLabel = targetLabel ? `${targetLabel}: ${resultLabel}` : resultLabel;- const checked = formatRelativeTime(availability.lastChecked);+ const checked = formatRelativeTime(availability.lastChecked, { now: now.getTime() });const failures = getFailureCountLabel(availability);const detailParts = [`${methodLabel} - ${resultLabel}`, freshnessLabel];if (checked) detailParts.push(`checked ${checked}`);if (correlationLabel) detailParts.push(correlationLabel);if (failures) detailParts.push(failures);if (availability.lastSuccess && availability.available === false) {- const lastSuccess = formatRelativeTime(availability.lastSuccess);+ const lastSuccess = formatRelativeTime(availability.lastSuccess, { now: now.getTime() });if (lastSuccess) detailParts.push(`last success ${lastSuccess}`);}if (availability.lastError) detailParts.push(availability.lastError);diff --git a/frontend-modern/src/utils/resourceStateAdapters.ts b/frontend-modern/src/utils/resourceStateAdapters.tsindex 7b7eeb6599..10029d926d 100644--- a/frontend-modern/src/utils/resourceStateAdapters.ts+++ b/frontend-modern/src/utils/resourceStateAdapters.ts@@ -210,7 +210,9 @@ const mergePlatformData = (? mergeProxmoxFacet(asRecord(incoming[key]), asRecord(existing[key])): key === 'agent'? mergeAgentFacet(asRecord(incoming[key]), asRecord(existing[key]))- : mergeRecord(asRecord(incoming[key]), asRecord(existing[key]));+ : key === 'availability'+ ? (asRecord(incoming[key]) ?? asRecord(existing[key]))+ : mergeRecord(asRecord(incoming[key]), asRecord(existing[key]));if (key === 'docker') {if (hasDockerFacetEvidence(nested)) {merged[key] = nested;@@ -224,6 +226,11 @@ const mergePlatformData = (}}+ // A departed availability source must not resurrect its check set from the mirror.+ if (!shouldKeepSourceFacet(incomingSources, 'availability')) {+ delete merged.availabilityChecks;+ }+for (const key of ['storage','physicalDisk',@@ -677,6 +684,18 @@ const mergeCanonicalSourceFacet = <T extends JsonRecord>(: mergeRecord(incomingFacet, existingFacet): incomingFacet;+// Availability summaries/check sets are complete records in REST and in the+// websocket baseline rebuilt from merge patches. Their optional failure,+// location and certificate fields are withdrawn by omission on recovery.+// Only an absent record retains enrichment, and only while its source remains.+const replaceCanonicalSourceFacet = <T>(+ incoming: T | undefined,+ existing: T | undefined,+ sources: string[] | undefined,+ ...sourceCandidates: string[]+): T | undefined =>+ incoming ?? (shouldKeepSourceFacet(sources, ...sourceCandidates) ? existing : undefined);+// A missing field alone can be a partial snapshot. Explicit unavailable raw// evidence plus no canonical metric means the producer has withdrawn memory;// retaining the previous display metric would hide that state.@@ -904,17 +923,18 @@ export const mergeCanonicalResource = (incoming: Resource, existing?: Resource):incomingSources,'truenas',) as Resource['truenas'],- availability: mergeCanonicalSourceFacet(- incoming.availability as JsonRecord | undefined,- existingCanonical.availability as JsonRecord | undefined,+ availability: replaceCanonicalSourceFacet(+ incoming.availability,+ existingCanonical.availability,incomingSources,'availability',- ) as Resource['availability'],- availabilityChecks:- incoming.availabilityChecks ??- (shouldKeepSourceFacet(incomingSources, 'availability')- ? existingCanonical.availabilityChecks- : undefined),+ ),+ availabilityChecks: replaceCanonicalSourceFacet(+ incoming.availabilityChecks,+ existingCanonical.availabilityChecks,+ incomingSources,+ 'availability',+ ),storage: mergeRecord(incoming.storage as JsonRecord | undefined,existingCanonical.storage as JsonRecord | undefined,