Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep default drawer History values at one stored time

pulse-triage[bot]58d6e6d59189
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 1511069f29..88ca0ec11e 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1145,6 +1145,17 @@ reading, timestamp or chart geometry. A successful empty read says `No stored
history in this range`; it does not imply that collection is running or that
changing provider configuration will produce a sample. Zero remains a valid
reported reading, while an absent metric remains unavailable.
+When a panel has stored observations, its default legend uses the newest
+stored timestamp across that panel and shows only values actually observed at
+that time. It labels the time `Latest stored`; missing sibling series remain
+dashes, with a visible explanation, rather than borrowing an older series value
+or a live/retained fallback. Pointer and keyboard inspection use the same
+single-time rule, and leaving inspection restores that default. Each panel owns
+its own timestamp. Only a panel with no stored observations may show explicitly
+qualified current, last-known or unknown-freshness fallback values.
+`GuestDrawerHistory.readout.test.tsx` verifies the default, fallback transition,
+zero, panel independence, inspection, refresh and access-denial boundaries;
+the existing pointer and sparse controls preserve dated interaction and geometry.
A lone stored series renders one point at its actual timestamp and value,
including measured zero, never an invented line. A group with one observation
time exposes that date visibly with `Single observation. No trend yet.` and
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 5926197054..bbda325c7f 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -4033,6 +4033,14 @@ unchanged cap and no live-recovery read. `guestHistorySegments.test.ts` pins
complete point preservation at the existing request bound. Neither claims a
timing benchmark, fleet CPU attribution or native incident relief.
+The default stored-history legend resolves one latest timestamp from that
+same bounded, normalized panel index, then looks up each configured series at
+that time. It does not join unrelated latest or live values, add collection or
+fetch missing siblings. The 240-point cap, 30-second poll, query coordinates,
+cache and segment geometry remain unchanged. Mounted readout, pointer and
+sparse controls verify only explicit query refreshes and correctly qualified
+empty-panel fallback; this is not a timing or native-recovery claim.
+
### Accessible Workloads backup evidence
diff --git a/frontend-modern/browser-verification/0ba526b75fdea666.json b/frontend-modern/browser-verification/0ba526b75fdea666.json
new file mode 100644
index 0000000000..412bb8e8de
--- /dev/null
+++ b/frontend-modern/browser-verification/0ba526b75fdea666.json
@@ -0,0 +1,53 @@
+{
+ "version": 1,
+ "result": "passed",
+ "base_sha": "31aba74aac9f63a28ff9953ae657dcd0c32db7da",
+ "changed_paths": ["frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx"],
+ "content_sha256": {
+ "frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx": "c24203dcf80299d91be2ebd31d326a5fc5479ad49776e7e390a4d77d6c926c58"
+ },
+ "routes": [
+ "/tmp/history-readout/index.html (isolated real Workloads and canonical VM/LXC drawers; no added product route)"
+ ],
+ "states": [
+ "mixed stored times with missing siblings and live carriers",
+ "aligned single observations with real zero",
+ "panel-local network/disk times",
+ "transient 503 retains dated history",
+ "403 withdraws history",
+ "empty panel explicitly qualified current fallback"
+ ],
+ "interactions": [
+ "Open real History tab in both drawers for VM and LXC",
+ "native Home/ArrowRight keyboard and WebKit touch slider; blur returns latest stored time",
+ "explicit real ChartsAPI refresh and retry; no writes",
+ "inspect six captured images with native view_image"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "verified_at": "2026-10-12T15:21:28.907992Z",
+ "proof_scope": "Synthetic read-only ChartsAPI wire responses through real Workloads and canonical VM/LXC drawers, production History and CSS. No collection/native/release acceptance.",
+ "browser_proof": {
+ "checks": 48,
+ "loaded_production_hashes": 254,
+ "captures": 6,
+ "client_exit": 0,
+ "playwright": "1.56.1",
+ "browser_cleanup": {
+ "desktop-light": "context closed",
+ "desktop-light-browser": "closed",
+ "phone-dark": "context closed",
+ "phone-dark-browser": "closed",
+ "server": "closed"
+ },
+ "bound_dossier": "RECEIPTS.md / browser/result.json and native-image-review.json"
+ }
+}
diff --git a/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx b/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx
index d0c984b89c..7fd47fc07b 100644
--- a/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx
+++ b/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx
@@ -259,6 +259,10 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>
? null
: findClosestGuestDrawerHistoryTimestamp(observationTimes(), hovered);
});
+ // The default legend is a single dated observation too. Independent latest
+ // values would combine different times (or a live fallback) into a tuple
+ // which never existed, disagreeing with the chart's accessible description.
+ const readoutTimestamp = createMemo(() => activeTimestamp() ?? observationTimes().at(-1) ?? null);
const observationValueText = (timestamp: number | undefined): string => {
if (timestamp === undefined) return 'No stored history observations.';
const values = series().map((item) => {
@@ -327,25 +331,16 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>
.filter((item): item is NonNullable<typeof item> => item !== null);
});
const hoverX = createMemo(() => hoveredSeries()[0]?.x ?? null);
- const hoveredByMetric = createMemo(() => {
- const byMetric = new Map<string, ReturnType<typeof hoveredSeries>[number]>();
- for (const item of hoveredSeries()) {
- byMetric.set(item.metric, item);
- }
- return byMetric;
- });
const displaySeries = createMemo(() =>
series().map((item, index) => {
- const hovered = hoveredByMetric().get(item.metric);
+ const timestamp = readoutTimestamp();
+ const point = item.points.find((point) => point.timestamp === timestamp);
const deferred = props.deferredMetrics?.[item.metric];
const fallbackValue = deferred
? deferred.lastKnownValue
: props.currentMetrics?.[item.metric];
const isFallback =
- activeTimestamp() === null &&
- item.points.length === 0 &&
- typeof fallbackValue === 'number' &&
- Number.isFinite(fallbackValue);
+ timestamp === null && typeof fallbackValue === 'number' && Number.isFinite(fallbackValue);
return {
...item,
deferred,
@@ -353,21 +348,25 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>
isCurrent: isFallback && !deferred,
isLastKnown: isFallback && Boolean(deferred) && !deferred?.valueLabel,
isUnknown: isFallback && deferred?.valueLabel === 'freshness unknown',
- valueLabel: hovered
- ? getGuestDrawerHistoryValueLabel([hovered.point], item.unit)
- : activeTimestamp() !== null
+ valueLabel: point
+ ? getGuestDrawerHistoryValueLabel([point], item.unit)
+ : timestamp !== null
? '-'
- : item.points.length > 0
- ? getGuestDrawerHistoryValueLabel(item.points, item.unit)
- : typeof fallbackValue === 'number' && Number.isFinite(fallbackValue)
- ? formatHistoryChartTooltipValue(fallbackValue, item.unit)
- : '-',
+ : typeof fallbackValue === 'number' && Number.isFinite(fallbackValue)
+ ? formatHistoryChartTooltipValue(fallbackValue, item.unit)
+ : '-',
};
}),
);
- const hoverTimeLabel = createMemo(() => {
- const timestamp = activeTimestamp();
- return timestamp === null ? '' : formatHistoryChartTimeLabel(timestamp, props.range);
+ const readoutTime = createMemo(() => {
+ const timestamp = readoutTimestamp();
+ if (timestamp === null) return null;
+ const date = new Date(timestamp);
+ return {
+ label: formatHistoryChartTimeLabel(timestamp, props.range),
+ dateTime: date.toISOString(),
+ fullLabel: date.toLocaleString(),
+ };
});
const handleHoverMove = (event: MouseEvent & { currentTarget: SVGSVGElement }) => {
@@ -395,18 +394,22 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>
data-history-group={props.group.id}
>
<div class="mb-2 flex flex-wrap items-start justify-between gap-x-4 gap-y-1">
- <div class="inline-flex items-baseline gap-2">
+ <div class="flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1">
<h4 class="text-xs font-semibold uppercase tracking-wide text-muted">
{props.group.label}
</h4>
- <Show when={hoverTimeLabel()}>
- {(label) => (
- <span
+ <Show when={readoutTime()}>
+ {(time) => (
+ <time
class="text-[10px] font-semibold tabular-nums text-base-content"
data-testid="guest-history-hover-time"
+ dateTime={time().dateTime}
+ title={time().fullLabel}
+ aria-label={`Stored observation: ${time().fullLabel}`}
>
- {label()}
- </span>
+ {activeTimestamp() === null ? 'Latest stored · ' : 'Stored · '}
+ {time().label}
+ </time>
)}
</Show>
</div>
@@ -440,6 +443,14 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>
</div>
</div>
+ <Show
+ when={
+ readoutTimestamp() !== null && displaySeries().some((item) => item.valueLabel === '-')
+ }
+ >
+ <p class="mb-2 text-xs text-muted">A dash means no stored observation at this time.</p>
+ </Show>
+
<For each={displaySeries().filter((item) => item.deferred)}>
{(item) => (
<p
diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.pointer.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.pointer.test.tsx
index 7474afe6be..402718bf58 100644
--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.pointer.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.pointer.test.tsx
@@ -89,7 +89,10 @@ describe('GuestDrawerHistory common-time pointer inspection', () => {
fireEvent.pointerLeave(plot);
expect(utilization()).toHaveTextContent('CPU43.0%');
expect(utilization()).toHaveTextContent('Memory55.0%');
- expect(within(utilization()).queryByTestId('guest-history-hover-time')).toBeNull();
+ expect(within(utilization()).getByTestId('guest-history-hover-time')).toHaveTextContent(
+ 'Latest stored',
+ );
+ expect(utilization()).toHaveTextContent('Disk-');
});
it('can inspect a lone zero observation without drawing a synthetic trend', async () => {
diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.readout.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.readout.test.tsx
new file mode 100644
index 0000000000..ec20cbcb2c
--- /dev/null
+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.readout.test.tsx
@@ -0,0 +1,188 @@
+import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { ChartsAPI, type AllMetricsHistoryResponse } from '@/api/charts';
+import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';
+import { GuestDrawerHistory } from '../GuestDrawerHistory';
+
+vi.mock('@/stores/license', () => ({
+ loadRuntimeCapabilities: vi.fn(async () => undefined),
+ maxHistoryDays: () => 90,
+ isRangeLocked: () => false,
+}));
+afterEach(() => {
+ cleanup();
+ resetCreateNonSuspendingQueryCacheForTest();
+ vi.restoreAllMocks();
+});
+
+const start = Date.UTC(2026, 9, 12, 12);
+const target = { resourceType: 'vm' as const, resourceId: 'fixture:pve:101' };
+const point = (minute: number, value: number) => ({
+ timestamp: start + minute * 60_000,
+ value,
+ min: value,
+ max: value,
+});
+const response = (
+ metrics: AllMetricsHistoryResponse['metrics'] = {
+ cpu: [point(0, 12), point(2, 22)],
+ memory: [point(1, 95)],
+ },
+): AllMetricsHistoryResponse => ({
+ ...target,
+ range: '1h',
+ start,
+ end: start + 60 * 60_000,
+ source: 'store',
+ metrics,
+});
+const group = (id = 'utilization') =>
+ screen.getAllByTestId('guest-history-group-chart').find((el) => el.dataset.historyGroup === id)!;
+const readoutTime = (id = 'utilization') =>
+ within(group(id)).getByTestId('guest-history-hover-time');
+const refresh = () => fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));
+const ready = () => screen.findByRole('slider', { name: 'Inspect Utilization history' });
+
+describe('drawer History default readout belongs to one stored time', () => {
+ it.each(['vm', 'system-container'] as const)(
+ 'does not combine differently dated %s readings or borrow live fallback values',
+ async (resourceType) => {
+ const fetch = vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(response());
+ render(() => (
+ <GuestDrawerHistory
+ target={{ ...target, resourceType }}
+ range="1h"
+ currentMetrics={{ cpu: 99, memory: 98, disk: 88 }}
+ />
+ ));
+ await ready();
+ expect(group()).toHaveTextContent('CPU22.0%');
+ expect(group()).toHaveTextContent('Memory-');
+ expect(group()).toHaveTextContent('Disk-');
+ expect(group()).not.toHaveTextContent(/95.0%|98.0%|88.0%|99.0%/);
+ expect(group().querySelector('[data-history-current]')).toBeNull();
+ expect(readoutTime()).toHaveTextContent('Latest stored');
+ expect(readoutTime()).toHaveAttribute('datetime', new Date(start + 120_000).toISOString());
+ expect(within(group()).getByRole('img')).toHaveAccessibleDescription(
+ expect.stringContaining('CPU 22.0%. Memory no observation. Disk no observation.'),
+ );
+ expect(fetch).toHaveBeenCalledTimes(1);
+ },
+ );
+
+ it('keeps aligned measured zero and a single real observation without a trend', async () => {
+ vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(
+ response({ cpu: [point(1, 0)], memory: [point(1, 0)], disk: [point(1, 0)] }),
+ );
+ render(() => <GuestDrawerHistory target={target} range="1h" />);
+ await screen.findByText('Single observation. No trend yet.');
+ expect(group()).toHaveTextContent('CPU0.0%');
+ expect(group()).toHaveTextContent('Memory0.0%');
+ expect(group()).toHaveTextContent('Disk0.0%');
+ expect(readoutTime()).toHaveAttribute('datetime', new Date(start + 60_000).toISOString());
+ expect(group().querySelector('path')).toBeNull();
+ expect(group().querySelectorAll('[data-history-observation]')).toHaveLength(3);
+ });
+
+ it('retains separately qualified fallback only when the panel has no stored observations', async () => {
+ const fetch = vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(response({}));
+ render(() => (
+ <GuestDrawerHistory
+ target={target}
+ range="1h"
+ currentMetrics={{ cpu: 0 }}
+ deferredMetrics={{
+ memory: { lastKnownValue: 95, message: 'Original memory time retained.' },
+ disk: { lastKnownValue: 50, valueLabel: 'freshness unknown', message: 'Time unknown.' },
+ }}
+ />
+ ));
+ await screen.findAllByText('No stored history in this range');
+ expect(group().querySelector('[data-history-current="cpu"]')).toHaveTextContent(
+ 'CPU0.0%current',
+ );
+ expect(group().querySelector('[data-history-last-known="memory"]')).toHaveTextContent(
+ 'Memory95.0%last known',
+ );
+ expect(group().querySelector('[data-history-unknown="disk"]')).toHaveTextContent(
+ 'Disk50.0%freshness unknown',
+ );
+ expect(within(group()).queryByTestId('guest-history-hover-time')).toBeNull();
+ fetch.mockResolvedValue(response({ cpu: [point(2, 22)] }));
+ refresh();
+ await waitFor(() => expect(group()).toHaveTextContent('CPU22.0%'));
+ expect(group()).toHaveTextContent('Memory-');
+ expect(group()).toHaveTextContent('Disk-');
+ expect(group().querySelector('[data-history-last-known]')).toBeNull();
+ expect(group().querySelector('[data-history-unknown]')).toBeNull();
+ });
+
+ it('returns to the newest stored time after inspection and never follows a live snapshot', async () => {
+ const fetch = vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(response());
+ const [live, setLive] = createSignal(88);
+ render(() => (
+ <GuestDrawerHistory target={target} range="1h" currentMetrics={{ disk: live() }} />
+ ));
+ const slider = await ready();
+ slider.focus();
+ fireEvent.input(slider, { target: { value: '1' } });
+ expect(group()).toHaveTextContent('Memory95.0%');
+ expect(group()).toHaveTextContent('CPU-');
+ fireEvent.blur(slider);
+ expect(group()).toHaveTextContent('CPU22.0%');
+ expect(group()).toHaveTextContent('Memory-');
+ expect(readoutTime()).toHaveTextContent('Latest stored');
+ setLive(77);
+ expect(group()).not.toHaveTextContent('77.0%');
+ expect(fetch).toHaveBeenCalledTimes(1);
+ fetch.mockResolvedValue(response({ cpu: [point(2, 22)], memory: [point(3, 25)] }));
+ refresh();
+ await waitFor(() => expect(group()).toHaveTextContent('Memory25.0%'));
+ expect(group()).toHaveTextContent('CPU-');
+ expect(readoutTime()).toHaveAttribute('datetime', new Date(start + 180_000).toISOString());
+ });
+
+ it("uses each panel's own time and preserves real zero rates", async () => {
+ vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(
+ response({
+ cpu: [point(5, 22)],
+ netin: [point(0, 200)],
+ netout: [point(2, 0)],
+ diskread: [point(3, 0)],
+ diskwrite: [point(1, 100)],
+ }),
+ );
+ render(() => <GuestDrawerHistory target={target} range="1h" />);
+ await screen.findByRole('slider', { name: 'Inspect Network I/O history' });
+ expect(group('network')).toHaveTextContent('In-');
+ expect(group('network')).toHaveTextContent('Out0 B/s');
+ expect(readoutTime('network')).toHaveAttribute(
+ 'datetime',
+ new Date(start + 120_000).toISOString(),
+ );
+ expect(group('disk-io')).toHaveTextContent('Read0 B/s');
+ expect(group('disk-io')).toHaveTextContent('Write-');
+ expect(readoutTime('disk-io')).toHaveAttribute(
+ 'datetime',
+ new Date(start + 180_000).toISOString(),
+ );
+ });
+
+ it('retains the dated readout on a transient failure and removes it when access is denied', async () => {
+ vi.spyOn(ChartsAPI, 'getMetricsHistory')
+ .mockResolvedValueOnce(response())
+ .mockRejectedValueOnce(Object.assign(new Error('private transient detail'), { status: 503 }))
+ .mockRejectedValueOnce(Object.assign(new Error('private access detail'), { status: 403 }));
+ render(() => <GuestDrawerHistory target={target} range="1h" />);
+ await ready();
+ refresh();
+ await screen.findByRole('button', { name: 'Retry history' });
+ expect(readoutTime()).toHaveAttribute('datetime', new Date(start + 120_000).toISOString());
+ expect(group()).toHaveTextContent('Memory-');
+ fireEvent.click(screen.getByRole('button', { name: 'Retry history' }));
+ await waitFor(() => expect(screen.queryByTestId('guest-history-group-chart')).toBeNull());
+ expect(screen.queryByTestId('guest-history-hover-time')).toBeNull();
+ expect(document.body).not.toHaveTextContent(/private transient detail|private access detail/);
+ });
+});
diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.sparse.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.sparse.test.tsx
index 885d1078e7..0a0caf6b7b 100644
--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.sparse.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.sparse.test.tsx
@@ -165,7 +165,7 @@ describe('GuestDrawerHistory sparse observations and current provenance', () =>
},
);
- it('preserves interleaved lone observations and labels only the live fallback', async () => {
+ it('preserves interleaved lone observations without mixing in a live fallback', async () => {
vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(
response({
cpu: [point(start, 10), point(end, 20)],
@@ -177,10 +177,9 @@ describe('GuestDrawerHistory sparse observations and current provenance', () =>
expect(group().querySelectorAll('path')).toHaveLength(0);
expect(group().querySelectorAll('[data-history-observation="memory"]')).toHaveLength(1);
expect(group().querySelectorAll('[data-history-observation="cpu"]')).toHaveLength(2);
- expect(group().querySelectorAll('[data-history-current]')).toHaveLength(1);
- expect(group().querySelector('[data-history-current="disk"]')).toHaveTextContent(
- 'Disk88.0%current',
- );
+ expect(group().querySelectorAll('[data-history-current]')).toHaveLength(0);
+ expect(group()).toHaveTextContent('Memory-');
+ expect(group()).toHaveTextContent('Disk-');
expect(group()).not.toHaveTextContent('Single observation. No trend yet.');
const slider = within(group()).getByRole('slider');
slider.focus();