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 token, doctor and drawer ages ticking on the shared clock

rcourtman1a60fa8341d5
diff --git a/frontend-modern/browser-verification/68138f0944a09041.json b/frontend-modern/browser-verification/68138f0944a09041.json
new file mode 100644
index 0000000000..5a75504249
--- /dev/null
+++ b/frontend-modern/browser-verification/68138f0944a09041.json
@@ -0,0 +1,59 @@
+{
+ "version": 1,
+ "base_sha": "39dcdc4ba5b2b17d27d0f121049808e5f4d05578",
+ "verified_at": "2026-10-16T22:50:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx",
+ "frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx",
+ "frontend-modern/src/components/Settings/APITokenManager.tsx",
+ "frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx",
+ "frontend-modern/src/components/Settings/InfrastructureAgentDoctorPage.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx": "e6bde0c1e54e65978cc884b3cc4692029a029a6795bfa6bd89918ea682ab9c2c",
+ "frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx": "88961b2058d5a2c65e854a41ed3d5289adcce090efb43d52b66558fbc5e61217",
+ "frontend-modern/src/components/Settings/APITokenManager.tsx": "f55a8fbfb24d73e1ca97d9331d8cb7135f02d192eaa2b3666ebdf1b59d38c8f2",
+ "frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx": "ce16b2cbcca1f2cf8e693dd30facba35c635031127def00c38fd811d6ad77d63",
+ "frontend-modern/src/components/Settings/InfrastructureAgentDoctorPage.tsx": "1e7f81b175567fc32ac679606ea46b87c24c600002037437a8192c7aefe27f34"
+ },
+ "routes": [
+ "/settings/security/api",
+ "/settings/support/diagnostics",
+ "/settings/infrastructure/agent-doctor",
+ "/standalone/availability?view=fleet"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Production vite build of origin/main a93b5be1d3 plus this change, served by vite preview and proxied to the pulse-dev :7699 mock-estate rig, signed in through the real login form",
+ "API Access token inventory with one injected token (lastUsedAt one minute before the page clock): Last used read '1 min ago' and 'Created 1 day ago' at both widths",
+ "Diagnostics & Health after Run Diagnostics, response passed through with discovery.lastScanStartedAt set one minute back: Last Scan read '1m ago'",
+ "Agent Doctor with the rig's live agents: the compact Seen label is visible only at phone width ('4h ago'); at 1440 the table shows the absolute Last seen column and no relative label",
+ "Availability fleet drawer (non-table-row presentation, remote history on): Overview Relationship map with one relationship injected into the real facet response read 'last seen 1m ago'",
+ "Same drawer Manage tab with one stubbed action audit: Action history row read '2 hours ago \u2022 admin' before the second clock jump"
+ ],
+ "interactions": [
+ "Installed the page clock (Playwright clock), then jumped it forward two hours per surface with no navigation, refetch or other input",
+ "API token Last used advanced 1 min ago -> 2 hours ago (desktop and phone)",
+ "Diagnostics Last Scan advanced 1m ago -> 2h ago (desktop and phone)",
+ "Agent Doctor phone Seen labels advanced 4h ago -> 6h ago",
+ "Relationship map last seen advanced 1m/2m ago -> 2h ago (desktop and phone)",
+ "Action history row advanced 2 hours ago -> 4 hours ago (desktop and phone)",
+ "Clicked Run Diagnostics, opened a fleet card drawer, switched Overview -> Manage"
+ ],
+ "browser": {
+ "client": "1.62.1",
+ "engine": "Chromium",
+ "version": "151.0.7922.34"
+ },
+ "scope": "Real authenticated app against the synthetic mock rig. API token list, diagnostics discovery field, relationship facet and action-audit list were injected or patched with page.route because the mock estate has none with a recent timestamp; Agent Doctor used live rig data. Ticking was driven by the Playwright page clock, so data pushes from the rig were not excluded at that layer; the vitest fake-timer tests prove the label advances with no other re-render."
+}
diff --git a/frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx b/frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx
index 832519f959..f42cc164e6 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx
@@ -3,6 +3,7 @@ import type { Component } from 'solid-js';
import { InfoCardFrame, InfoCardKeyValueRow } from '@/components/shared/InfoCardFrame';
import type { ActionAuditRecord } from '@/types/actionAudit';
import { formatRelativeTime } from '@/utils/format';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import {
formatActionApprovalPolicyLabel,
formatActionCapabilityLabel,
@@ -23,6 +24,7 @@ interface ResourceActionHistoryProps {
}
const ActionHistoryRow: Component<{ audit: ActionAuditRecord }> = (props) => {
+ const now = useRelativeTimeNow();
const state = () => getActionAuditRecordStatePresentation(props.audit);
const preflight = () => props.audit.plan?.preflight;
const resultPresentation = () => getActionAuditResultPresentation(props.audit);
@@ -39,7 +41,7 @@ const ActionHistoryRow: Component<{ audit: ActionAuditRecord }> = (props) => {
{formatActionCapabilityLabel(props.audit.request?.capabilityName)}
</div>
<div class="mt-0.5 text-muted">
- {formatRelativeTime(props.audit.updatedAt || props.audit.createdAt)}
+ {formatRelativeTime(props.audit.updatedAt || props.audit.createdAt, { now: now() })}
<Show when={props.audit.request?.requestedBy}>
<span class="mx-1">•</span>
<span>{props.audit.request.requestedBy}</span>
diff --git a/frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx
index 4559de409d..666da818ae 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx
@@ -2,6 +2,7 @@ import { For, Show, createMemo, type Component } from 'solid-js';
import type { ResourceCorrelation } from '@/types/aiIntelligence';
import type { ResourceRelationship } from '@/types/resource';
import { formatRelativeTime } from '@/utils/format';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import {
formatResourceCorrelationEndpoint,
formatResourceCorrelationHeadline,
@@ -30,6 +31,7 @@ interface ResourceCorrelationSummaryProps {
}
export const ResourceCorrelationSummary: Component<ResourceCorrelationSummaryProps> = (props) => {
+ const now = useRelativeTimeNow();
const className = () => props.class?.trim() ?? '';
const correlations = createMemo(() => sortResourceCorrelations(props.correlations ?? []));
const relationships = createMemo(() => sortResourceRelationships(props.relationships ?? []));
@@ -83,11 +85,12 @@ export const ResourceCorrelationSummary: Component<ResourceCorrelationSummaryPro
const targetHref = buildResourceHref(relationship.targetId);
const typeLabel = formatResourceRelationshipType(relationship);
const summary = formatResourceRelationshipSummary(relationship);
- const lastSeenLabel =
+ const lastSeenLabel = () =>
props.showLastSeen && relationship.lastSeenAt
? formatRelativeTime(relationship.lastSeenAt, {
compact: true,
emptyText: 'just now',
+ now: now(),
})
: '';
@@ -125,12 +128,12 @@ export const ResourceCorrelationSummary: Component<ResourceCorrelationSummaryPro
{typeLabel}
</span>
</div>
- <Show when={summary || lastSeenLabel}>
+ <Show when={summary || lastSeenLabel()}>
<div class="mt-0.5 text-[10px] text-muted">
{summary}
- <Show when={lastSeenLabel}>
+ <Show when={lastSeenLabel()}>
<>
- {summary ? ' · ' : ''}last seen {lastSeenLabel}
+ {summary ? ' · ' : ''}last seen {lastSeenLabel()}
</>
</Show>
</div>
@@ -210,11 +213,12 @@ export const ResourceCorrelationSummary: Component<ResourceCorrelationSummaryPro
const sourceLabel = formatResourceCorrelationEndpoint(correlation, 'source');
const targetLabel = formatResourceCorrelationEndpoint(correlation, 'target');
const patternLabel = formatResourceCorrelationPattern(correlation);
- const lastSeenLabel =
+ const lastSeenLabel = () =>
props.showLastSeen && correlation.last_seen
? formatRelativeTime(correlation.last_seen, {
compact: true,
emptyText: 'just now',
+ now: now(),
})
: '';
return (
@@ -253,8 +257,8 @@ export const ResourceCorrelationSummary: Component<ResourceCorrelationSummaryPro
</div>
<div class="mt-0.5 text-[10px] text-muted">
{summary}
- <Show when={lastSeenLabel}>
- <> · last seen {lastSeenLabel}</>
+ <Show when={lastSeenLabel()}>
+ <> · last seen {lastSeenLabel()}</>
</Show>
</div>
<Show when={correlation.description}>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceActionHistory.verification.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/ResourceActionHistory.verification.test.ts
index 320530f913..38a2eadf28 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceActionHistory.verification.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceActionHistory.verification.test.ts
@@ -1,6 +1,6 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
-import { describe, expect, it } from 'vitest';
+import { afterEach, describe, expect, it, vi } from 'vitest';
import { cleanup, render, screen, within } from '@solidjs/testing-library';
import { ResourceActionHistory } from '../ResourceActionHistory';
@@ -154,6 +154,33 @@ describe('ResourceActionHistory verification rendering', () => {
});
});
+describe('ResourceActionHistory row age', () => {
+ afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ });
+
+ it('ages the row timestamp on the shared clock without new audits', async () => {
+ const start = Date.parse('2026-10-16T22:00:00Z');
+ vi.useFakeTimers({ now: start });
+ render(() =>
+ ResourceActionHistory({
+ audits: [{ ...actionAudit(), updatedAt: new Date(start - 60_000).toISOString() }],
+ count: 1,
+ loadingLabel: 'Actions loaded',
+ error: '',
+ onRetry: () => undefined,
+ }),
+ );
+
+ const history = within(screen.getByTestId('resource-action-history-section'));
+ expect(history.getByText('1 min ago')).toBeInTheDocument();
+ await vi.advanceTimersByTimeAsync(2 * 3_600_000);
+ expect(history.queryByText('1 min ago')).toBeNull();
+ expect(history.getByText('2 hours ago')).toBeInTheDocument();
+ });
+});
+
const actionAudit = (overrides: Partial<ActionAuditRecord> = {}): ActionAuditRecord => ({
id: overrides.id ?? 'action-1',
createdAt: '2026-04-29T12:00:00Z',
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceCorrelationSummary.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceCorrelationSummary.test.tsx
index d2e7a06511..2eb53985da 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceCorrelationSummary.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceCorrelationSummary.test.tsx
@@ -1,9 +1,58 @@
-import { render, screen } from '@solidjs/testing-library';
-import { describe, expect, it } from 'vitest';
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
import { ResourceCorrelationSummary } from '../ResourceCorrelationSummary';
describe('ResourceCorrelationSummary', () => {
+ afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ });
+
+ it('ages relationship and correlation last-seen labels on the shared clock', async () => {
+ const start = Date.parse('2026-10-16T22:00:00Z');
+ vi.useFakeTimers({ now: start });
+ const minuteAgo = new Date(start - 60_000).toISOString();
+ render(() => (
+ <ResourceCorrelationSummary
+ relationships={[
+ {
+ sourceId: 'node:pve-1',
+ targetId: 'vm-child',
+ type: 'runs_on',
+ confidence: 1,
+ active: true,
+ discoverer: 'proxmox_adapter',
+ observedAt: minuteAgo,
+ lastSeenAt: minuteAgo,
+ },
+ ]}
+ correlations={[
+ {
+ source_id: 'storage-1',
+ source_name: 'Storage 1',
+ source_type: 'storage',
+ target_id: 'host-1',
+ target_name: 'Host 1',
+ target_type: 'vm',
+ event_pattern: 'disk_full -> restart',
+ occurrences: 2,
+ avg_delay: 125000000000,
+ confidence: 0.875,
+ last_seen: minuteAgo,
+ description: 'Disk pressure often precedes restarts',
+ },
+ ]}
+ showLastSeen
+ />
+ ));
+
+ expect(screen.getAllByText(/last seen 1m ago/)).toHaveLength(2);
+ await vi.advanceTimersByTimeAsync(2 * 3_600_000);
+ expect(screen.queryAllByText(/last seen 1m ago/)).toHaveLength(0);
+ expect(screen.getAllByText(/last seen 2h ago/)).toHaveLength(2);
+ });
+
it('renders learned correlations with canonical labels and totals', () => {
render(() => (
<ResourceCorrelationSummary
diff --git a/frontend-modern/src/components/Settings/APITokenManager.tsx b/frontend-modern/src/components/Settings/APITokenManager.tsx
index 99cdb619e8..505e3a70fc 100644
--- a/frontend-modern/src/components/Settings/APITokenManager.tsx
+++ b/frontend-modern/src/components/Settings/APITokenManager.tsx
@@ -548,7 +548,7 @@ export const APITokenManager: Component<APITokenManagerProps> = (props) => {
</div>
<div class="mt-1 text-xs text-base-content">
{token.lastUsedAt
- ? formatRelativeTime(new Date(token.lastUsedAt).getTime())
+ ? formatRelativeTime(new Date(token.lastUsedAt).getTime(), { now: now() })
: 'Never'}
</div>
</div>
@@ -620,7 +620,7 @@ export const APITokenManager: Component<APITokenManagerProps> = (props) => {
render: (token) => (
<span class="text-muted">
{token.lastUsedAt
- ? formatRelativeTime(new Date(token.lastUsedAt).getTime())
+ ? formatRelativeTime(new Date(token.lastUsedAt).getTime(), { now: now() })
: 'Never'}
</span>
),
diff --git a/frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx b/frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx
index d018c98ef7..dde464da2c 100644
--- a/frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx
+++ b/frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx
@@ -1,6 +1,7 @@
import { Component, For, Show } from 'solid-js';
import type { JSX } from 'solid-js';
import { formatRelativeTime } from '@/utils/format';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import { Card } from '@/components/shared/Card';
import { CalloutCard } from '@/components/shared/CalloutCard';
import Activity from 'lucide-solid/icons/activity';
@@ -72,6 +73,7 @@ interface DiagnosticsResultsPanelProps {
}
export const DiagnosticsResultsPanel: Component<DiagnosticsResultsPanelProps> = (props) => {
+ const now = useRelativeTimeNow();
return (
<Show
when={props.diagnosticsData}
@@ -252,6 +254,7 @@ export const DiagnosticsResultsPanel: Component<DiagnosticsResultsPanelProps> =
value={formatRelativeTime(props.diagnosticsData?.discovery?.lastScanStartedAt, {
compact: true,
emptyText: 'Never',
+ now: now(),
})}
/>
<MetricRow
diff --git a/frontend-modern/src/components/Settings/InfrastructureAgentDoctorPage.tsx b/frontend-modern/src/components/Settings/InfrastructureAgentDoctorPage.tsx
index a7edfdc74e..b5a7b37bc2 100644
--- a/frontend-modern/src/components/Settings/InfrastructureAgentDoctorPage.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureAgentDoctorPage.tsx
@@ -13,6 +13,7 @@ import {
import { InlineDetailTableRow } from '@/components/shared/InlineDetailTableRow';
import { copyToClipboard } from '@/utils/clipboard';
import { formatRelativeTime } from '@/utils/format';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import { notificationStore } from '@/stores/notifications';
import { MonitoringAPI } from '@/api/monitoring';
import { AgentDiagnosticsAPI } from '@/api/agentDiagnostics';
@@ -81,6 +82,7 @@ const formatLastSeen = (value?: number | string | null): string | undefined => {
export const InfrastructureAgentDoctorPage: Component<InfrastructureAgentDoctorPageProps> = (
props,
) => {
+ const now = useRelativeTimeNow();
const operations = useInfrastructureOperationsContext();
const summary = createMemo(() => summarizeInfrastructureAgentDoctorTargets(props.targets));
const anyTargetNeedsRepair = createMemo(() =>
@@ -515,6 +517,7 @@ export const InfrastructureAgentDoctorPage: Component<InfrastructureAgentDoctorP
formatRelativeTime(target.lastSeen ?? undefined, {
compact: true,
emptyText: '—',
+ now: now(),
});
const command = () =>
target.connection && target.commandPlatform
diff --git a/frontend-modern/src/components/Settings/__tests__/APITokenManager.test.tsx b/frontend-modern/src/components/Settings/__tests__/APITokenManager.test.tsx
index 174d9ecd72..39f9e49d79 100644
--- a/frontend-modern/src/components/Settings/__tests__/APITokenManager.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/APITokenManager.test.tsx
@@ -143,13 +143,15 @@ const getTokenTableRow = (name: string): HTMLTableRowElement => {
return row;
};
-const createdTokenCell = (row: HTMLTableRowElement) => {
+const tokenCell = (row: HTMLTableRowElement, label: string) => {
const headers = [...row.closest('table')!.querySelectorAll('thead th')];
- const index = headers.findIndex((header) => header.textContent?.trim() === 'Created');
- if (index < 0) throw new Error('Token table has no Created header');
+ const index = headers.findIndex((header) => header.textContent?.trim() === label);
+ if (index < 0) throw new Error(`Token table has no ${label} header`);
return row.cells[index];
};
+const createdTokenCell = (row: HTMLTableRowElement) => tokenCell(row, 'Created');
+
const findTokenTableRow = async (name: string): Promise<HTMLTableRowElement> => {
await screen.findAllByText(name);
return getTokenTableRow(name);
@@ -212,6 +214,29 @@ describe('APITokenManager', () => {
view.unmount();
});
+ it('ages Last used in both layouts without another list read', async () => {
+ const start = Date.parse('2026-10-16T22:00:00Z');
+ vi.useFakeTimers({ now: start });
+ const token = makeToken({
+ createdAt: new Date(start - 86_400_000).toISOString(),
+ lastUsedAt: new Date(start - 60_000).toISOString(),
+ });
+ listTokensMock.mockResolvedValue([token]);
+ const view = render(() => <APITokenManager canManage />);
+ await vi.advanceTimersByTimeAsync(0);
+ const row = getTokenTableRow(token.name!);
+ const card = screen.getByRole('article', { name: `API token ${token.name}` });
+ const cardLastUsed = () => within(card).getByText('Last used').nextElementSibling;
+ expect(tokenCell(row, 'Last used')).toHaveTextContent('1 min ago');
+ expect(cardLastUsed()).toHaveTextContent('1 min ago');
+ await vi.advanceTimersByTimeAsync(2 * 3_600_000);
+ expect(tokenCell(row, 'Last used')).toHaveTextContent('2 hours ago');
+ expect(cardLastUsed()).toHaveTextContent('2 hours ago');
+ expect(getTokenTableRow(token.name!)).toBe(row);
+ expect(listTokensMock).toHaveBeenCalledTimes(1);
+ view.unmount();
+ });
+
beforeEach(() => {
listTokensMock.mockReset();
createTokenMock.mockReset();
diff --git a/frontend-modern/src/components/Settings/__tests__/DiagnosticsResultsPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/DiagnosticsResultsPanel.test.tsx
index 76bea92ccd..aa61d42efb 100644
--- a/frontend-modern/src/components/Settings/__tests__/DiagnosticsResultsPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/DiagnosticsResultsPanel.test.tsx
@@ -7,6 +7,52 @@ import type { DiagnosticsData } from '@/components/Settings/diagnosticsModel';
describe('DiagnosticsResultsPanel', () => {
afterEach(() => {
cleanup();
+ vi.useRealTimers();
+ });
+
+ it('ages the network discovery Last Scan label on the shared clock', async () => {
+ const start = Date.parse('2026-10-16T22:00:00Z');
+ vi.useFakeTimers({ now: start });
+ const diagnosticsData = {
+ version: '6.4.1',
+ runtime: 'go',
+ uptime: 3600,
+ nodes: [],
+ pbs: [],
+ system: {
+ os: 'linux',
+ arch: 'amd64',
+ goVersion: 'go1.26.7',
+ numCPU: 4,
+ numGoroutine: 40,
+ memoryMB: 24,
+ },
+ discovery: {
+ enabled: true,
+ lastScanStartedAt: new Date(start - 60_000).toISOString(),
+ },
+ errors: [],
+ } as DiagnosticsData;
+
+ render(() => (
+ <Router>
+ <Route
+ path="/"
+ component={() => (
+ <DiagnosticsResultsPanel
+ diagnosticsData={diagnosticsData}
+ loading={false}
+ onRunDiagnostics={() => {}}
+ />
+ )}
+ />
+ </Router>
+ ));
+
+ const lastScan = () => screen.getByText('Last Scan').nextElementSibling;
+ expect(lastScan()).toHaveTextContent('1m ago');
+ await vi.advanceTimersByTimeAsync(2 * 3_600_000);
+ expect(lastScan()).toHaveTextContent('2h ago');
});
it('keeps the empty-state action linked to its live-check safety explanation', () => {
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureAgentDoctorPage.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureAgentDoctorPage.test.tsx
index 80e13315ca..42c47595a4 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureAgentDoctorPage.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureAgentDoctorPage.test.tsx
@@ -1,5 +1,5 @@
import { fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
-import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { InfrastructureAgentDoctorPage } from '../InfrastructureAgentDoctorPage';
import type { InfrastructureAgentDoctorTarget } from '../infrastructureAgentUpdateCommandsModel';
@@ -154,6 +154,25 @@ describe('InfrastructureAgentDoctorPage action-runner enrollment', () => {
).toBeInTheDocument();
});
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ it('ages a target last-seen label on the shared clock without new targets', async () => {
+ const start = Date.parse('2026-10-16T22:00:00Z');
+ vi.useFakeTimers({ now: start });
+ render(() => (
+ <InfrastructureAgentDoctorPage
+ targets={[targetFixture({ status: 'warning', lastSeen: start - 60_000 })]}
+ />
+ ));
+
+ expect(screen.getByText('1m ago')).toBeInTheDocument();
+ await vi.advanceTimersByTimeAsync(2 * 3_600_000);
+ expect(screen.queryByText('1m ago')).not.toBeInTheDocument();
+ expect(screen.getByText('2h ago')).toBeInTheDocument();
+ });
+
it('keeps an attention row and its host-local repair guidance available through disclosure', () => {
render(() => (
<InfrastructureAgentDoctorPage