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.

Repair the PBS drawer browser fixture and its two proofs

rcourtmanac75d4425a9f
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 6c2a39468b..000d84410b 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -7706,9 +7706,17 @@ manufacturing a target. The
boundary, and `scripts/check-drawer-tab-retention.cjs` exercises the rendered
drawer at desktop and narrow widths: selecting Manage, dropping the merged
metrics target, and restoring it must keep the selection and bring the Overview
-charts back. Its fixture page currently fails before the drawer renders
-(no WebSocket provider), so that proof does not run until the fixture is
-repaired.
+charts back. Its fixture, `browser-tests/pbs-host-history-correlation.tsx`,
+supplies an explicit offline WebSocket context like the other drawer fixtures;
+it threw before rendering until 2026-10-14. With the #1723 reset reintroduced
+(dropping the target sends the drawer to Overview) the proof fails at both
+widths, so it detects the regression it guards.
+`scripts/check-pbs-host-history-correlation.cjs` uses the same fixture and
+asserts the Overview tab stays selected with stable chart paths and Identity
+rows across refreshes; it accepts the Metrics Target row's absence when the
+Identity card suppresses a repeated identifier, and still requires the
+intercepted history request to name the host series (forcing the service key
+makes it fail).
### Canonical reference resolution uses a derived alias index
diff --git a/frontend-modern/browser-tests/pbs-host-history-correlation.tsx b/frontend-modern/browser-tests/pbs-host-history-correlation.tsx
index 22b50c3ead..815b974066 100644
--- a/frontend-modern/browser-tests/pbs-host-history-correlation.tsx
+++ b/frontend-modern/browser-tests/pbs-host-history-correlation.tsx
@@ -7,9 +7,11 @@
// Synthetic props only; the check script intercepts the metrics-history request.
import { createSignal, onCleanup } from 'solid-js';
import { render } from 'solid-js/web';
+import { Route, Router } from '@solidjs/router';
import { ProxmoxBackupServersTable } from '../src/features/proxmox/ProxmoxBackupServersTable';
import type { Resource } from '../src/types/resource';
+import { DarkModeContext, WebSocketContext } from '../src/contexts/appRuntime';
import '../src/index.css';
const sharedAgent = { agentId: 'agent-proxback', hostname: 'proxback-vm' };
@@ -117,7 +119,7 @@ const Fixture = () => {
const [servers, setServers] = createSignal(structuredClone(resources));
const [snapshot, setSnapshot] = createSignal(0);
// Simulates a snapshot in which the merged host correlation target is
- // transiently absent, which is what gates the drawer's History tab.
+ // transiently absent, which is what gates the drawer's history charts.
const [dropMetricsTarget, setDropMetricsTarget] = createSignal(false);
// Simulates a live refresh that briefly omits the correlated host row while
// the PBS server row remains, which is what flipped the drawer's Identity and
@@ -194,4 +196,20 @@ const Fixture = () => {
);
};
-render(() => <Fixture />, document.getElementById('root') as HTMLElement);
+// The drawer's Overview reads active alerts from the app runtime, so the
+// fixture supplies an explicit offline context (no live WebSocket), as the
+// other drawer fixtures do. Without it the drawer threw before rendering.
+render(
+ () => (
+ <WebSocketContext.Provider
+ value={{ state: { pmg: [] }, activeAlerts: {}, connected: () => false } as any}
+ >
+ <DarkModeContext.Provider value={() => document.documentElement.classList.contains('dark')}>
+ <Router>
+ <Route path="/*" component={Fixture} />
+ </Router>
+ </DarkModeContext.Provider>
+ </WebSocketContext.Provider>
+ ),
+ document.getElementById('root') as HTMLElement,
+);
diff --git a/scripts/check-pbs-host-history-correlation.cjs b/scripts/check-pbs-host-history-correlation.cjs
index 7c59abd975..c05ff486aa 100644
--- a/scripts/check-pbs-host-history-correlation.cjs
+++ b/scripts/check-pbs-host-history-correlation.cjs
@@ -3,7 +3,8 @@
// Exercises PBS-only, bare-metal PVE/PBS side-by-side, and a PVE guest plus
// standalone representation of one agent. Each has two datastores. Switches
// rows and applies timer-driven fresh snapshots in stable and reversed order.
-// Checks the drawer identity, selected History tab, populated chart paths and
+// Checks the drawer identity, selected Overview tab (which carries the history
+// charts since the History tab was folded into it), populated chart paths and
// exact host metrics target at desktop/mobile widths. Synthetic API responses
// prove UI behaviour, not backend persistence or installed release behaviour.
// Run: pulse-worker-browser scripts/check-pbs-host-history-correlation.cjs
@@ -147,16 +148,13 @@ const launchOptions = {
});
await row.getByRole('button').focus();
await page.keyboard.press('Enter');
- await page
- .getByRole('tab', { name: 'History', exact: true })
- .click();
await page
.locator('[data-testid="guest-history-plot"] path')
.first()
.waitFor();
assert.equal(
await page
- .getByRole('tab', { name: 'History', exact: true })
+ .getByRole('tab', { name: 'Overview', exact: true })
.getAttribute('aria-selected'),
'true',
);
@@ -195,16 +193,23 @@ const launchOptions = {
identityLabels.includes('Discovery'),
'Discovery identity row missing from the drawer',
);
- assert.ok(
- identityLabels.includes('Metrics Target'),
- 'Metrics Target identity row missing from the drawer',
- );
+ // Since the Identity card shows each identifier once (4884052bc5),
+ // Metrics Target appears only when it names something not already
+ // shown. When it does appear it must name the host series; the
+ // intercepted history request below proves the target either way.
+ const metricsRow = identityBefore.find(([label]) => label === 'Metrics Target');
+ if (metricsRow) {
+ assert.ok(
+ metricsRow[1].endsWith(expected.split('/').pop()),
+ `Metrics Target identity row names ${metricsRow[1]}, not the host series ${expected}`,
+ );
+ }
await page
.getByRole('button', { name: 'Schedule automatic snapshot' })
.click();
- // Return focus to History before the timer-driven data replacement.
+ // Return focus to the drawer's tabs before the timer-driven data replacement.
await page
- .getByRole('tab', { name: 'History', exact: true })
+ .getByRole('tab', { name: 'Overview', exact: true })
.focus();
await page
.getByRole('status', { name: 'Snapshot number' })
@@ -223,10 +228,10 @@ const launchOptions = {
);
assert.equal(
await page
- .getByRole('tab', { name: 'History', exact: true })
+ .getByRole('tab', { name: 'Overview', exact: true })
.getAttribute('aria-selected'),
'true',
- 'history reset after snapshot',
+ 'tab selection reset after snapshot',
);
assert.equal(
await detail
@@ -265,10 +270,10 @@ const launchOptions = {
);
assert.equal(
await page
- .getByRole('tab', { name: 'History', exact: true })
+ .getByRole('tab', { name: 'Overview', exact: true })
.getAttribute('aria-selected'),
'true',
- 'history reset after the host row was omitted',
+ 'tab selection reset after the host row was omitted',
);
assert.equal(
await detail