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
Make Machines health filters agree with retained row status
pulse-triage[bot]d1842b98f2b8
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 081d98dbe1..7f146b7531 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -4541,6 +4541,14 @@ resolves late` inThe existing Machines status dot subscribes to the shared relative-time clockfor the unchanged five-minute agent-report fallback, agreeing with thestandalone classification helper without a new report, row timer or API read.+Machines health chip counts and selected results now use that same classifier+at the same clock instant rather than the canonical last-reported status.+Healthy excludes warning/stale rows, Degraded includes them and Offline retains+the existing danger precedence. Muted/unclassified rows stay in All only.+The status dot tooltip and accessible name expose that same current label+(Online, Stale or Offline), not an online tooltip on an amber retained row.+The canonical status, stale flag and timestamps remain observations, not derived+health. Search, focus, route-owned selection and removal behaviour are unchanged.Attention sort classifies once per resource per call, preserving priority andnumeric-name ordering without keeping a cross-call status cache. Debug sourcesummaries read current status/error/last-seen by section ID, not a record captured@@ -4552,6 +4560,13 @@ plus `browser-tests/pr2600-monitoring.cjs` on desktop and touch-phone engines,cover clock-only staleness and arriving status replacement. These aresynthetic source/presentation checks, not collector, workload recovery,whole-fleet performance, installed or release acceptance.+`browser-tests/machines-health-filters.cjs` additionally covers expanded phone+filters, exact freshness boundary, Healthy/Degraded clicks, arriving/withdrawn+reports and preserved URL/search. The Proxmox identity and TrueNAS error guide+checks still render the complete shipped guides through the production renderer;+their per-suite fixture reuses only identical source/path renders, returns+isolated clones and invalidates changed input. No renderer, guide bytes,+assertions or test deadlines are weakened.### Manual update freshnessdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex be9d9602a6..60b36ea782 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -3146,11 +3146,16 @@ application resource-provider or WebSocket lifecycle.### Retained Machines and Debug status (11 October 2026)-The Machines row status reads the same existing shared clock as its posture-summary. A held online agent becomes Stale only under the unchanged five-minute+The Machines row status, health chip counts and selected filter membership+read the same existing classifier and shared clock. A held online agent is+Degraded in the toolbar once its row becomes Stale under the unchanged five-minutefallback; clock ticks neither renew its report nor set its canonical stale flag.The row retains identity and metric values, and an actual report or offline-status still updates its presentation. Attention sorting classifies each input+status still updates its presentation and membership. Explicit warning/Unknown+rows are Degraded, red rows are Offline, and unclassified muted rows remain+visible in All without being promoted to Healthy or Offline. Search and the+route-owned selected filter survive reclassification; no new posture card is+added. Attention sorting classifies each inputresource once per call, retains the priority/name order and never caches statusacross calls or mutates the input inventory.@@ -3160,8 +3165,11 @@ errors; absent/invalid timestamps do not acquire an age. Source payload,disclosure and focus survive status-only updates and quiet age ticks.Verification: the Machines table, standalone page-model and Debug relative-age-tests cover the retained-row boundary, per-resource classification count and-ordinary source-status replacement. `browser-tests/pr2600-monitoring.cjs`+tests cover the retained-row boundary, per-resource classification count,+arriving/withdrawn reports, unknown/offline membership and ordinary source-status+replacement. `browser-tests/machines-health-filters.cjs` compares chip counts,+Healthy/Degraded clicks and selected results on the composed parent and final+desktop/phone sources; `browser-tests/pr2600-monitoring.cjs`compares exact-parent and repaired production surfaces on desktop Chromium andtouch-phone WebKit using synthetic local data. It establishes presentation,not a probe, guest thaw/writes/liveness/restoration, native collector recovery,diff --git a/frontend-modern/browser-tests/machines-health-filters.cjs b/frontend-modern/browser-tests/machines-health-filters.cjsnew file mode 100644index 0000000000..cd784fea98--- /dev/null+++ b/frontend-modern/browser-tests/machines-health-filters.cjs@@ -0,0 +1,287 @@+// Exact parent and final use the same production page, fixture and interaction matrix.+const assert = require('node:assert/strict');+const fs = require('node:fs');+const crypto = require('node:crypto');+const { chromium, webkit } = require('playwright');+const start = Date.parse('2026-10-11T17:00:00Z');+const origin = 'http://127.0.0.1:5351';+const hash = (p) => crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');+(async () => {+ const binding = JSON.parse(fs.readFileSync('/workspace/tmp/health-filters-binding.json'));+ const root = '/workspace/' + binding.frontend_root;+ const output = '/workspace/tmp/health-filters/' + (binding.run ?? binding.mode);+ fs.mkdirSync(output, { recursive: true });+ for (const [p, h] of Object.entries(binding.content_sha256))+ assert.equal(hash(root + '/' + p.replace('frontend-modern/', '')), h, p);+ const result = {+ binding,+ playwright: require('playwright/package.json').version,+ cases: [],+ captures: [],+ cleanup: {},+ completed: false,+ limits:+ 'Synthetic production Machines page/router/table, not full application, physical phone, native recovery, publication or release.',+ };+ assert.equal(+ result.playwright,+ JSON.parse(fs.readFileSync('/workspace/tests/integration/package-lock.json')).packages[+ 'node_modules/@playwright/test'+ ].version,+ );+ const { createServer } = await import(root + '/node_modules/vite/dist/node/index.js');+ const server = await createServer({+ root,+ configFile: root + '/vite.config.ts',+ cacheDir: output + '/vite-cache',+ server: { host: '127.0.0.1', port: 5351, strictPort: true, watch: null },+ optimizeDeps: { noDiscovery: true, include: [] },+ });+ let browser, page;+ try {+ await server.listen();+ for (const [name, engine, width, dark] of [+ ['desktop', chromium, 1680, false],+ ['phone', webkit, 390, true],+ ]) {+ browser = await engine.launch(+ engine === chromium+ ? { headless: true, channel: 'chromium', args: ['--no-sandbox'] }+ : { headless: true },+ );+ page = await browser.newPage({+ viewport: { width, height: 950 },+ isMobile: width < 500,+ hasTouch: width < 500,+ locale: 'en-GB',+ timezoneId: 'UTC',+ });+ page.setDefaultTimeout(10000);+ const record = {+ name,+ browser: browser.version(),+ width,+ dark,+ reads: [],+ writes: [],+ unexpectedReads: [],+ offOrigin: [],+ errors: [],+ consoleErrors: [],+ checks: [],+ };+ result.cases.push(record);+ page.on('pageerror', (err) => record.errors.push(err.message));+ page.on('console', (msg) => {+ if (msg.type() === 'error') record.consoleErrors.push(msg.text().slice(0, 600));+ });+ await page.clock.install({ time: new Date(start - 1000) });+ await page.clock.pauseAt(new Date(start));+ await page.addInitScript((dark) => {+ localStorage.clear();+ document.addEventListener(+ 'DOMContentLoaded',+ () => document.documentElement.classList.toggle('dark', dark),+ { once: true },+ );+ }, dark);+ await page.route('**/*', async (route) => {+ const req = route.request(),+ url = new URL(req.url()),+ p = url.pathname;+ if (url.origin !== origin) {+ record.offOrigin.push(url.origin);+ return route.abort();+ }+ if (!p.startsWith('/api/')) return route.continue();+ if (req.method() !== 'GET') {+ record.writes.push({ p, method: req.method() });+ return route.fulfill({ status: 403, json: { error: 'Fixture refuses writes' } });+ }+ record.reads.push(p);+ let data;+ if (p === '/api/resources')+ data = {+ data: [+ {+ id: 'fixture-agent',+ name: 'Silent host',+ displayName: 'Silent host',+ type: 'agent',+ platformId: 'fixture-agent',+ platformType: 'agent',+ sourceType: 'agent',+ sources: ['agent'],+ status: 'online',+ lastSeen: new Date(start - 60_000).toISOString(),+ cpu: { current: 24 },+ identity: { hostname: 'fixture-host' },+ agent: { agentId: 'fixture-agent', stale: false },+ },+ ],+ meta: { totalPages: 1 },+ };+ else if (p === '/api/agents/metadata') data = {};+ else if (p === '/api/security/status')+ data = { hasAuthentication: true, requiresAuth: false, sessionCapabilities: {} };+ else if (p === '/api/health') data = { status: 'ok' };+ else if (p === '/api/license/runtime-capabilities')+ data = {+ capabilities: [],+ limits: [],+ max_history_days: 7,+ hosted_mode: false,+ blocked_capabilities: [],+ runtime: { build: 'community' },+ };+ else {+ record.unexpectedReads.push(p);+ return route.fulfill({ status: 404, json: { error: 'Unexpected fixture read' } });+ }+ return route.fulfill({ json: data });+ });+ const capture = async (state) => {+ const p = `${output}/${name}-${state}.png`;+ // A frozen page clock also freezes route/CSS paint. Settle that+ // presentation before accepting a filtered-empty screenshot.+ await page.clock.runFor(500);+ await page.screenshot({ path: p, fullPage: true, animations: 'disabled' });+ result.captures.push({ path: p.replace('/workspace/', ''), sha256: hash(p) });+ };+ const row = page.locator('[data-agents-machine-row="fixture-agent"]');+ const button = (label) => page.getByRole('button', { name: new RegExp(`^${label}(?:,|$)`) });+ const counts = async (healthy, degraded) => {+ assert.equal(await button('Healthy').getAttribute('aria-label'), `Healthy, ${healthy}`);+ assert.equal(await button('Degraded').getAttribute('aria-label'), `Degraded, ${degraded}`);+ assert.equal(await button('Offline').getAttribute('aria-label'), 'Offline, 0');+ };+ await page.goto(origin + '/browser-tests/machines-health-filters.html', {+ waitUntil: 'domcontentloaded',+ timeout: 60000,+ });+ await row.waitFor();+ await page.clock.runFor(20000); // Complete normal initial canonical REST revalidation.+ if (width < 500) await page.getByRole('button', { name: /^Filters/ }).tap();+ await counts(1, 0);+ const search = page.getByRole('textbox', { name: 'Search machines' });+ await search.fill('Silent');+ await page.waitForURL((url) => url.searchParams.get('q') === 'Silent');+ await row.evaluate((el) => {+ window.__originalRow = el;+ });+ const details = row.getByRole('button', { name: /details/i }).first();+ await details.focus();+ const snapshot = await page.evaluate(() => window.__healthFilters.snapshot());+ const reads = record.reads.length;+ await page.clock.runFor(220000); // Report age exactly five minutes: still Healthy.+ await counts(1, 0);+ assert.match(+ await row.locator('span[title="online"], span[role="img"]').getAttribute('class'),+ /bg-emerald-500/,+ );+ await page.clock.runFor(30000);+ assert.match(+ await row.locator('span[title="online"], span[role="img"]').getAttribute('class'),+ /bg-amber-500/,+ );+ await counts(binding.mode === 'parent' ? 1 : 0, binding.mode === 'parent' ? 0 : 1);+ assert.equal(await page.evaluate(() => window.__healthFilters.snapshot()), snapshot);+ assert.equal(record.reads.length, reads);+ assert.equal(await row.evaluate((el) => el === window.__originalRow), true);+ assert.equal(await details.evaluate((el) => el === document.activeElement), true);+ if (binding.mode !== 'parent') {+ assert.equal(+ await row.getByRole('img', { name: 'Stale', exact: true }).getAttribute('title'),+ 'Stale',+ );+ }+ await capture('held-all');+ await button('Healthy').click();+ await page.waitForURL((url) => url.searchParams.get('status') === 'online');+ assert.equal(new URL(page.url()).searchParams.get('status'), 'online');+ assert.equal(await button('Healthy').getAttribute('aria-pressed'), 'true');+ assert.equal(await row.count(), binding.mode === 'parent' ? 1 : 0);+ await capture('held-healthy');+ await button('Degraded').click();+ await page.waitForURL((url) => url.searchParams.get('status') === 'degraded');+ assert.equal(new URL(page.url()).searchParams.get('status'), 'degraded');+ assert.equal(await button('Degraded').getAttribute('aria-pressed'), 'true');+ assert.equal(await row.count(), binding.mode === 'parent' ? 0 : 1);+ await capture('held-degraded');+ await page.evaluate(() => window.__healthFilters.report());+ await counts(1, 0);+ assert.equal(await row.count(), 0); // Selected Degraded must not retain recovered rows.+ assert.equal(new URL(page.url()).searchParams.get('status'), 'degraded');+ assert.equal(await search.inputValue(), 'Silent');+ await button('Healthy').click();+ await page.waitForURL((url) => url.searchParams.get('status') === 'online');+ await row.waitFor();+ assert.match(+ await row.locator('span[title="online"], span[role="img"]').getAttribute('class'),+ /bg-emerald-500/,+ );+ await capture('arrived-healthy');+ await page.evaluate(() => window.__healthFilters.withdraw());+ await counts(binding.mode === 'parent' ? 1 : 0, binding.mode === 'parent' ? 0 : 1);+ assert.equal(await row.count(), binding.mode === 'parent' ? 1 : 0);+ await button('Degraded').click();+ await page.waitForURL((url) => url.searchParams.get('status') === 'degraded');+ assert.equal(await row.count(), binding.mode === 'parent' ? 0 : 1);+ await capture('withdrawn-degraded');+ assert.equal(record.reads.filter((p) => p === '/api/resources').length, 1);+ record.sourceUpdateReads = record.reads.slice(reads);+ for (const p of record.sourceUpdateReads) assert.equal(p, '/api/agents/metadata');+ await page.waitForURL((url) => url.searchParams.get('q') === 'Silent');+ record.checks.push({+ exactBoundaryHealthy: true,+ heldAmber: true,+ heldFilter:+ binding.mode === 'parent'+ ? 'misleading Healthy 1 / Degraded 0; Healthy includes retained row; Degraded omits it'+ : 'Healthy 0 / Degraded 1; Healthy excludes retained row; Degraded includes it',+ canonicalSnapshotUnchangedByClock: true,+ retainedRowAndFocusBeforeFiltering: true,+ arrivalReclassifies: true,+ withdrawnReportReclassifies: true,+ searchAndSelectedURLPreserved: true,+ clockReads: 0,+ });+ assert.equal(+ await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 1),+ true,+ );+ for (const key of ['writes', 'unexpectedReads', 'offOrigin', 'errors', 'consoleErrors'])+ assert.deepEqual(record[key], []);+ await page.close();+ page = null;+ await browser.close();+ browser = null;+ }+ result.completed = true;+ } finally {+ if (page) {+ result.unfinishedPage = await page+ .locator('body')+ .innerText()+ .catch(() => 'unavailable');+ await page.close();+ }+ if (browser) await browser.close();+ result.cleanup.browserClosed = true;+ await server.close();+ result.cleanup.serverClosed = true;+ fs.writeFileSync(output + '/result.json', JSON.stringify(result, null, 2));+ }+ process.stdout.write(+ JSON.stringify({+ completed: result.completed,+ mode: binding.mode,+ cases: result.cases.length,+ captures: result.captures.length,+ cleanup: result.cleanup,+ }) + '\n',+ );+})().catch((err) => {+ process.stderr.write(err.stack + '\n');+ process.exitCode = 1;+});diff --git a/frontend-modern/browser-tests/machines-health-filters.html b/frontend-modern/browser-tests/machines-health-filters.htmlnew file mode 100644index 0000000000..0c079f2c9d--- /dev/null+++ b/frontend-modern/browser-tests/machines-health-filters.html@@ -0,0 +1,5 @@+<!doctype html>+<html lang="en">+ <head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Machines health filter control</title></head>+ <body><div id="root"></div><script type="module" src="./machines-health-filters.tsx"></script></body>+</html>diff --git a/frontend-modern/browser-tests/machines-health-filters.tsx b/frontend-modern/browser-tests/machines-health-filters.tsxnew file mode 100644index 0000000000..fa406793d9--- /dev/null+++ b/frontend-modern/browser-tests/machines-health-filters.tsx@@ -0,0 +1,52 @@+// Production page/router/table with synthetic, producer-shaped monitoring data.+import { createSignal } from 'solid-js';+import { createStore } from 'solid-js/store';+import { render } from 'solid-js/web';+import { Router, Route } from '@solidjs/router';+import { StandalonePageSurface } from '../src/features/standalone/StandalonePageSurface';+import { WebSocketContext, DarkModeContext } from '../src/contexts/appRuntime';+import { syncAIRuntimeSettings } from '../src/stores/aiRuntimeState';+import type { Resource } from '../src/types/resource';+import '../src/index.css';++const start = Date.parse('2026-10-11T17:00:00Z');+syncAIRuntimeSettings({ discovery_enabled: false });+const machine: Resource = {+ id: 'fixture-agent', name: 'Silent host', displayName: 'Silent host', type: 'agent',+ platformId: 'fixture-agent', platformType: 'agent', sourceType: 'agent', sources: ['agent'],+ status: 'online', lastSeen: start - 60_000, cpu: { current: 24 },+ identity: { hostname: 'fixture-host' }, agent: { agentId: 'fixture-agent', stale: false },+};+const [state, setState] = createStore({ resources: [machine], pmg: [], connectedInfrastructure: [] });+const [resourceChange, setResourceChange] = createSignal({ version: 1, changedIds: null, changedKeys: null });+const ws = {+ state, activeAlerts: {}, connected: () => true, initialDataReceived: () => true,+ resourceSnapshotReceived: () => true, resourceChange, changedResourceIdsSince: () => null,+ activeAlertsHydrationStatus: () => 'ready', markAgentsTokenRevoked: () => {}, markDockerRuntimesTokenRevoked: () => {},+};+(window as any).__pulseWsStore = ws;+function Fixture() {+ (window as any).__healthFilters = {+ snapshot: () => JSON.stringify(state.resources),+ report: () => {+ setState('resources', 0, 'lastSeen', Date.now());+ setState('resources', 0, 'agent', 'stale', false);+ setResourceChange((v) => ({ ...v, version: v.version + 1 }));+ },+ withdraw: () => {+ setState('resources', 0, 'lastSeen', 0);+ setState('resources', 0, 'agent', 'stale', true);+ setResourceChange((v) => ({ ...v, version: v.version + 1 }));+ },+ };+ return <main class="mx-auto min-h-screen max-w-6xl space-y-3 bg-surface p-3 text-base-content">+ <h1 class="text-base font-semibold">Machines health filter control</h1>+ <p class="text-xs text-muted">Synthetic evidence. No collector or guest command is sent.</p>+ <StandalonePageSurface />+ </main>;+}+render(() => <WebSocketContext.Provider value={ws as any}>+ <DarkModeContext.Provider value={() => document.documentElement.classList.contains('dark')}>+ <Router><Route path="/*" component={Fixture} /></Router>+ </DarkModeContext.Provider>+</WebSocketContext.Provider>, document.getElementById('root')!);diff --git a/frontend-modern/browser-tests/pr2600-monitoring.cjs b/frontend-modern/browser-tests/pr2600-monitoring.cjsindex 4ce085a7db..8637e82807 100644--- a/frontend-modern/browser-tests/pr2600-monitoring.cjs+++ b/frontend-modern/browser-tests/pr2600-monitoring.cjs@@ -155,7 +155,7 @@ const hash = (p) => crypto.createHash('sha256').update(fs.readFileSync(p)).diges});if (surface === 'machines') {const row = page.locator('[data-agents-machine-row="fixture-agent"]');- const dot = row.locator('span[title="online"]');+ const dot = row.locator('span[title="online"], span[role="img"]');// Machines no longer has a posture card. Compare with the production// classification helper, not an obsolete UI from the old proposal.const posture = page.getByTestId('fixture-posture-summary');@@ -191,7 +191,7 @@ const hash = (p) => crypto.createHash('sha256').update(fs.readFileSync(p)).diges});await page.evaluate(() => window.__pr2600.remount());assert.match(- await row.locator('span[title="online"]').getAttribute('class'),+ await row.locator('span[title="online"], span[role="img"]').getAttribute('class'),/bg-amber-500/,);record.checks.push(diff --git a/frontend-modern/browser-verification/b0b6838d56a96def.json b/frontend-modern/browser-verification/b0b6838d56a96def.jsonnew file mode 100644index 0000000000..f79624f581--- /dev/null+++ b/frontend-modern/browser-verification/b0b6838d56a96def.json@@ -0,0 +1,35 @@+{+ "version": 1,+ "base_sha": "120af509e1a5027d759cbcbb981fb4217311e1d9",+ "verified_at": "2026-10-11T19:24:37.932984Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/features/standalone/AgentsMachinesTable.tsx"+ ],+ "content_sha256": {+ "frontend-modern/src/features/standalone/AgentsMachinesTable.tsx": "8994b85795dfaaa4f99eb1de601a4ef2730eb082cd503ac9962bd6a2fb8692cf"+ },+ "routes": [+ "/browser-tests/machines-health-filters.html with production StandalonePageSurface/router/table and q/status state; synthetic local evidence, not a new application route"+ ],+ "viewports": [+ {+ "width": 1680,+ "height": 950+ },+ {+ "width": 390,+ "height": 950+ }+ ],+ "states": [+ "Playwright 1.56.1 matches the integration lock. Desktop Chromium 141.0.7390.37 light and touch-phone WebKit 26.0 dark. Exact composed parent 120af509e1a5027d759cbcbb981fb4217311e1d9 and final runtime hashes checked; twenty settled parent/final captures inspected. Earlier captures failed visual acceptance due frozen-clock transitions and are retained separately, not used as visual proof.",+ "Exactly five minutes after the retained report, Healthy remains 1 and the row stays green. At the next existing shared-clock tick the canonical online/stale-false report is unchanged but the row is amber. Parent retains Healthy 1 / Degraded 0, Healthy includes the row and Degraded omits it. Final shows Healthy 0 / Degraded 1, Healthy excludes the row and Degraded includes it. Final tooltip and accessible status name are Stale.",+ "Quiet clock advancement keeps the original snapshot, row and focus without read/write. Ordinary initial REST reads and metadata refresh after injected source updates remain. No unexpected read, write, off-origin request, page or console error, or page-level horizontal overflow. Browser and server close.",+ "Synthetic production page evidence is not a full application, physical phone, native collector, guest thaw/writes/liveness/restoration, installed result, publication or release."+ ],+ "interactions": [+ "Expand phone Filters. Enter identity search, select Healthy and Degraded, inspect actual selected rows and accessible counts, including filtered-empty state; q/status URL state remains owned by the page.",+ "An arriving report changes Degraded membership immediately while retaining the selected filter and search, then Healthy shows the recovered green row. A subsequent explicit stale/withdrawn-report update removes it from Healthy and includes it in Degraded without polling or rewriting canonical observations."+ ]+}diff --git a/frontend-modern/src/features/docs/__tests__/guideFixture.test.ts b/frontend-modern/src/features/docs/__tests__/guideFixture.test.tsnew file mode 100644index 0000000000..3d7a2cdac6--- /dev/null+++ b/frontend-modern/src/features/docs/__tests__/guideFixture.test.ts@@ -0,0 +1,43 @@+import { afterEach, describe, expect, it, vi } from 'vitest';+import * as renderer from '../docMarkdown';+import { createGuideFixture } from './guideFixture';++afterEach(() => vi.restoreAllMocks());++describe('complete guide fixtures', () => {+ it('renders once for identical guide bytes and returns isolated DOM clones', () => {+ const render = vi.spyOn(renderer, 'renderDocMarkdown');+ const source =+ '# Full guide\n\n## Destination\n\n[Link](OTHER.md#heading)\n\n<script>bad()</script>';+ const read = vi.fn(() => source);+ const guide = createGuideFixture(read);+ const first = guide('nested/GUIDE');+ expect(first.querySelector('#destination')).not.toBeNull();+ expect(first.querySelector('a')?.getAttribute('href')).toBe('/docs/nested/OTHER#heading');+ expect(first.querySelector('script')).toBeNull();+ first.querySelector('a')!.remove();+ first.querySelector('#destination')!.id = 'mutated';+ const second = guide('nested/GUIDE');+ expect(second).not.toBe(first);+ expect(second.querySelector('#destination')).not.toBeNull();+ expect(second.querySelector('a')).not.toBeNull();+ expect(render).toHaveBeenCalledExactlyOnceWith(source, 'nested/GUIDE');+ expect(read).toHaveBeenCalledTimes(2);+ });++ it('does not reuse a different source or document-path link context', () => {+ const render = vi.spyOn(renderer, 'renderDocMarkdown');+ let source = '# Original\n\n[Link](OTHER.md)';+ const guide = createGuideFixture(() => source);+ expect(guide('nested/GUIDE').querySelector('a')?.getAttribute('href')).toBe(+ '/docs/nested/OTHER',+ );+ expect(guide('GUIDE').querySelector('a')?.getAttribute('href')).toBe('/docs/OTHER');+ expect(render).toHaveBeenCalledTimes(2);+ source = '# Changed\n\nNo link.';+ const changed = guide('GUIDE');+ expect(changed.querySelector('#changed')).not.toBeNull();+ expect(changed.querySelector('#original, a')).toBeNull();+ expect(render).toHaveBeenCalledTimes(3);+ });+});diff --git a/frontend-modern/src/features/docs/__tests__/guideFixture.ts b/frontend-modern/src/features/docs/__tests__/guideFixture.tsnew file mode 100644index 0000000000..9cf2c01c84--- /dev/null+++ b/frontend-modern/src/features/docs/__tests__/guideFixture.ts@@ -0,0 +1,21 @@+import { renderDocMarkdown } from '../docMarkdown';++/**+ * Render a complete shipped guide once per exact source in this test suite.+ * Clones keep assertions isolated; source/path changes invalidate the fixture.+ * This is not a production renderer cache or an excerpt of the tested guide.+ */+export function createGuideFixture(readSource: (name: string) => string) {+ const guides = new Map<string, { source: string; article: HTMLElement }>();+ return (name: string): HTMLElement => {+ const source = readSource(name);+ let guide = guides.get(name);+ if (!guide || guide.source !== source) {+ const article = document.createElement('article');+ article.innerHTML = renderDocMarkdown(source, name);+ guide = { source, article };+ guides.set(name, guide);+ }+ return guide.article.cloneNode(true) as HTMLElement;+ };+}diff --git a/frontend-modern/src/features/docs/__tests__/proxmoxIdentityGuide.test.ts b/frontend-modern/src/features/docs/__tests__/proxmoxIdentityGuide.test.tsindex 83838a7517..ace41029e3 100644--- a/frontend-modern/src/features/docs/__tests__/proxmoxIdentityGuide.test.ts+++ b/frontend-modern/src/features/docs/__tests__/proxmoxIdentityGuide.test.ts@@ -2,24 +2,19 @@ import { readFileSync } from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';import { describe, expect, it } from 'vitest';-import { renderDocMarkdown } from '../docMarkdown';+import { createGuideFixture } from './guideFixture';const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..');const identityFragment = '#monitoring-is-mixed-between-proxmox-installations';-function renderGuide(name: string): HTMLElement {+const renderGuide = createGuideFixture((name) => {// Optional exact-base inputs exercise the former shipped advice without// changing the committed candidate being checked in the proof VM.const directory =process.env.PULSE_PROXMOX_IDENTITY_GUIDE_INPUT_DIRECTORY ??path.join(repoRoot, 'frontend-modern/public/docs');- const article = document.createElement('article');- article.innerHTML = renderDocMarkdown(- readFileSync(path.join(directory, `${name}.md`), 'utf8'),- name,- );- return article;-}+ return readFileSync(path.join(directory, `${name}.md`), 'utf8');+});function sectionAt(article: HTMLElement, fragment: string): HTMLElement {const heading = article.querySelector(fragment);diff --git a/frontend-modern/src/features/docs/__tests__/truenasErrorGuide.test.ts b/frontend-modern/src/features/docs/__tests__/truenasErrorGuide.test.tsindex 85e6935c94..54b7c4b1a3 100644--- a/frontend-modern/src/features/docs/__tests__/truenasErrorGuide.test.ts+++ b/frontend-modern/src/features/docs/__tests__/truenasErrorGuide.test.ts@@ -2,22 +2,19 @@ import { readFileSync } from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';import { describe, expect, it } from 'vitest';-import { renderDocMarkdown } from '../docMarkdown';+import { createGuideFixture } from './guideFixture';const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..');-function renderGuide(name: string): HTMLElement {+const renderGuide = createGuideFixture((name) => {// An exact-parent input proves that the former advice fails these checks// without altering the committed source used by the proof.const input = process.env[`PULSE_${name}_GUIDE_TEST_INPUT`];- const source = readFileSync(+ return readFileSync(input ?? path.join(repoRoot, 'frontend-modern/public/docs', `${name}.md`),'utf8',);- const article = document.createElement('article');- article.innerHTML = renderDocMarkdown(source, name);- return article;-}+});function sectionAt(article: HTMLElement, id: string): HTMLElement {const heading = article.querySelector(id);diff --git a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsxindex 0432e8a3eb..a0a6d80411 100644--- a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx+++ b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx@@ -1089,8 +1089,17 @@ const filterAgentMachineResources = (resources: Resource[],search: string,status: PlatformResourceStatusFilter,+ nowMs: number,): Resource[] =>- filterPlatformResources(resources, '', status).filter((machine) =>+ filterPlatformResources(resources, '', status, (machine) => {+ // Health is the row's current presentation, not its last reported status.+ // Never write this derived classification back into the canonical resource.+ const variant = getStandaloneResourceStatusIndicator(machine, nowMs).variant;+ if (variant === 'success') return 'online';+ if (variant === 'warning') return 'degraded';+ if (variant === 'danger') return 'offline';+ return 'unknown';+ }).filter((machine) =>matchesAgentMachineSearch(machine, search, systemLabelFor, agentVersionFor),);@@ -1264,7 +1273,8 @@ export const AgentsMachinesTable: Component<{const tableState = createPlatformTableFilterState({resources: visibleMachineResources,initialStatus: 'all' as PlatformResourceStatusFilter,- filter: filterAgentMachineResources,+ filter: (resources, search, status) =>+ filterAgentMachineResources(resources, search, status, now()),externalSearch: props.externalSearch,onExternalSearchChange: props.onExternalSearchChange,externalStatus: props.externalStatus,@@ -1708,8 +1718,8 @@ export const AgentsMachinesTable: Component<{<StatusDotsize="sm"variant={indicator().variant}- title={machine.status || 'unknown'}- ariaHidden+ title={indicator().label}+ ariaLabel={indicator().label}/><ResourceNameWithWebInterfaceLinkname={name()}diff --git a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsxindex ba62d323bd..a746ff2c85 100644--- a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx+++ b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx@@ -162,6 +162,116 @@ afterEach(() => {});describe('AgentsMachinesTable', () => {+ it('keeps health counts and selected rows truthful for retained, arriving and withdrawn reports', () => {+ const start = Date.parse('2026-10-11T17:00:00Z');+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: start });+ try {+ const [machines, setMachines] = createStore([+ resource({ id: 'silent', lastSeen: start, cpu: { current: 24 }, agent: { stale: false } }),+ ]);+ const original = JSON.stringify(machines);+ const [search, setSearch] = createSignal('silent');+ const [status, setStatus] = createSignal<'all' | 'online' | 'degraded' | 'offline'>('all');+ const view = render(() => (+ <AgentsMachinesTable+ resources={machines}+ emptyIcon={emptyIcon}+ emptyTitle="No machines"+ emptyDescription="Install Pulse Agent."+ externalSearch={search}+ onExternalSearchChange={setSearch}+ externalStatus={status}+ onExternalStatusChange={setStatus}+ />+ ));+ const chip = (label: string, count: number) =>+ screen.getByRole('button', { name: `${label}, ${count}` });+ const rows = () => view.container.querySelectorAll('[data-agents-machine-row]');+ fireEvent.click(chip('Healthy', 1));+ const healthy = chip('Healthy', 1);+ healthy.focus();+ expect(rows()).toHaveLength(1);+ vi.advanceTimersByTime(5 * 60_000);+ expect(rows()).toHaveLength(1);+ expect(chip('Healthy', 1)).toHaveAttribute('aria-pressed', 'true');++ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);+ expect(rows()).toHaveLength(0);+ expect(chip('Healthy', 0)).toHaveAttribute('aria-pressed', 'true');+ expect(chip('Degraded', 1)).toBeInTheDocument();+ expect(chip('Offline', 0)).toBeInTheDocument();+ expect(document.activeElement).toBe(healthy);+ expect(search()).toBe('silent');+ expect(status()).toBe('online');+ expect(JSON.stringify(machines)).toBe(original);++ fireEvent.click(chip('Degraded', 1));+ expect(rows()).toHaveLength(1);+ expect(rows()[0].querySelector('span[role="img"]')).toHaveClass('bg-amber-500');+ expect(screen.getByRole('img', { name: 'Stale' })).toHaveAttribute('title', 'Stale');+ expect(screen.getByTestId('agent-machine-cpu-bar')).toHaveAttribute('data-usage', '24');+ setMachines(0, 'lastSeen', Date.now());+ expect(rows()).toHaveLength(0);+ expect(chip('Degraded', 0)).toHaveAttribute('aria-pressed', 'true');+ expect(chip('Healthy', 1)).toBeInTheDocument();++ fireEvent.click(chip('Healthy', 1));+ expect(rows()).toHaveLength(1);+ setMachines(0, 'lastSeen', 0);+ setMachines(0, 'agent', 'stale', true);+ expect(rows()).toHaveLength(0);+ fireEvent.click(chip('Degraded', 1));+ expect(rows()).toHaveLength(1);+ expect(machines[0].status).toBe('online');++ setMachines(0, 'status', 'offline');+ expect(rows()).toHaveLength(0);+ expect(chip('Healthy', 0)).toBeInTheDocument();+ fireEvent.click(chip('Offline', 1));+ expect(rows()[0].querySelector('span[title="Offline"]')).toHaveClass('bg-red-500');+ expect(screen.queryByTestId('agent-machine-cpu-bar')).not.toBeInTheDocument();+ expect(search()).toBe('silent');+ expect(getAllAgentMetadataMock).toHaveBeenCalledTimes(1);+ expect(deleteAgentMock).not.toHaveBeenCalled();+ expect(deleteAgentMetadataMock).not.toHaveBeenCalled();+ } finally {+ cleanup();+ vi.useRealTimers();+ }+ });++ it('does not promote unknown status or missing freshness to Healthy or Offline', () => {+ const now = Date.now();+ const { container } = render(() => (+ <AgentsMachinesTable+ resources={[+ resource({ id: 'fresh', lastSeen: now }),+ resource({ id: 'unknown', status: 'unknown', lastSeen: now }),+ resource({ id: 'unclassified', status: undefined, lastSeen: 0 }),+ resource({ id: 'offline', status: 'offline', lastSeen: 0, agent: { stale: true } }),+ ]}+ emptyIcon={emptyIcon}+ emptyTitle="No machines"+ emptyDescription="Install Pulse Agent."+ />+ ));+ const ids = () =>+ [...container.querySelectorAll('[data-agents-machine-row]')].map((row) =>+ row.getAttribute('data-agents-machine-row'),+ );+ // Explicit Unknown already has a warning row; unclassified has a muted row.+ // Neither is promoted. All keeps the latter visible without claiming health.+ expect(ids()).toHaveLength(4);+ fireEvent.click(screen.getByRole('button', { name: 'Healthy, 1' }));+ expect(ids()).toEqual(['fresh']);+ fireEvent.click(screen.getByRole('button', { name: 'Degraded, 1' }));+ expect(ids()).toEqual(['unknown']);+ fireEvent.click(screen.getByRole('button', { name: 'Offline, 1' }));+ expect(ids()).toEqual(['offline']);+ fireEvent.click(screen.getByRole('button', { name: 'All, 4' }));+ expect(ids()).toHaveLength(4);+ });+it('keeps the retained row status in agreement with posture across the five-minute clock boundary', () => {const start = Date.parse('2026-10-11T17:00:00Z');vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: start });@@ -189,8 +299,7 @@ describe('AgentsMachinesTable', () => {</>);});- const dot = () =>- view.container.querySelector('[data-agents-machine-row] span[title="online"]')!;+ const dot = () => view.container.querySelector('[data-agents-machine-row] span[role="img"]')!;const row = view.container.querySelector('[data-agents-machine-row]');const cpu = screen.getByTestId('agent-machine-cpu-bar');expect(dot()).toHaveClass('bg-emerald-500');@@ -217,7 +326,7 @@ describe('AgentsMachinesTable', () => {expect(screen.getByTestId('posture-attention')).toHaveTextContent('0');setMachines(0, 'status', 'offline');expect(- view.container.querySelector('[data-agents-machine-row] span[title="offline"]'),+ view.container.querySelector('[data-agents-machine-row] span[title="Offline"]'),).toHaveClass('bg-red-500');expect(screen.queryByTestId('agent-machine-cpu-bar')).not.toBeInTheDocument();} finally {