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 resource Debug source ages current
pulse-triage[bot]3f6d41f0c305
diff --git a/frontend-modern/browser-tests/source-evidence-age.cjs b/frontend-modern/browser-tests/source-evidence-age.cjsnew file mode 100644index 0000000000..f837d925d1--- /dev/null+++ b/frontend-modern/browser-tests/source-evidence-age.cjs@@ -0,0 +1,290 @@+// Production drawer/state/CSS, synthetic local snapshots only. The parent+// mode records the held-age defect; the final mode requires its correction.+const assert = require('node:assert/strict');+const fs = require('node:fs');+const path = require('node:path');+const crypto = require('node:crypto');+const { chromium, webkit } = require('playwright');++const root = '/workspace/frontend-modern';+const origin = 'http://127.0.0.1:5347';+const start = Date.parse('2026-10-11T10:00:00Z');+const hash = (file) => crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex');++(async () => {+ const binding = JSON.parse(fs.readFileSync('/workspace/tmp/source-evidence-age/binding.json'));+ assert.ok(['parent', 'final'].includes(binding.mode));+ for (const [file, expected] of Object.entries(binding.content_sha256)) {+ assert.equal(hash('/workspace/' + file), expected, file);+ }+ const output = '/workspace/tmp/source-evidence-age/' + binding.mode;+ fs.mkdirSync(output, { recursive: true });+ const result = {+ binding,+ playwright: require('playwright/package.json').version,+ cases: [],+ captures: [],+ completed: false,+ cleanup: {},+ limits:+ 'Synthetic drawer/provider snapshots, not native QGA, thaw, filesystem writes, restart recovery, publication or a release. Parent observation is not a passing repair.',+ };+ 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: 5347, strictPort: true, watch: null },+ optimizeDeps: { noDiscovery: true, include: [] },+ });+ let browser;+ try {+ await server.listen();+ for (const [name, engine, width, dark] of [+ ['desktop', chromium, 1280, false],+ ['phone', webkit, 390, true],+ ]) {+ browser = await engine.launch(+ engine === chromium+ ? { headless: true, channel: 'chromium', args: ['--no-sandbox'] }+ : { headless: true },+ );+ const page = await browser.newPage({+ viewport: { width, height: 950 },+ isMobile: width < 500,+ hasTouch: width < 500,+ locale: 'en-GB',+ timezoneId: 'UTC',+ });+ page.setDefaultTimeout(8000);+ const record = {+ name,+ browser: browser.version(),+ width,+ dark,+ checks: [],+ requests: [],+ writes: [],+ unexpectedReads: [],+ offOrigin: [],+ errors: [],+ };+ result.cases.push(record);+ page.on('pageerror', (error) => record.errors.push(error.message));+ await page.clock.install({ time: new Date(start - 1000) });+ await page.clock.pauseAt(new Date(start));+ await page.addInitScript((dark) => {+ localStorage.clear();+ localStorage.setItem('pulse_debug_mode', 'true');+ window.__sourceEvidenceClipboard = [];+ Object.defineProperty(navigator, 'clipboard', {+ configurable: true,+ value: {+ writeText: async (text) => window.__sourceEvidenceClipboard.push(text),+ },+ });+ 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());+ if (url.origin !== origin) {+ record.offOrigin.push(url.origin);+ return route.abort();+ }+ if (!url.pathname.startsWith('/api/')) return route.continue();+ record.requests.push({ path: url.pathname, method: req.method() });+ if (req.method() !== 'GET') {+ record.writes.push(url.pathname);+ return route.fulfill({+ status: 403,+ json: { error: 'Synthetic fixture refuses writes' },+ });+ }+ let data;+ if (/^\/api\/resources\/[^/]+\/operator-state$/.test(url.pathname))+ data = { configured: false };+ else if (/^\/api\/resources\/[^/]+\/maintenance-verifications$/.test(url.pathname))+ data = { reports: [] };+ else if (url.pathname === '/api/license/runtime-capabilities')+ data = {+ capabilities: [],+ limits: [],+ max_history_days: 7,+ hosted_mode: false,+ runtime: { build: 'community' },+ blocked_capabilities: [],+ };+ else if (url.pathname === '/api/security/status')+ data = {+ hasAuthentication: true,+ requiresAuth: false,+ sessionCapabilities: {},+ };+ else if (url.pathname === '/api/health') data = { status: 'ok' };+ else {+ record.unexpectedReads.push(url.pathname);+ return route.fulfill({ status: 404, json: { error: 'Unspecified synthetic read' } });+ }+ return route.fulfill({ json: data });+ });+ const activate = async (locator) => (width < 500 ? locator.tap() : locator.press('Enter'));+ const summary = (label) =>+ page.locator('summary').filter({ hasText: new RegExp('^' + label) });+ const capture = async (label) => {+ const file = path.join(output, name + '-' + label + '.png');+ await page.screenshot({ path: file, fullPage: true, animations: 'disabled' });+ result.captures.push({+ path: file.replace('/workspace/', ''),+ sha256: hash(file),+ bytes: fs.statSync(file).size,+ });+ };+ await page.goto(origin + '/browser-tests/source-evidence-age.html', {+ waitUntil: 'domcontentloaded',+ timeout: 60000,+ });+ await page.getByRole('tab', { name: 'Debug', exact: true }).waitFor();+ const notice = page.getByTestId('resource-guest-read-precaution');+ await notice.waitFor();+ const precaution = await notice.innerText();+ assert.match(precaution, /does not prove thaw/);+ await activate(page.getByRole('tab', { name: 'Debug', exact: true }));+ assert.match(await summary('Proxmox').innerText(), /deferred • 1 min ago/);+ assert.match(await summary('Agent').innerText(), /stale • 2 mins ago/);+ await activate(summary('Proxmox'));+ assert(await summary('Proxmox').evaluate((el) => el.parentElement.open));+ const heldElement = await summary('Proxmox').elementHandle();+ const heldPayload = await summary('Proxmox').locator('..').locator('pre').innerText();+ const heldResource = await page.evaluate(() =>+ JSON.stringify(window.__sourceEvidenceAge.snapshot()),+ );+ const copy = () => page.getByRole('button', { name: /^(Copy JSON|Copied)$/ });+ await activate(copy());+ await page.waitForFunction(() => window.__sourceEvidenceClipboard.length === 1);+ await summary('Proxmox').focus();+ await capture('initial');+ await page.clock.fastForward(2 * 3_600_000);+ record.sourceAgeAfterTwoHours = await summary('Proxmox').innerText();+ const expected =+ binding.mode === 'parent' ? /deferred • 1 min ago/ : /deferred • 2 hours ago/;+ assert.match(record.sourceAgeAfterTwoHours, expected);+ assert.match(+ await summary('Agent').innerText(),+ binding.mode === 'parent' ? /stale • 2 mins ago/ : /stale • 2 hours ago/,+ );+ assert(await summary('Proxmox').evaluate((el, held) => el === held, heldElement));+ assert(+ await summary('Proxmox').evaluate(+ (el) => el.parentElement.open && document.activeElement === el,+ ),+ );+ assert.equal(await summary('Proxmox').locator('..').locator('pre').innerText(), heldPayload);+ assert.equal(+ await page.evaluate(() => JSON.stringify(window.__sourceEvidenceAge.snapshot())),+ heldResource,+ );+ assert.equal(await notice.innerText(), precaution);+ await activate(copy());+ await page.waitForFunction(() => window.__sourceEvidenceClipboard.length === 2);+ const copies = await page.evaluate(() => window.__sourceEvidenceClipboard);+ assert.equal(copies[0], copies[1]);+ const bundle = JSON.parse(copies[1]);+ assert.equal(bundle.sources.sourceStatus.proxmox.lastSeen, start - 60_000);+ assert.equal(bundle.sources.proxmox.diskStatusReason, 'prev-agent-timeout');+ record.checks.push(+ 'Held feed: source-age discrimination; same disclosure/focus/payload/clipboard timestamps/precaution, no new observation',+ );+ await capture('held-two-hours');+ await activate(page.getByRole('tab', { name: 'Overview', exact: true }));+ const lastSeenRow = page.getByText('Last seen', { exact: true }).locator('..');+ assert.match(await lastSeenRow.innerText(), /2 hours ago/);+ record.overviewAgeAfterTwoHours = await lastSeenRow.innerText();+ record.checks.push(+ 'Real Overview already advances, discriminating the parent Debug-only defect',+ );+ await activate(page.getByRole('tab', { name: 'Debug', exact: true }));+ assert.match(await summary('Proxmox').innerText(), expected);+ await page.evaluate(() => window.__sourceEvidenceAge.replace());+ assert.match(await summary('Proxmox').innerText(), /available • 0s ago/);+ assert.equal(await page.getByText('Guest read deferred', { exact: true }).count(), 0);+ assert.equal(await summary('Agent').count(), 0);+ await page.clock.fastForward(60_000);+ assert.match(+ await summary('Proxmox').innerText(),+ binding.mode === 'parent' ? /available • 0s ago/ : /available • 1 min ago/,+ );+ record.checks.push(+ 'Ordinary same-resource platformData replacement updates server status and removes the old error/source; subsequent age discrimination',+ );+ await page.evaluate(() => window.__sourceEvidenceAge.missingTimes());+ await page.clock.fastForward(60_000);+ assert.doesNotMatch(await summary('Proxmox').innerText(), /•/);+ assert.doesNotMatch(await summary('Agent').innerText(), /•/);+ assert.match(await summary('Docker').innerText(), /unknown/);+ record.checks.push(+ 'Missing/invalid timestamps remain without invented ages; absent status remains unknown',+ );+ await capture('unknown-times');+ await page.evaluate(() => window.__sourceEvidenceAge.unmount());+ assert.equal(await page.getByRole('tab', { name: 'Debug' }).count(), 0);+ await page.clock.fastForward(60_000);+ await page.evaluate(() => window.__sourceEvidenceAge.remount());+ await activate(page.getByRole('tab', { name: 'Debug', exact: true }));+ assert.match(await summary('Proxmox').innerText(), /deferred/);+ assert(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1));+ assert.deepEqual(record.writes, []);+ assert.deepEqual(record.unexpectedReads, []);+ assert.deepEqual(record.offOrigin, []);+ assert.deepEqual(record.errors, []);+ record.checks.push(+ 'Unmount/remount works; no horizontal page overflow, API writes, unexpected reads, off-origin traffic or page errors',+ );+ record.completed = true;+ await browser.close();+ browser = undefined;+ }+ result.completed = true;+ } catch (error) {+ result.error = { name: error.name, message: error.message };+ process.exitCode = 1;+ } finally {+ try {+ if (browser) await browser.close();+ result.cleanup.browsersClosed = true;+ } catch (error) {+ result.cleanup.browserError = error.message;+ process.exitCode = 1;+ }+ try {+ await server.close();+ result.cleanup.serverClosed = true;+ } catch (error) {+ result.cleanup.serverError = error.message;+ process.exitCode = 1;+ }+ fs.writeFileSync(output + '/result.json', JSON.stringify(result, null, 2) + '\n');+ console.log(+ JSON.stringify({+ completed: result.completed,+ output,+ error: result.error,+ cases: result.cases.length,+ cleanup: result.cleanup,+ }),+ );+ }+})().catch((error) => {+ console.error(error);+ process.exitCode = 1;+});diff --git a/frontend-modern/browser-tests/source-evidence-age.html b/frontend-modern/browser-tests/source-evidence-age.htmlnew file mode 100644index 0000000000..04cda86be5--- /dev/null+++ b/frontend-modern/browser-tests/source-evidence-age.html@@ -0,0 +1,12 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Resource source evidence ages</title>+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="/browser-tests/source-evidence-age.tsx"></script>+ </body>+</html>diff --git a/frontend-modern/browser-tests/source-evidence-age.tsx b/frontend-modern/browser-tests/source-evidence-age.tsxnew file mode 100644index 0000000000..4b7adf3eee--- /dev/null+++ b/frontend-modern/browser-tests/source-evidence-age.tsx@@ -0,0 +1,96 @@+// The production canonical drawer, state and CSS with local synthetic evidence.+// No guest agent, backup, restart, poll, scan or update action is performed.+import { createSignal, Show } from 'solid-js';+import { render } from 'solid-js/web';+import { Route, Router } from '@solidjs/router';+import { ResourceDetailDrawer } from '../src/components/Infrastructure/ResourceDetailDrawer';+import { DarkModeContext, WebSocketContext } 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-11T10:00:00Z');+syncAIRuntimeSettings({ discovery_enabled: false });+const initial: Resource = {+ id: 'fixture:pve-a:101',+ name: 'Held backup guest',+ displayName: 'Held backup guest',+ platformId: '101',+ platformType: 'proxmox-pve',+ platformScopes: ['proxmox-pve', 'agent'],+ sourceType: 'hybrid',+ sources: ['proxmox', 'agent'],+ status: 'online',+ type: 'vm',+ lastSeen: start - 60_000,+ proxmox: {+ vmid: 101,+ nodeName: 'pve-a',+ guestAgentStatus: 'deferred',+ diskStatusReason: 'prev-agent-timeout',+ },+ platformData: {+ proxmox: { vmid: 101, node: 'pve-a', diskStatusReason: 'prev-agent-timeout' },+ agent: { id: 'fixture-agent' },+ sourceStatus: {+ proxmox: { status: 'deferred', lastSeen: start - 60_000, error: 'Guest read deferred' },+ agent: { status: 'stale', lastSeen: new Date(start - 120_000).toISOString() },+ },+ },+};++function Fixture() {+ const [resource, setResource] = createSignal(initial);+ const [mounted, setMounted] = createSignal(true);+ (window as any).__sourceEvidenceAge = {+ snapshot: () => resource(),+ unmount: () => setMounted(false),+ remount: () => setMounted(true),+ replace: () =>+ setResource({+ ...initial,+ lastSeen: Date.now(),+ proxmox: { ...initial.proxmox, guestAgentStatus: 'available', diskStatusReason: '' },+ platformData: {+ proxmox: { vmid: 101, node: 'pve-a', diskStatusReason: '' },+ sourceStatus: { proxmox: { status: 'available', lastSeen: Date.now() } },+ },+ }),+ missingTimes: () =>+ setResource({+ ...initial,+ platformData: {+ proxmox: { vmid: 101, node: 'pve-a' },+ agent: { id: 'fixture-agent' },+ docker: { id: 'fixture-docker' },+ sourceStatus: {+ proxmox: { status: 'deferred' },+ agent: { status: 'stale', lastSeen: 'not-a-date', error: 'No usable timestamp' },+ },+ },+ }),+ };+ return (+ <main class="mx-auto min-h-screen max-w-4xl space-y-3 bg-surface p-3 text-base-content">+ <h1 class="text-base font-semibold">Resource source evidence ages</h1>+ <p class="text-xs text-muted">Synthetic local snapshots. No guest operation is sent.</p>+ <Show when={mounted()}>+ <ResourceDetailDrawer resource={resource()} presentation="table-row" />+ </Show>+ </main>+ );+}+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')!,+);diff --git a/frontend-modern/browser-verification/146327626df3310a.json b/frontend-modern/browser-verification/146327626df3310a.jsonnew file mode 100644index 0000000000..6c17e24524--- /dev/null+++ b/frontend-modern/browser-verification/146327626df3310a.json@@ -0,0 +1,37 @@+{+ "version": 1,+ "base_sha": "6626f51131790a6798821dff9c40094d418b1560",+ "verified_at": "2026-10-11T10:45:59Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx"+ ],+ "content_sha256": {+ "frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx": "da57d9cd5eee01072104c2fadafb53880ac737a5c238f6aa248f8af786072677"+ },+ "routes": [+ "/browser-tests/source-evidence-age.html (synthetic production ResourceDetailDrawer/Debug and Overview, not an added application route)"+ ],+ "viewports": [+ {+ "width": 1280,+ "height": 950+ },+ {+ "width": 390,+ "height": 950+ }+ ],+ "states": [+ "Playwright 1.56.1 matches integration lock; Chromium 141.0.7390.37 desktop/light and WebKit 26.0 phone/dark. Production drawer/state/CSS on final source bytes with local synthetic snapshots; no native guest or server.",+ "Held Proxmox/Agent lastSeen ages advance from one/two minutes to two hours while original timestamp, payload, deferred/stale status and backup precaution remain unchanged. Real Overview agrees; no new observation inferred.",+ "Ordinary same-resource platformData replacement removes the old error/source and reads available with the new server timestamp, then ages that unchanged timestamp to one minute.",+ "Missing/invalid source times show no invented age; missing status remains unknown. Six screenshots inspected: initial, two-hour held feed and missing-times states for each engine. No horizontal page overflow, page errors, API requests/writes or off-origin traffic."+ ],+ "interactions": [+ "Desktop Enter and phone tap enter Debug, open native Proxmox details and copy JSON. Source disclosure and focused summary survive clock ticks without remount.",+ "Copy JSON twice around two simulated hours: exact same JSON, source timestamp and disk deferral; no read, write, restart or probe.",+ "Switch to Overview and back with the unchanged resource; source age stays correct. Replace local same-resource snapshot and check new server status/error/source removal and subsequent aging.",+ "Supply missing/invalid timestamps; unmount, advance time and remount drawer, then open Debug again. No exception or invented currentness."+ ]+}diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsxindex 9d4b44a7f1..5bc6a86416 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx@@ -3,6 +3,7 @@ import type { Component } from 'solid-js';import { Button } from '@/components/shared/Button';import type { Resource } from '@/types/resource';import { formatRelativeTime } from '@/utils/format';+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';import type { UseResourceDetailDrawerStateResult } from './useResourceDetailDrawerState';interface ResourceDetailDrawerDebugTabProps {@@ -14,6 +15,7 @@ export const ResourceDetailDrawerDebugTab: Component<ResourceDetailDrawerDebugTaprops,) => {const { drawer } = props;+ const now = useRelativeTimeNow();return (<div class="space-y-3">@@ -66,14 +68,16 @@ export const ResourceDetailDrawerDebugTab: Component<ResourceDetailDrawerDebugTa<For each={drawer.sourceSections()}>{(section) => {const status = drawer.sourceStatus()[section.id];- const lastSeenText = formatRelativeTime(status?.lastSeen);+ // A silent source keeps the same section mounted. Age its+ // original timestamp without renewing the reading or status.+ const lastSeenText = () => formatRelativeTime(status?.lastSeen, { now: now() });return (<details class="rounded-md border border-border bg-surface p-3"><summary class="flex cursor-pointer list-none items-center justify-between text-sm font-medium text-base-content"><span>{section.label}</span><span class="text-[11px] text-muted">{status?.status ?? 'unknown'}- {lastSeenText ? ` • ${lastSeenText}` : ''}+ {lastSeenText() ? ` • ${lastSeenText()}` : ''}</span></summary><Show when={status?.error}>diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawerDebugTab.relativeAge.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawerDebugTab.relativeAge.test.tsxnew file mode 100644index 0000000000..330007978c--- /dev/null+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawerDebugTab.relativeAge.test.tsx@@ -0,0 +1,176 @@+import { cleanup, fireEvent, render, within } from '@solidjs/testing-library';+import { createSignal, Show } from 'solid-js';+import { afterEach, describe, expect, it, vi } from 'vitest';++import type { Resource } from '@/types/resource';+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';+import { ResourceDetailDrawerDebugTab } from '../ResourceDetailDrawerDebugTab';+import type { PlatformData } from '../resourceDetailMappers';+import { useResourceDetailDrawerDerivedState } from '../useResourceDetailDrawerDerivedState';+import type { UseResourceDetailDrawerStateResult } from '../useResourceDetailDrawerState';++const start = Date.parse('2026-10-11T10:00:00Z');+const makeResource = (): Resource => ({+ id: 'fixture:pve-a:101',+ name: 'Backup guest',+ displayName: 'Backup guest',+ type: 'vm',+ platformId: '101',+ platformType: 'proxmox-pve',+ sourceType: 'hybrid',+ status: 'online',+ lastSeen: start - 60_000,+ platformData: {+ proxmox: { vmid: 101, node: 'pve-a', diskStatusReason: 'prev-agent-timeout' },+ agent: { id: 'fixture-agent' },+ sourceStatus: {+ proxmox: { status: 'deferred', lastSeen: start - 60_000, error: 'Guest read deferred' },+ agent: { status: 'stale', lastSeen: new Date(start - 120_000).toISOString() },+ },+ },+});++// Use the production derived state, including its real platformData/section+// replacement behaviour. Only the clipboard action is replaced here.+function Fixture(props: { resource: Resource; onCopy?: (json: string) => void }) {+ const derived = useResourceDetailDrawerDerivedState({+ get resource() {+ return props.resource;+ },+ debugEnabled: () => true,+ discoveryFeatureEnabled: () => false,+ resourceIntelligence: () => null,+ });+ const drawer = {+ ...derived,+ copied: () => false,+ handleCopyJson: () => props.onCopy?.(derived.debugJson()),+ } as unknown as UseResourceDetailDrawerStateResult;+ return (+ <>+ <output data-testid="drawer-last-seen">{derived.lastSeen()}</output>+ <ResourceDetailDrawerDebugTab resource={props.resource} drawer={drawer} />+ </>+ );+}++const hoursLater = (hours: number) => {+ vi.setSystemTime(Date.now() + hours * 3_600_000);+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);+};++afterEach(() => {+ cleanup();+ vi.useRealTimers();+});++describe('resource Debug source ages', () => {+ it('ages held source timestamps with the drawer without receiving another snapshot', () => {+ vi.useFakeTimers({ now: start });+ const resource = makeResource();+ const view = render(() => <Fixture resource={resource} />);+ const summaries = () =>+ [...view.container.querySelectorAll('summary')].map((el) => el.textContent);++ expect(summaries()).toEqual(['Proxmoxdeferred • 1 min ago', 'Agentstale • 2 mins ago']);+ hoursLater(2);++ expect(within(view.container).getByTestId('drawer-last-seen')).toHaveTextContent('2 hours ago');+ expect(summaries()).toEqual(['Proxmoxdeferred • 2 hours ago', 'Agentstale • 2 hours ago']);+ expect((resource.platformData as PlatformData).sourceStatus?.proxmox.lastSeen).toBe(+ start - 60_000,+ );+ expect(within(view.container).getByText('Guest read deferred')).toBeInTheDocument();+ });++ it('keeps disclosure, focus, source payload and copied JSON unchanged across age ticks', () => {+ vi.useFakeTimers({ now: start });+ const copied = vi.fn();+ const view = render(() => <Fixture resource={makeResource()} onCopy={copied} />);+ const details = view.container.querySelector<HTMLDetailsElement>('details')!;+ const summary = details.querySelector('summary')!;+ const copy = within(view.container).getByRole('button', { name: 'Copy JSON' });+ fireEvent.click(copy);+ const original = copied.mock.calls[0][0];+ details.open = true;+ summary.focus();+ const payload = details.querySelector('pre')!.textContent;++ hoursLater(4);++ expect(summary).toHaveTextContent('deferred • 4 hours ago');+ expect(view.container.querySelector('details')).toBe(details);+ expect(details.open).toBe(true);+ expect(summary).toHaveFocus();+ expect(details.querySelector('pre')!.textContent).toBe(payload);+ fireEvent.click(copy);+ expect(copied.mock.calls[1][0]).toBe(original);+ const bundle = JSON.parse(original);+ expect(bundle.sources.proxmox.diskStatusReason).toBe('prev-agent-timeout');+ expect(bundle.sources.sourceStatus.proxmox.status).toBe('deferred');+ expect(bundle.sources.sourceStatus.proxmox.lastSeen).toBe(start - 60_000);+ });++ it('still follows ordinary platformData replacements rather than retaining old status or errors', () => {+ vi.useFakeTimers({ now: start });+ const [resource, setResource] = createSignal(makeResource());+ const view = render(() => <Fixture resource={resource()} />);+ setResource({+ ...resource(),+ platformData: {+ proxmox: { vmid: 101, node: 'pve-a', diskStatusReason: '' },+ sourceStatus: { proxmox: { status: 'available', lastSeen: start } },+ },+ });+ expect(view.container.querySelector('summary')).toHaveTextContent('available • 0s ago');+ expect(within(view.container).queryByText('Guest read deferred')).not.toBeInTheDocument();+ expect(view.container.querySelectorAll('details')).toHaveLength(1);++ vi.advanceTimersByTime(60_000);++ expect(view.container.querySelector('summary')).toHaveTextContent('available • 1 min ago');+ });++ it('does not invent ages or freshness for absent and invalid source timestamps', () => {+ vi.useFakeTimers({ now: start });+ const resource = makeResource();+ resource.platformData = {+ proxmox: { vmid: 101 },+ agent: { id: 'fixture-agent' },+ docker: { id: 'fixture-docker' },+ sourceStatus: {+ proxmox: { status: 'deferred' },+ agent: { status: 'stale', lastSeen: 'not-a-date', error: 'No usable timestamp' },+ },+ };+ const view = render(() => <Fixture resource={resource} />);+ hoursLater(2);+ expect([...view.container.querySelectorAll('summary')].map((el) => el.textContent)).toEqual([+ 'Proxmoxdeferred',+ 'Agentstale',+ 'Dockerunknown',+ ]);+ expect(within(view.container).getByText('No usable timestamp')).toBeInTheDocument();+ });++ it('shares one clock across drawers and releases it when the last drawer unmounts', () => {+ vi.useFakeTimers({ now: start });+ const [first, setFirst] = createSignal(true);+ const [second, setSecond] = createSignal(true);+ render(() => (+ <>+ <Show when={first()}>+ <Fixture resource={makeResource()} />+ </Show>+ <Show when={second()}>+ <Fixture resource={makeResource()} />+ </Show>+ </>+ ));+ expect(vi.getTimerCount()).toBe(1);+ setFirst(false);+ expect(vi.getTimerCount()).toBe(1);+ setSecond(false);+ expect(vi.getTimerCount()).toBe(0);+ });+});