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
Withhold cached guest SMART readings when their scoped read fails
pulse-triage[bot]6644db95b719
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 7adf39f1af..01b09b1a2e 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -21,6 +21,29 @@## Purpose+### Guest SMART inspection withdraws a failed scoped read++A failed guest physical-disk resource read must not leave cached health words,+temperatures or open SMART/history panels presented as current below an error.+The guest consumer withholds that entire disk list until a successful scoped+read. It renders no response text, no zero-disk inference and no recovery action+against the guest. An explicit retry uses the same parent-scoped resource query;+pending retries stay focusable, announce their busy state and reject duplicate+activation. Failed retries keep the same control. Recovery shows only the newly+admitted records, with closed disk disclosures. A valid empty response says that+no records were returned, not that the guest has no disks. Uninstrumented guests+still get no empty card on first inspection.++When read failure or recovery removes focused content, focus returns to the+surviving inspection heading, including empty recovery. It must not steal focus+moved elsewhere, focus a hidden Overview or restore focus after leaving the guest.+`GuestPhysicalDisks.test.tsx` covers retained/open evidence, failure/pending/retry,+recovery/empty, literal-response suppression and focus ownership. Desktop/narrow+browser proof must exercise the actual resource reader through the guest drawer,+scoped failure, keyboard/touch retry, recovery and inspected pixels. Resource and+disk identity, auth, collection, thresholds, History targets and refresh cadence+are unchanged; this is truthful inspection, not native disk or guest recovery.+### Coverage keeps its evidence disclosure visible on phonesThe existing Coverage chevron remains visible at phone widths, with the shareddiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 10afaba743..d2b7cdca90 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -23,6 +23,29 @@ and sort the complete canonical change table while startup and ingestion wait.## Purpose+### Guest SMART inspection withdraws a failed scoped read++A failed guest physical-disk resource read must not leave cached health words,+temperatures or open SMART/history panels presented as current below an error.+The guest consumer withholds that entire disk list until a successful scoped+read. It renders no response text, no zero-disk inference and no recovery action+against the guest. An explicit retry uses the same parent-scoped resource query;+pending retries stay focusable, announce their busy state and reject duplicate+activation. Failed retries keep the same control. Recovery shows only the newly+admitted records, with closed disk disclosures. A valid empty response says that+no records were returned, not that the guest has no disks. Uninstrumented guests+still get no empty card on first inspection.++When read failure or recovery removes focused content, focus returns to the+surviving inspection heading, including empty recovery. It must not steal focus+moved elsewhere, focus a hidden Overview or restore focus after leaving the guest.+`GuestPhysicalDisks.test.tsx` covers retained/open evidence, failure/pending/retry,+recovery/empty, literal-response suppression and focus ownership. Desktop/narrow+browser proof must exercise the actual resource reader through the guest drawer,+scoped failure, keyboard/touch retry, recovery and inspected pixels. Resource and+disk identity, auth, collection, thresholds, History targets and refresh cadence+are unchanged; this is truthful inspection, not native disk or guest recovery.+### TrueNAS protection consumers do not repair malformed instantsThe Protection row, completion sorts and inline Started/Completed fields use thediff --git a/frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx b/frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsxindex 2358115dab..7290dd14d9 100644--- a/frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx+++ b/frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx@@ -1,7 +1,18 @@-import { For, Show, Suspense, createMemo, createSignal, lazy, type Component } from 'solid-js';+import {+ For,+ Show,+ Suspense,+ createEffect,+ createMemo,+ createSignal,+ lazy,+ onCleanup,+ type Component,+} from 'solid-js';import type { HistoryTimeRange } from '@/api/charts';import { getPhysicalDiskAlerts } from '@/components/Storage/physicalDiskAlertOwner';import { InfoCardFrame } from '@/components/shared/InfoCardFrame';+import { InlineNotice } from '@/components/shared/InlineNotice';import { useWebSocket } from '@/contexts/appRuntime';import { useUnifiedResources } from '@/hooks/useUnifiedResources';import {@@ -150,32 +161,93 @@ export const GuestPhysicalDisks: Component<{.resources().filter((resource) => resource.type === 'physical_disk' && resource.parentId === parentId);+ // A failed scoped read can leave cached rows in the shared resource hook.+ // Withdraw their health, temperatures and open charts together, not just add+ // an unavailable notice beside readings that still look current.+ const [hasShownInspection, setHasShownInspection] = createSignal(false);+ createEffect(() => {+ if (source.error() || disks().length > 0) setHasShownInspection(true);+ });+ let card: HTMLDivElement | undefined;+ let heading: HTMLHeadingElement | undefined;+ const retainInspectionFocus = (content: HTMLElement) => {+ onCleanup(() => {+ if (!content.contains(document.activeElement)) return;+ queueMicrotask(() => {+ if (+ !card?.isConnected ||+ props.historyEnabled === false ||+ document.activeElement !== document.body+ ) {+ return;+ }+ // The heading survives both read failure and recovery, including a+ // successful empty result. Never restore focus after leaving the guest.+ heading?.focus({ preventScroll: true });+ });+ });+ };+return (- <>- <Show when={source.error()}>- <p class="text-xs text-muted" role="status">- Physical disk details are unavailable.- </p>- </Show>- <Show when={disks().length > 0}>- <InfoCardFrame data-testid="guest-physical-disks">- <h3 class="mb-2 text-[11px] font-medium uppercase tracking-wide text-base-content">- Physical Disks & SMART ({disks().length})- </h3>- <div class="space-y-2">- <For each={disks()}>- {(disk) => (- <GuestPhysicalDiskRow- disk={disk}- alertResourceIds={props.alertResourceIds ?? []}- reportingAgentId={props.reportingAgentId}- historyEnabled={props.historyEnabled !== false}- />- )}- </For>- </div>- </InfoCardFrame>- </Show>- </>+ <Show when={hasShownInspection()}>+ <InfoCardFrame ref={card} data-testid="guest-physical-disks">+ <h3+ ref={heading}+ tabIndex={-1}+ class="mb-2 text-[11px] font-medium uppercase tracking-wide text-base-content"+ >+ Physical Disks & SMART+ <Show when={!source.error()}> ({disks().length})</Show>+ </h3>+ <Show+ when={Boolean(source.error())}+ fallback={+ <div ref={retainInspectionFocus} class="space-y-2">+ <Show when={disks().length === 0}>+ <p class="text-xs text-muted" role="status">+ No physical disk records were returned for this guest. This does not mean the+ guest has no disks.+ </p>+ </Show>+ <For each={disks()}>+ {(disk) => (+ <GuestPhysicalDiskRow+ disk={disk}+ alertResourceIds={props.alertResourceIds ?? []}+ reportingAgentId={props.reportingAgentId}+ historyEnabled={props.historyEnabled !== false}+ />+ )}+ </For>+ </div>+ }+ >+ <InlineNotice+ ref={retainInspectionFocus}+ tone="warning"+ role="status"+ aria-label="Physical disk read unavailable"+ class="text-xs"+ >+ <p>Physical disk details are unavailable.</p>+ <p>+ Previously shown disk readings are withheld until this read succeeds. This does not+ establish that disks are absent or healthy.+ </p>+ <button+ type="button"+ aria-label="Retry physical disk read"+ aria-disabled={source.loading()}+ class="min-h-11 rounded-sm px-2 font-semibold underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current"+ onClick={() => {+ if (!source.loading()) void source.refetch().catch(() => undefined);+ }}+ >+ {source.loading() ? 'Retrying…' : 'Retry physical disk read'}+ </button>+ </InlineNotice>+ </Show>+ </InfoCardFrame>+ </Show>);};diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsxindex 09a178f6b4..d99afba6c1 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx@@ -1,5 +1,5 @@import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';-import { createSignal } from 'solid-js';+import { batch, createSignal } from 'solid-js';import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';import { AlertsAPI } from '@/api/alerts';import { useAlertsActivation } from '@/stores/alertsActivation';@@ -13,6 +13,9 @@ const queryState = vi.hoisted(() => ({// Set to a signal accessor to drive live resource updates.accessor: undefined as (() => Resource[]) | undefined,error: undefined as unknown,+ errorAccessor: undefined as (() => unknown) | undefined,+ loading: () => false as boolean,+ refetch: vi.fn<() => Promise<Resource[]>>(),query: '',enabled: false,realtimeEnabled: undefined as (() => boolean) | undefined,@@ -56,7 +59,9 @@ vi.mock('@/hooks/useUnifiedResources', () => ({queryState.realtimeEnabled = options.realtimeEnabled;return {resources: () => (queryState.accessor ? queryState.accessor() : queryState.resources),- error: () => queryState.error,+ error: () => queryState.errorAccessor?.() ?? queryState.error,+ loading: () => queryState.loading(),+ refetch: () => queryState.refetch(),};},}));@@ -94,6 +99,9 @@ describe('GuestPhysicalDisks', () => {queryState.resources = [];queryState.accessor = undefined;queryState.error = undefined;+ queryState.errorAccessor = undefined;+ queryState.loading = () => false;+ queryState.refetch.mockReset().mockResolvedValue([]);queryState.query = '';queryState.enabled = false;queryState.realtimeEnabled = undefined;@@ -321,4 +329,152 @@ describe('GuestPhysicalDisks', () => {render(() => <GuestPhysicalDisks parentId="vm-resource-101" />);expect(screen.getByRole('status')).toHaveTextContent('Physical disk details are unavailable.');});++ it('withholds cached health, temperatures and open charts after a scoped read fails', async () => {+ const [error, setError] = createSignal<unknown>();+ queryState.errorAccessor = error;+ queryState.resources = [disk];+ render(() => <GuestPhysicalDisks parentId="vm-resource-101" />);+ const row = screen.getByTestId('guest-physical-disk') as HTMLDetailsElement;+ row.open = true;+ fireEvent(row, new Event('toggle'));+ await screen.findByTestId('history-chart');+ row.querySelector('summary')!.focus();++ setError(new Error('private provider response must not render'));+ expect(screen.getByRole('status')).toHaveTextContent('Physical disk details are unavailable.');+ expect(screen.getByRole('status')).toHaveTextContent(+ 'This does not establish that disks are absent or healthy.',+ );+ expect(screen.queryByTestId('guest-physical-disk')).toBeNull();+ expect(screen.queryByTestId('disk-drawer-overview')).toBeNull();+ expect(screen.queryByTestId('history-chart')).toBeNull();+ expect(screen.queryByText('Healthy')).toBeNull();+ expect(screen.queryByText('45°C')).toBeNull();+ expect(screen.queryByText('private provider response must not render')).toBeNull();+ expect(screen.getByRole('heading', { name: 'Physical Disks & SMART' })).not.toHaveTextContent(+ '(0)',+ );+ await waitFor(() =>+ expect(screen.getByRole('heading', { name: 'Physical Disks & SMART' })).toHaveFocus(),+ );+ });++ it('keeps a pending/failed retry focusable and restores only the successful scoped read', async () => {+ const [error, setError] = createSignal<unknown>(new Error('unavailable'));+ const [loading, setLoading] = createSignal(false);+ const [resources, setResources] = createSignal([disk]);+ queryState.errorAccessor = error;+ queryState.loading = loading;+ queryState.accessor = resources;+ let settle!: () => void;+ queryState.refetch.mockImplementation(() => {+ setLoading(true);+ return new Promise<Resource[]>((resolve, reject) => {+ settle = () => {+ setLoading(false);+ reject(new Error('unavailable'));+ };+ });+ });+ render(() => <GuestPhysicalDisks parentId="vm-resource-101" />);+ const retry = screen.getByRole('button', { name: 'Retry physical disk read' });+ retry.focus();+ fireEvent.click(retry);+ expect(retry).toHaveTextContent('Retrying…');+ expect(retry).toHaveAttribute('aria-disabled', 'true');+ expect(retry).not.toBeDisabled();+ fireEvent.click(retry);+ expect(queryState.refetch).toHaveBeenCalledTimes(1);+ expect(screen.queryByTestId('guest-physical-disk')).toBeNull();+ settle();+ await waitFor(() => expect(retry).toHaveTextContent('Retry physical disk read'));+ expect(retry).toHaveFocus();+ expect(retry).toHaveAttribute('aria-disabled', 'false');++ queryState.refetch.mockImplementationOnce(async () => {+ batch(() => {+ setResources([{ ...disk, physicalDisk: { ...disk.physicalDisk!, temperature: 47 } }]);+ setError(undefined);+ });+ return resources();+ });+ fireEvent.click(retry);+ await waitFor(() => expect(screen.getByText('47°C')).toBeInTheDocument());+ expect(queryState.refetch).toHaveBeenCalledTimes(2);+ expect(screen.queryByRole('button', { name: 'Retry physical disk read' })).toBeNull();+ expect(screen.queryByText('45°C')).toBeNull();+ expect(screen.getByTestId('guest-physical-disk')).not.toHaveAttribute('open');+ await waitFor(() =>+ expect(screen.getByRole('heading', { name: 'Physical Disks & SMART (1)' })).toHaveFocus(),+ );+ });++ it('distinguishes a successful empty retry from both failed reads and physical disk absence', async () => {+ const [error, setError] = createSignal<unknown>(new Error('unavailable'));+ const [resources, setResources] = createSignal([disk]);+ queryState.errorAccessor = error;+ queryState.accessor = resources;+ queryState.refetch.mockImplementationOnce(async () => {+ batch(() => {+ setResources([]);+ setError(undefined);+ });+ return [];+ });+ render(() => <GuestPhysicalDisks parentId="vm-resource-101" />);+ const retry = screen.getByRole('button', { name: 'Retry physical disk read' });+ retry.focus();+ fireEvent.click(retry);+ expect(screen.getByRole('status')).toHaveTextContent(+ 'No physical disk records were returned for this guest. This does not mean the guest has no disks.',+ );+ expect(screen.queryByText('Physical disk details are unavailable.')).toBeNull();+ expect(screen.queryByTestId('guest-physical-disk')).toBeNull();+ await waitFor(() =>+ expect(screen.getByRole('heading', { name: 'Physical Disks & SMART (0)' })).toHaveFocus(),+ );+ });++ it.each(['elsewhere', 'hidden', 'disposed'] as const)(+ 'does not reclaim focus on recovery when the inspection is %s',+ async (scenario) => {+ const [error, setError] = createSignal<unknown>(new Error('unavailable'));+ const [shown, setShown] = createSignal(true);+ queryState.errorAccessor = error;+ queryState.resources = [disk];+ const rendered = render(() => (+ <>+ <button type="button">Outside inspection</button>+ <GuestPhysicalDisks parentId="vm-resource-101" historyEnabled={shown()} />+ </>+ ));+ const retry = screen.getByRole('button', { name: 'Retry physical disk read' });+ retry.focus();+ if (scenario === 'elsewhere')+ screen.getByRole('button', { name: 'Outside inspection' }).focus();+ if (scenario === 'hidden') setShown(false);+ if (scenario === 'disposed') rendered.unmount();+ const active = document.activeElement;+ setError(undefined);+ await Promise.resolve();+ expect(document.activeElement).toBe(active);+ },+ );++ it('keeps admitted rows during an ordinary pending refresh and withdraws valid empty results', () => {+ const [loading, setLoading] = createSignal(false);+ const [resources, setResources] = createSignal([disk]);+ queryState.loading = loading;+ queryState.accessor = resources;+ render(() => <GuestPhysicalDisks parentId="vm-resource-101" />);+ const summary = screen.getByTestId('guest-physical-disk').querySelector('summary');+ setLoading(true);+ expect(screen.getByText('Healthy')).toBeInTheDocument();+ expect(screen.getByTestId('guest-physical-disk').querySelector('summary')).toBe(summary);+ setLoading(false);+ setResources([]);+ expect(screen.queryByTestId('guest-physical-disk')).toBeNull();+ expect(screen.getByRole('status')).toHaveTextContent('No physical disk records were returned');+ });});