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 maintenance and update evidence current

pulse-triage[bot]20f36e1621a7
diff --git a/frontend-modern/browser-tests/held-operator-time.cjs b/frontend-modern/browser-tests/held-operator-time.cjs
new file mode 100644
index 0000000000..8c60e0cc97
--- /dev/null
+++ b/frontend-modern/browser-tests/held-operator-time.cjs
@@ -0,0 +1,517 @@
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const crypto = require('node:crypto');
+const { chromium, webkit } = require('playwright');
+
+const root = '/workspace/frontend-modern';
+const start = Date.parse('2026-10-11T04:00:00Z');
+const iso = (offset) => new Date(start + offset).toISOString();
+const origin = 'http://127.0.0.1:5343';
+const version = {
+ version: '6.5.0',
+ isDevelopment: false,
+ isDocker: false,
+ isSourceBuild: false,
+ deploymentType: 'systemd',
+};
+const update = {
+ available: false,
+ currentVersion: '6.5.0',
+ latestVersion: '6.5.0',
+ releaseNotes: '',
+ downloadUrl: '',
+ isPrerelease: false,
+ isMajorUpgrade: false,
+};
+const operatorState = (surface) => ({
+ canonicalId: surface,
+ intentionallyOffline: true,
+ monitoringMode: 'expected_offline',
+ lifecycleState: 'retired',
+ neverAutoRemediate: true,
+ note: 'Keep the saved lock',
+ setAt: iso(-60_000),
+ setBy: 'fixture-admin',
+ ...(surface === 'once'
+ ? { maintenanceStartAt: iso(30_000), maintenanceEndAt: iso(60_000) }
+ : {
+ maintenanceWindowActive: surface === 'server',
+ ...(surface === 'server' ? { maintenanceActiveEndAt: iso(30_000) } : {}),
+ maintenanceScope: 'resource_and_descendants',
+ maintenanceRecurrence: {
+ timezone: 'UTC',
+ weekdays: ['sunday'],
+ startMinute: 240,
+ endMinute: 241,
+ },
+ }),
+});
+
+async function run(options = {}) {
+ const output = options.output ?? root + '/tmp/held-operator-time/browser-complete';
+ const surfaces = options.surfaces ?? ['once', 'server', 'recurring', 'updates', 'guest'];
+ const binding = JSON.parse(fs.readFileSync(root + '/tmp/held-operator-time/source-binding.json'));
+ fs.mkdirSync(output, { recursive: true });
+ for (const [path, expected] of Object.entries(binding.content_sha256)) {
+ assert.equal(
+ crypto
+ .createHash('sha256')
+ .update(fs.readFileSync('/workspace/' + path))
+ .digest('hex'),
+ expected,
+ path,
+ );
+ }
+ const client = require('playwright/package.json').version;
+ assert.equal(
+ client,
+ JSON.parse(fs.readFileSync('/workspace/tests/integration/package-lock.json')).packages[
+ 'node_modules/@playwright/test'
+ ].version,
+ );
+ const result = {
+ playwright: client,
+ source: binding,
+ cases: [],
+ captures: [],
+ completed: false,
+ serverClosed: false,
+ browsersClosed: false,
+ phase: 'start',
+ };
+ 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: 5343, strictPort: true, watch: null },
+ });
+ let browser, context;
+ 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 },
+ );
+ for (const surface of surfaces) {
+ if (options.skip?.includes(name + ':' + surface)) continue;
+ const record = {
+ engine: name,
+ browserVersion: browser.version(),
+ viewport: { width, height: 950 },
+ dark,
+ surface,
+ checks: [],
+ requests: [],
+ writes: [],
+ unexpected: [],
+ errors: [],
+ offOrigin: [],
+ completed: false,
+ contextClosed: false,
+ };
+ result.cases.push(record);
+ result.phase = name + ' ' + surface + ' mount';
+ context = await browser.newContext({
+ viewport: record.viewport,
+ locale: 'en-GB',
+ timezoneId: 'UTC',
+ isMobile: width < 500,
+ hasTouch: width < 500,
+ });
+ const page = await context.newPage();
+ page.setDefaultTimeout(8000);
+ page.setDefaultNavigationTimeout(35000);
+ await page.clock.install({ time: new Date(start - 1000) });
+ await page.clock.pauseAt(new Date(start));
+ await page.addInitScript((dark) => {
+ localStorage.clear();
+ sessionStorage.clear();
+ document.addEventListener(
+ 'DOMContentLoaded',
+ () => document.documentElement.classList.toggle('dark', dark),
+ { once: true },
+ );
+ }, dark);
+ page.on('pageerror', (err) => record.errors.push(err.message));
+ 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 mutations' },
+ });
+ }
+ let data;
+ if (/^\/api\/resources\/[^/]+\/operator-state$/.test(url.pathname)) {
+ data = url.pathname.includes('/absent/')
+ ? { configured: false }
+ : { configured: true, state: operatorState(surface) };
+ } else if (url.pathname === '/api/version') data = version;
+ else if (url.pathname === '/api/updates/check') data = update;
+ else if (url.pathname === '/api/updates/history') data = [];
+ else if (url.pathname === '/api/settings/alerts')
+ data = { enabled: true, backupDefaults: { freshHours: 24, staleHours: 72 } };
+ else if (url.pathname === '/api/security/status')
+ data = { hasAuthentication: true, requiresAuth: false, sessionCapabilities: {} };
+ else if (url.pathname === '/api/health') data = { status: 'ok' };
+ else {
+ record.unexpected.push(url.pathname);
+ return route.fulfill({ status: 404, json: { error: 'Unspecified synthetic read' } });
+ }
+ return route.fulfill({ json: data });
+ });
+ const check = async (label, action) => {
+ result.phase = name + ' ' + surface + ' ' + label;
+ await action();
+ record.checks.push(label);
+ };
+ const capture = async (label) => {
+ const file = output + '/' + name + '-' + surface + '-' + label + '.png';
+ await page.screenshot({ path: file, fullPage: true, animations: 'disabled' });
+ result.captures.push(file.replace('/workspace/', ''));
+ };
+ await page.goto(origin + '/browser-tests/held-operator-time.html?surface=' + surface);
+ await page.waitForFunction(() => window.__heldOperator?.ready());
+ if (surface === 'once') {
+ await page.getByText('Maintenance window scheduled.', { exact: true }).waitFor();
+ await page.getByLabel('Operator note', { exact: true }).fill('Unsaved policy note');
+ await page.getByRole('button', { name: 'Edit window', exact: true }).click();
+ await page
+ .getByLabel('Reason (optional)', { exact: true })
+ .fill('Unsaved schedule reason');
+ await capture('scheduled-edits');
+ await page.clock.fastForward(30_000);
+ await check('held one-off becomes active at its inclusive start', async () => {
+ await page.getByText('Maintenance window active.', { exact: true }).waitFor();
+ assert.equal(
+ await page.getByText('Maintenance window scheduled.', { exact: true }).count(),
+ 0,
+ );
+ });
+ await page.clock.fastForward(30_000);
+ await check(
+ 'one-off expires at its exclusive end without losing unsaved edits or releasing saved restrictions',
+ async () => {
+ assert.equal(
+ await page.getByText('Maintenance window active.', { exact: true }).count(),
+ 0,
+ );
+ assert.equal(
+ await page.getByText('Maintenance window scheduled.', { exact: true }).count(),
+ 0,
+ );
+ assert.equal(
+ await page.getByLabel('Operator note', { exact: true }).inputValue(),
+ 'Unsaved policy note',
+ );
+ assert.equal(
+ await page.getByLabel('Reason (optional)', { exact: true }).inputValue(),
+ 'Unsaved schedule reason',
+ );
+ assert.equal(
+ await page
+ .getByLabel('Never auto-remediate this resource', { exact: true })
+ .getAttribute('aria-pressed'),
+ 'true',
+ );
+ assert.equal(
+ await page.getByLabel('Monitoring', { exact: true }).inputValue(),
+ 'expected_offline',
+ );
+ assert.equal(
+ await page.getByLabel('Lifecycle', { exact: true }).inputValue(),
+ 'retired',
+ );
+ assert.equal(
+ record.requests.filter((r) => r.path.includes('/operator-state')).length,
+ 1,
+ );
+ await page.getByRole('button', { name: 'Save overrides', exact: true }).waitFor();
+ },
+ );
+ await capture('expired-edits');
+ await page.evaluate(() => window.__heldOperator.withdrawWindow());
+ await check('source removal stays removed across the next clock tick', async () => {
+ await page.waitForFunction(() => document.querySelector('textarea')?.value === '');
+ await page.clock.fastForward(30_000);
+ assert.equal(
+ await page.getByText('Maintenance window active.', { exact: true }).count(),
+ 0,
+ );
+ assert.equal(
+ await page.getByText('Maintenance window scheduled.', { exact: true }).count(),
+ 0,
+ );
+ assert.equal(
+ record.requests.filter((r) => r.path.includes('/operator-state')).length,
+ 2,
+ );
+ });
+ } else if (surface === 'server') {
+ await page.getByText('Maintenance window active.', { exact: true }).waitFor();
+ await page.clock.fastForward(60_000);
+ await check(
+ 'expired server verdict is last reported, preserving scope without inferring recurrence or resumption',
+ async () => {
+ assert.match(
+ await page
+ .getByText('Last reported maintenance window.', { exact: true })
+ .locator('..')
+ .innerText(),
+ /and its descendants/,
+ );
+ assert.equal(
+ await page.getByText('Recurring maintenance configured.', { exact: true }).count(),
+ 0,
+ );
+ await page
+ .getByText(
+ 'The reported end has passed. Current maintenance status has not been refreshed.',
+ { exact: true },
+ )
+ .waitFor();
+ assert.equal(
+ await page.getByText('Maintenance window active.', { exact: true }).count(),
+ 0,
+ );
+ assert.equal(
+ record.requests.filter((r) => r.path.includes('/operator-state')).length,
+ 1,
+ );
+ },
+ );
+ await capture('server-verdict');
+ } else if (surface === 'recurring') {
+ await page.getByText('Recurring maintenance configured.', { exact: true }).waitFor();
+ await page.clock.fastForward(60_000);
+ await check(
+ 'inactive recurring rule remains configured rather than becoming a locally invented active verdict',
+ async () => {
+ await page.getByText('Recurring maintenance configured.', { exact: true }).waitFor();
+ assert.equal(
+ await page.getByText('Maintenance window active.', { exact: true }).count(),
+ 0,
+ );
+ assert.equal(
+ record.requests.filter((r) => r.path.includes('/operator-state')).length,
+ 1,
+ );
+ },
+ );
+ await capture('configured');
+ } else if (surface === 'updates') {
+ await page.getByText('Checked 0s ago', { exact: true }).waitFor();
+ await page.clock.fastForward(60_000);
+ await check(
+ 'held successful check ages without a new request, verdict or operation',
+ async () => {
+ await page.getByText('Checked 1 min ago', { exact: true }).waitFor();
+ await page.getByText('Up to date', { exact: true }).waitFor();
+ assert.equal(
+ record.requests.filter((r) => r.path === '/api/updates/check').length,
+ 1,
+ );
+ assert.deepEqual(await page.evaluate(() => window.__heldOperator.controls()), {
+ checks: 0,
+ installs: 0,
+ dirty: false,
+ channel: 'stable',
+ auto: false,
+ });
+ },
+ );
+ await page.getByRole('button', { name: /^Preview/ }).click();
+ await page.clock.fastForward(60_000);
+ await check(
+ 'preview auto-update lock and unsaved preference selection survive the clock',
+ async () => {
+ await page.getByText('Checked 2 mins ago', { exact: true }).waitFor();
+ assert.equal(await page.getByTestId('updates-auto-check-toggle').isDisabled(), true);
+ assert.deepEqual(await page.evaluate(() => window.__heldOperator.controls()), {
+ checks: 0,
+ installs: 0,
+ dirty: true,
+ channel: 'rc',
+ auto: false,
+ });
+ },
+ );
+ await capture('aged-preview-lock');
+ await page.evaluate(() => window.__heldOperator.sourceBuild());
+ await page.clock.fastForward(30_000);
+ await check(
+ 'source build withdraws release check age and keeps check unavailable',
+ async () => {
+ await page.getByText('Release updates disabled', { exact: true }).waitFor();
+ assert.equal(await page.getByText(/Checked .*ago/).count(), 0);
+ assert.equal(
+ await page.getByRole('button', { name: 'Check Now', exact: true }).isDisabled(),
+ true,
+ );
+ },
+ );
+ } else if (surface === 'guest') {
+ await page.getByText('CPU 91%, above the 80% alert level', { exact: true }).waitFor();
+ await check(
+ 'final drawer simultaneously renders held current alert and visible VM cache-source guidance',
+ async () => {
+ await page.getByText('About this reading', { exact: true }).waitFor();
+ const details = page.getByTestId('guest-technical-details');
+ assert.match(await details.innerText(), /Current · Proxmox \(may include cache\)/);
+ assert.match(await details.innerText(), /cached memory the VM can reuse/);
+ assert.match(await details.innerText(), /QEMU guest agent on a Linux VM/);
+ },
+ );
+ await capture('current-cache-source');
+ await page.clock.fastForward(30_000);
+ await check(
+ 'unchanged alert becomes a last reading while its source caveat stays visible',
+ async () => {
+ await page.getByText('Last reading: CPU 91%, 10 mins ago', { exact: true }).waitFor();
+ assert.equal(
+ await page.getByText('CPU 91%, above the 80% alert level', { exact: true }).count(),
+ 0,
+ );
+ await page.getByText('About this reading', { exact: true }).waitFor();
+ },
+ );
+ await page.clock.fastForward(60_000);
+ await page.getByText('Last reading: CPU 91%, 11 mins ago', { exact: true }).waitFor();
+ await capture('stale-alert-cache-source');
+ await check(
+ 'four cache-inclusive sources retain the visible note without refreshing the held alert',
+ async () => {
+ for (const source of [
+ 'status-mem',
+ 'status-freemem',
+ 'cluster-resources',
+ 'derived-total-minus-used',
+ ]) {
+ await page.evaluate((source) => window.__heldOperator.memory(source), source);
+ await page.getByText('About this reading', { exact: true }).waitFor();
+ await page
+ .getByText('Last reading: CPU 91%, 11 mins ago', { exact: true })
+ .waitFor();
+ }
+ },
+ );
+ await check(
+ 'cache-aware QEMU and Pulse agent sources remove the cache note without rewriting alert evidence',
+ async () => {
+ for (const source of ['guest-agent-meminfo', 'agent']) {
+ await page.evaluate((source) => window.__heldOperator.memory(source), source);
+ assert.equal(
+ await page.getByText('About this reading', { exact: true }).count(),
+ 0,
+ );
+ assert.match(
+ await page.getByTestId('guest-technical-details').innerText(),
+ /Current · (QEMU guest agent|Pulse Agent)/,
+ );
+ await page
+ .getByText('Last reading: CPU 91%, 11 mins ago', { exact: true })
+ .waitFor();
+ }
+ },
+ );
+ await check(
+ 'retained fallback stays last known and unavailable source withdraws caveat instead of inventing a number',
+ async () => {
+ await page.evaluate(() => window.__heldOperator.memory('status-mem', 'last-known'));
+ assert.match(
+ await page.getByTestId('guest-technical-details').innerText(),
+ /Last known · Proxmox \(may include cache\)/,
+ );
+ await page.getByText('About this reading', { exact: true }).waitFor();
+ await page.evaluate(() => window.__heldOperator.memory('status-mem', 'unavailable'));
+ assert.match(
+ await page.getByTestId('guest-technical-details').innerText(),
+ /Unavailable · Proxmox/,
+ );
+ assert.equal(await page.getByText('About this reading', { exact: true }).count(), 0);
+ },
+ );
+ await page.evaluate(() => window.__heldOperator.withdrawAlert());
+ await page.clock.fastForward(30_000);
+ await check('withdrawn alert stays withdrawn on the next tick', async () => {
+ assert.equal(await page.getByTestId('drawer-attention-section').count(), 0);
+ });
+ }
+ await check('no page error, unspecified API, off-origin traffic or mutation', async () => {
+ assert.deepEqual(record.errors, []);
+ assert.deepEqual(record.unexpected, []);
+ assert.deepEqual(record.offOrigin, []);
+ assert.deepEqual(record.writes, []);
+ assert.equal(
+ await page.evaluate(() => document.documentElement.scrollWidth > innerWidth),
+ false,
+ );
+ });
+ record.completed = true;
+ await context.close();
+ context = undefined;
+ record.contextClosed = true;
+ }
+ await browser.close();
+ browser = undefined;
+ }
+ result.completed = true;
+ } catch (err) {
+ result.error = { name: err.name, message: err.message };
+ process.exitCode = 1;
+ } finally {
+ result.cleanupErrors = [];
+ if (context) {
+ try {
+ await context.close();
+ result.failedCaseContextClosed = true;
+ } catch (err) {
+ result.cleanupErrors.push({ phase: 'context-close', message: err.message });
+ }
+ }
+ try {
+ if (browser) await browser.close();
+ result.browsersClosed = true;
+ } catch (err) {
+ result.cleanupErrors.push({ phase: 'browser-close', message: err.message });
+ }
+ try {
+ await server.close();
+ result.serverClosed = true;
+ } catch (err) {
+ result.cleanupErrors.push({ phase: 'server-close', message: err.message });
+ }
+ if (result.cleanupErrors.length) {
+ result.completed = false;
+ process.exitCode = 1;
+ }
+ fs.writeFileSync(output + '/result.json', JSON.stringify(result, null, 2) + '\n');
+ console.log(
+ JSON.stringify({
+ completed: result.completed,
+ phase: result.phase,
+ cases: result.cases.filter((r) => r.completed).length,
+ captures: result.captures.length,
+ error: result.error,
+ output,
+ }),
+ );
+ }
+}
+
+module.exports = run;
+if (require.main === module) void run();
diff --git a/frontend-modern/browser-tests/held-operator-time.html b/frontend-modern/browser-tests/held-operator-time.html
new file mode 100644
index 0000000000..5383ed6b00
--- /dev/null
+++ b/frontend-modern/browser-tests/held-operator-time.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>Held operational evidence</title>
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="/browser-tests/held-operator-time.tsx"></script>
+ </body>
+</html>
diff --git a/frontend-modern/browser-tests/held-operator-time.tsx b/frontend-modern/browser-tests/held-operator-time.tsx
new file mode 100644
index 0000000000..c8cf3aba05
--- /dev/null
+++ b/frontend-modern/browser-tests/held-operator-time.tsx
@@ -0,0 +1,148 @@
+// Existing production controls/drawer/CSS with synthetic, local-only inputs.
+// No maintenance, guest, update-apply or rollback action is executed.
+import { createSignal, Show } from 'solid-js';
+import { render } from 'solid-js/web';
+import { Route, Router } from '@solidjs/router';
+import { ResourceOperatorStateSection } from '../src/components/Infrastructure/ResourceOperatorStateSection';
+import { UpdatesSettingsPanel } from '../src/components/Settings/UpdatesSettingsPanel';
+import { GuestDrawer } from '../src/components/Workloads/GuestDrawer';
+import { DarkModeContext } from '../src/contexts/appRuntime';
+import { syncAIRuntimeSettings } from '../src/stores/aiRuntimeState';
+import { updateStore } from '../src/stores/updates';
+import { METRIC_ALERT_STATUS_STALE_MS } from '../src/features/alerts/metricAlertPresentation';
+import type { Alert } from '../src/types/api';
+import type { WorkloadGuest } from '../src/types/workloads';
+import '../src/index.css';
+
+const start = Date.parse('2026-10-11T04:00:00Z');
+const iso = (offset: number) => new Date(start + offset).toISOString();
+const surface = new URLSearchParams(location.search).get('surface') ?? 'once';
+syncAIRuntimeSettings({ discovery_enabled: false });
+
+const initialGuest: WorkloadGuest = {
+ id: 'fixture:pve-a:101',
+ name: 'Held evidence VM',
+ instance: 'fixture',
+ node: 'pve-a',
+ vmid: 101,
+ type: 'qemu',
+ status: 'running',
+ cpu: 0.1,
+ cpus: 2,
+ memory: {
+ total: 4 * 1024 ** 3,
+ used: 3 * 1024 ** 3,
+ free: 1024 ** 3,
+ usage: 75,
+ observation: { state: 'current', source: 'status-mem', observedAt: iso(-60_000) },
+ },
+ disk: { total: 10 * 1024 ** 3, used: 5 * 1024 ** 3, usage: 50 },
+ tags: [],
+ networkIn: 0,
+ networkOut: 0,
+ diskRead: 0,
+ diskWrite: 0,
+ uptime: 3600,
+ template: false,
+ lastBackup: 0,
+ lastSeen: iso(0),
+};
+const alert: Alert = {
+ id: 'held-cpu-alert',
+ resourceId: initialGuest.id,
+ resourceName: initialGuest.name,
+ type: 'cpu',
+ level: 'warning',
+ message: 'CPU above threshold',
+ value: 92,
+ threshold: 80,
+ startTime: iso(-60_000),
+ acknowledged: false,
+ node: 'pve-a',
+ metricStatus: {
+ phase: 'breaching',
+ value: 91,
+ unit: '%',
+ observedAt: iso(-METRIC_ALERT_STATUS_STALE_MS + 5_000),
+ trigger: 80,
+ recovery: 75,
+ },
+};
+
+function Fixture() {
+ const [resourceId, setResourceId] = createSignal(surface);
+ const [guest, setGuest] = createSignal(initialGuest);
+ const [alerts, setAlerts] = createSignal([alert]);
+ const [channel, setChannel] = createSignal<'stable' | 'rc'>('stable');
+ const [auto, setAuto] = createSignal(false);
+ const [dirty, setDirty] = createSignal(false);
+ const [sourceBuild, setSourceBuild] = createSignal(false);
+ let checks = 0,
+ installs = 0;
+ if (surface === 'updates') void updateStore.checkForUpdates(true);
+
+ (window as any).__heldOperator = {
+ ready: () => surface !== 'updates' || updateStore.lastCheckedAt() !== null,
+ controls: () => ({ checks, installs, dirty: dirty(), channel: channel(), auto: auto() }),
+ sourceBuild: () => setSourceBuild(true),
+ withdrawWindow: () => setResourceId('absent'),
+ memory: (source: string, state = 'current') =>
+ setGuest((current) => ({
+ ...current,
+ memory: {
+ ...current.memory,
+ usageUnavailable: state === 'unavailable',
+ observation: { source, state, observedAt: iso(-60_000) },
+ },
+ })),
+ withdrawAlert: () => setAlerts([]),
+ guest: () => guest(),
+ };
+ return (
+ <main class="mx-auto min-h-screen max-w-5xl space-y-3 bg-surface p-3 text-base-content">
+ <h1 class="text-base font-semibold">Held operational evidence</h1>
+ <p class="text-xs text-muted">Synthetic local inputs. No operation is dispatched.</p>
+ <Show when={['once', 'server', 'recurring'].includes(surface)}>
+ <ResourceOperatorStateSection resourceId={resourceId()} />
+ </Show>
+ <Show when={surface === 'updates'}>
+ <UpdatesSettingsPanel
+ versionInfo={() =>
+ updateStore.versionInfo() && {
+ ...updateStore.versionInfo()!,
+ isSourceBuild: sourceBuild(),
+ }
+ }
+ updateInfo={updateStore.updateInfo}
+ checkingForUpdates={updateStore.isChecking}
+ updateChannel={channel}
+ setUpdateChannel={setChannel}
+ autoUpdateEnabled={auto}
+ setAutoUpdateEnabled={setAuto}
+ setHasUnsavedChanges={setDirty}
+ checkForUpdates={async () => {
+ checks++;
+ }}
+ updatePlan={() => null}
+ onInstallUpdate={() => {
+ installs++;
+ }}
+ isInstalling={() => false}
+ />
+ </Show>
+ <Show when={surface === 'guest'}>
+ <GuestDrawer guest={guest()} alerts={alerts()} onClose={() => {}} />
+ </Show>
+ </main>
+ );
+}
+render(
+ () => (
+ <DarkModeContext.Provider value={() => document.documentElement.classList.contains('dark')}>
+ <Router>
+ <Route path="/*" component={Fixture} />
+ </Router>
+ </DarkModeContext.Provider>
+ ),
+ document.getElementById('root')!,
+);
diff --git a/frontend-modern/browser-verification/fdfcf5c52d38acb2.json b/frontend-modern/browser-verification/fdfcf5c52d38acb2.json
new file mode 100644
index 0000000000..d0f91cf766
--- /dev/null
+++ b/frontend-modern/browser-verification/fdfcf5c52d38acb2.json
@@ -0,0 +1,94 @@
+{
+ "version": 1,
+ "base_sha": "45a211387d5f3d008dc2ea9eb9b5d9c46001d0dd",
+ "verified_at": "2026-10-11T03:20:45.931971Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Infrastructure/ResourceOperatorStateSection.tsx",
+ "frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx",
+ "frontend-modern/src/utils/updatesPresentation.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Infrastructure/ResourceOperatorStateSection.tsx": "8c8bc717962306dbf1b2414bf5ab92016da1d9b1c81c7dd65295279b3de44fca",
+ "frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx": "4a61962b92a34902b95704e260908f89cc9e99b56355ffde0902021c88e3ee60",
+ "frontend-modern/src/utils/updatesPresentation.ts": "a953fa9239a35a78b543edd1d695e56f2af33c1cfda5baf872630d9572952e55"
+ },
+ "routes": [
+ "/browser-tests/held-operator-time.html?surface=once",
+ "/browser-tests/held-operator-time.html?surface=server",
+ "/browser-tests/held-operator-time.html?surface=recurring",
+ "/browser-tests/held-operator-time.html?surface=updates"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 950
+ },
+ {
+ "width": 390,
+ "height": 950
+ }
+ ],
+ "states": [
+ "Eight complete final-content cases: six final maintenance cases and two sufficient unchanged update cases. Desktop Chromium 141.0.7390.37/light and phone WebKit 26.0/dark; Playwright 1.56.1 matches the integration lock. Ten selected captures inspected. Not a fabricated single all-green run.",
+ "Held local one-off moves scheduled \u2192 active \u2192 expired at half-open boundaries without refetching or discarding policy/scheduler edits. Expected-offline, retired and never-auto-remediate controls persist.",
+ "Server-active occurrence is preserved as last reported after its own end passes, with current status explicitly unrefreshed. Neither monitoring resumption nor a new recurring occurrence is inferred. Inactive recurrence remains configured.",
+ "Successful global check ages 0s \u2192 1 min \u2192 2 mins without a new check, installation or verdict. Preview automatic-update lock and unsaved channel survive; source build withdraws check age and keeps Check Now unavailable.",
+ "No resource/API/schema/permission/action changes or native guest/backup/notification/updater, physical-phone, installed or publication acceptance."
+ ],
+ "interactions": [
+ "Real controls use desktop mouse and phone touch. Edit the existing policy note and schedule reason, cross shared-clock boundaries, and remove the operator-state source; withdrawn evidence stays absent.",
+ "Preview selection uses the existing pressed button; locks and source-build availability checked. Real update store obtains one local synthetic GET check, then no further check or operation.",
+ "Real components, router, CSS, query/store and existing shared clock; page clocks advance while held synthetic inputs remain unchanged. Every selected case has no page errors, unspecified API, off-origin request or mutation; no horizontal overflow. Own contexts, browsers and Vite server closed. Host descendant cleanup is not independently reported."
+ ],
+ "case_origins": [
+ {
+ "attempt": "browser-5",
+ "engine": "desktop",
+ "surface": "once",
+ "controls": 4
+ },
+ {
+ "attempt": "browser-5",
+ "engine": "desktop",
+ "surface": "server",
+ "controls": 2
+ },
+ {
+ "attempt": "browser-5",
+ "engine": "desktop",
+ "surface": "recurring",
+ "controls": 2
+ },
+ {
+ "attempt": "browser-5",
+ "engine": "phone",
+ "surface": "once",
+ "controls": 4
+ },
+ {
+ "attempt": "browser-5",
+ "engine": "phone",
+ "surface": "server",
+ "controls": 2
+ },
+ {
+ "attempt": "browser-5",
+ "engine": "phone",
+ "surface": "recurring",
+ "controls": 2
+ },
+ {
+ "attempt": "browser-3",
+ "engine": "desktop",
+ "surface": "updates",
+ "controls": 4
+ },
+ {
+ "attempt": "browser-3",
+ "engine": "phone",
+ "surface": "updates",
+ "controls": 4
+ }
+ ]
+}
diff --git a/frontend-modern/src/components/Infrastructure/ResourceOperatorStateSection.tsx b/frontend-modern/src/components/Infrastructure/ResourceOperatorStateSection.tsx
index 300750a6ca..b36a12626f 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceOperatorStateSection.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceOperatorStateSection.tsx
@@ -15,6 +15,7 @@ import {
} from '@/api/resourceOperatorState';
import { createNonSuspendingQuery } from '@/hooks/createNonSuspendingQuery';
import { formatRelativeTime } from '@/utils/format';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import type { ResourceCapability } from '@/types/resource';
import { describeResourceInventoryOwnership } from '@/utils/resourceMonitoringPolicy';
@@ -44,6 +45,7 @@ interface ResourceOperatorStateSectionProps {
export const ResourceOperatorStateSection: Component<ResourceOperatorStateSectionProps> = (
props,
) => {
+ const now = useRelativeTimeNow();
// Fetch the persisted state via the non-suspending helper so the
// drawer's parent Suspense boundary does not flicker the page-level
// fallback while operator-state is in flight. null means "no entry"
@@ -337,16 +339,20 @@ export const ResourceOperatorStateSection: Component<ResourceOperatorStateSectio
// Compute whether a maintenance window covers `now` so the section
// can badge it. Distinct from `scheduledMaintenanceWindow` — both
- // active and future windows are surfaced, with different copy.
+ // active and future windows are surfaced, with different copy. The
+ // shared clock expires local one-off presentation without refetching
+ // persisted state (which would also rehydrate the operator's edits).
+ // Explicit server activity, including recurring windows, stays authoritative:
+ // after its reported end, qualify that verdict rather than infer resumption.
const activeMaintenanceWindow = createMemo(() => {
const current = persisted();
if (current?.maintenanceWindowActive && current.maintenanceActiveEndAt) return current;
if (!current?.maintenanceStartAt || !current?.maintenanceEndAt) return null;
- const now = Date.now();
+ const currentTime = now();
const start = Date.parse(current.maintenanceStartAt);
const end = Date.parse(current.maintenanceEndAt);
if (Number.isNaN(start) || Number.isNaN(end)) return null;
- if (now < start || now >= end) return null;
+ if (currentTime < start || currentTime >= end) return null;
return current;
});
@@ -356,13 +362,20 @@ export const ResourceOperatorStateSection: Component<ResourceOperatorStateSectio
const scheduledMaintenanceWindow = createMemo(() => {
const current = persisted();
if (!current?.maintenanceStartAt || !current?.maintenanceEndAt) return null;
- const now = Date.now();
+ const currentTime = now();
const start = Date.parse(current.maintenanceStartAt);
if (Number.isNaN(start)) return null;
- if (start <= now) return null;
+ if (start <= currentTime) return null;
return current;
});
+ const serverMaintenanceReportEnded = createMemo(() => {
+ const current = persisted();
+ if (!current?.maintenanceWindowActive || !current.maintenanceActiveEndAt) return false;
+ const end = Date.parse(current.maintenanceActiveEndAt);
+ return Number.isFinite(end) && now() >= end;
+ });
+
const hasAnyMaintenanceWindow = createMemo(() =>
Boolean(
persisted()?.maintenanceRecurrence ||
@@ -576,17 +589,28 @@ export const ResourceOperatorStateSection: Component<ResourceOperatorStateSectio
<Show when={activeMaintenanceWindow()}>
<div class="rounded-sm border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-800 dark:bg-amber-900/25 dark:text-amber-200">
- <span class="font-semibold">Maintenance window active.</span> Attention on this resource
+ <span class="font-semibold">
+ {serverMaintenanceReportEnded()
+ ? 'Last reported maintenance window.'
+ : 'Maintenance window active.'}
+ </span>{' '}
+ {serverMaintenanceReportEnded() ? 'Attention was reported paused on' : 'Attention on'}{' '}
+ this resource
<Show when={activeMaintenanceWindow()!.maintenanceScope === 'resource_and_descendants'}>
{' '}
and its descendants
</Show>{' '}
- is paused until{' '}
+ {serverMaintenanceReportEnded() ? 'until' : 'is paused until'}{' '}
{new Date(
activeMaintenanceWindow()!.maintenanceActiveEndAt ??
activeMaintenanceWindow()!.maintenanceEndAt!,
).toLocaleString()}
.
+ <Show when={serverMaintenanceReportEnded()}>
+ <span class="block mt-0.5">
+ The reported end has passed. Current maintenance status has not been refreshed.
+ </span>
+ </Show>
<Show when={activeMaintenanceWindow()!.maintenanceReason}>
<span class="block mt-0.5">Reason: {activeMaintenanceWindow()!.maintenanceReason}</span>
</Show>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceOperatorStateSection.clock.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceOperatorStateSection.clock.test.tsx
new file mode 100644
index 0000000000..31ec71c694
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceOperatorStateSection.clock.test.tsx
@@ -0,0 +1,157 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import type { ResourceOperatorState } from '@/api/resourceOperatorState';
+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';
+
+const api = vi.hoisted(() => ({ apiFetchJSON: vi.fn() }));
+vi.mock('@/utils/apiClient', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@/utils/apiClient')>()),
+ apiFetchJSON: api.apiFetchJSON,
+}));
+
+import { ResourceOperatorStateSection } from '../ResourceOperatorStateSection';
+
+const start = Date.parse('2026-10-11T04:00:00Z');
+const iso = (offset: number) => new Date(start + offset).toISOString();
+const state = (overrides: Partial<ResourceOperatorState> = {}): ResourceOperatorState => ({
+ canonicalId: 'clock-resource',
+ monitoringMode: 'expected_offline',
+ lifecycleState: 'retired',
+ intentionallyOffline: true,
+ neverAutoRemediate: true,
+ note: 'Keep the lock',
+ setAt: iso(-60_000),
+ setBy: 'fixture-admin',
+ ...overrides,
+});
+const mount = async (record: ResourceOperatorState) => {
+ api.apiFetchJSON.mockResolvedValue({ configured: true, state: record });
+ render(() => <ResourceOperatorStateSection resourceId={record.canonicalId} />);
+ await vi.advanceTimersByTimeAsync(0);
+};
+
+describe('held operator maintenance evidence', () => {
+ beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(start);
+ api.apiFetchJSON.mockReset();
+ });
+ afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ });
+
+ it('moves a held one-off window from scheduled to active to expired at its half-open boundaries', async () => {
+ await mount(state({ maintenanceStartAt: iso(30_000), maintenanceEndAt: iso(60_000) }));
+ expect(screen.getByText('Maintenance window scheduled.')).toBeInTheDocument();
+ await vi.advanceTimersByTimeAsync(RELATIVE_TIME_TICK_MS);
+ expect(screen.queryByText('Maintenance window scheduled.')).not.toBeInTheDocument();
+ expect(screen.getByText('Maintenance window active.')).toBeInTheDocument();
+ await vi.advanceTimersByTimeAsync(RELATIVE_TIME_TICK_MS);
+ expect(screen.queryByText('Maintenance window active.')).not.toBeInTheDocument();
+ expect(screen.queryByText('Maintenance window scheduled.')).not.toBeInTheDocument();
+ // Clock invalidation is presentation-only: no refetch, mutation or lock release.
+ expect(api.apiFetchJSON).toHaveBeenCalledTimes(1);
+ expect(screen.getByLabelText('Never auto-remediate this resource')).toHaveAttribute(
+ 'aria-pressed',
+ 'true',
+ );
+ expect(screen.getByLabelText('Monitoring')).toHaveValue('expected_offline');
+ expect(screen.getByLabelText('Lifecycle')).toHaveValue('retired');
+ });
+
+ it('expires an initially active one-off badge without discarding unsaved policy or schedule edits', async () => {
+ await mount(state({ maintenanceStartAt: iso(-60_000), maintenanceEndAt: iso(30_000) }));
+ fireEvent.input(screen.getByLabelText('Operator note'), { target: { value: 'Unsaved note' } });
+ fireEvent.click(screen.getByText('Edit window'));
+ const reason = screen.getByLabelText('Reason (optional)');
+ fireEvent.input(reason, { target: { value: 'Unsaved reason' } });
+ await vi.advanceTimersByTimeAsync(RELATIVE_TIME_TICK_MS);
+ expect(screen.queryByText('Maintenance window active.')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Operator note')).toHaveValue('Unsaved note');
+ expect(reason).toHaveValue('Unsaved reason');
+ expect(screen.getByText('Save overrides')).toBeInTheDocument();
+ expect(screen.getByText('Schedule maintenance window')).toBeInTheDocument();
+ expect(api.apiFetchJSON).toHaveBeenCalledTimes(1);
+ });
+
+ it.each([false, true])(
+ 'qualifies an expired server-active report without inferring recurrence or resumption (recurring: %s)',
+ async (recurring) => {
+ await mount(
+ state({
+ maintenanceWindowActive: true,
+ maintenanceActiveEndAt: iso(30_000),
+ maintenanceRecurrence: recurring
+ ? {
+ timezone: 'UTC',
+ weekdays: ['sunday'],
+ startMinute: 240,
+ endMinute: 241,
+ }
+ : undefined,
+ maintenanceScope: 'resource_and_descendants',
+ }),
+ );
+ expect(screen.getByText('Maintenance window active.')).toBeInTheDocument();
+ await vi.advanceTimersByTimeAsync(RELATIVE_TIME_TICK_MS);
+ expect(screen.queryByText('Maintenance window active.')).not.toBeInTheDocument();
+ const report = screen.getByText('Last reported maintenance window.').parentElement;
+ expect(report).toHaveTextContent('Current maintenance status has not been refreshed.');
+ expect(report).toHaveTextContent('Attention was reported paused');
+ expect(report).toHaveTextContent('and its descendants');
+ expect(screen.queryByText('Recurring maintenance configured.')).not.toBeInTheDocument();
+ expect(api.apiFetchJSON).toHaveBeenCalledTimes(1);
+ },
+ );
+
+ it('does not invent an active verdict for a recurring rule whose server verdict is inactive', async () => {
+ await mount(
+ state({
+ maintenanceWindowActive: false,
+ maintenanceRecurrence: {
+ timezone: 'UTC',
+ weekdays: ['sunday'],
+ startMinute: 240,
+ endMinute: 241,
+ },
+ }),
+ );
+ await vi.advanceTimersByTimeAsync(60_000);
+ expect(screen.getByText('Recurring maintenance configured.')).toBeInTheDocument();
+ expect(screen.queryByText('Maintenance window active.')).not.toBeInTheDocument();
+ expect(api.apiFetchJSON).toHaveBeenCalledTimes(1);
+ });
+
+ it.each([
+ {},
+ { maintenanceStartAt: iso(-60_000), maintenanceEndAt: iso(-30_000) },
+ { maintenanceStartAt: 'invalid', maintenanceEndAt: 'invalid' },
+ { maintenanceStartAt: iso(-30_000) },
+ ])('keeps absent, expired, invalid or incomplete windows inactive (%j)', async (window) => {
+ await mount(state(window));
+ await vi.advanceTimersByTimeAsync(60_000);
+ expect(screen.queryByText('Maintenance window active.')).not.toBeInTheDocument();
+ expect(screen.queryByText('Maintenance window scheduled.')).not.toBeInTheDocument();
+ });
+
+ it('does not revive a removed window on a clock tick after the drawer changes resource', async () => {
+ api.apiFetchJSON
+ .mockResolvedValueOnce({
+ configured: true,
+ state: state({ maintenanceStartAt: iso(-60_000), maintenanceEndAt: iso(120_000) }),
+ })
+ .mockResolvedValueOnce({ configured: false });
+ const [resourceId, setResourceId] = createSignal('clock-resource-removal');
+ render(() => <ResourceOperatorStateSection resourceId={resourceId()} />);
+ await vi.advanceTimersByTimeAsync(0);
+ expect(screen.getByText('Maintenance window active.')).toBeInTheDocument();
+ setResourceId('no-operator-record');
+ await vi.advanceTimersByTimeAsync(0);
+ await vi.advanceTimersByTimeAsync(RELATIVE_TIME_TICK_MS);
+ expect(screen.queryByText('Maintenance window active.')).not.toBeInTheDocument();
+ expect(screen.queryByText('Maintenance window scheduled.')).not.toBeInTheDocument();
+ expect(api.apiFetchJSON).toHaveBeenCalledTimes(2);
+ });
+});
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceOperatorStateSection.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/ResourceOperatorStateSection.test.ts
index af4becd1f4..32b96adf4e 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceOperatorStateSection.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceOperatorStateSection.test.ts
@@ -213,7 +213,8 @@ describe('ResourceOperatorStateSection', () => {
// "scheduled" badge instead.
expect(sectionSource).toContain('activeMaintenanceWindow');
expect(sectionSource).toContain('Maintenance window active.');
- expect(sectionSource).toContain('if (now < start || now >= end) return null;');
+ expect(sectionSource).toContain('const currentTime = now();');
+ expect(sectionSource).toContain('if (currentTime < start || currentTime >= end) return null;');
});
it('attributes the persisted state with set-by and set-at metadata', () => {
diff --git a/frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx b/frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx
index 145ef71da9..2eaa5e74b6 100644
--- a/frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx
+++ b/frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx
@@ -36,6 +36,7 @@ import {
UPDATES_PANEL_COPY,
} from '@/utils/updatesPresentation';
import { updateStore } from '@/stores/updates';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
export interface UpdatesSettingsPanelProps {
versionInfo: Accessor<VersionInfo | null>;
@@ -54,6 +55,7 @@ export interface UpdatesSettingsPanelProps {
}
export const UpdatesSettingsPanel: Component<UpdatesSettingsPanelProps> = (props) => {
+ const now = useRelativeTimeNow();
const autoUpdateTitleId = `settings-updates-${createUniqueId()}-auto-update-title`;
const latestVersion = () => props.updateInfo()?.latestVersion;
const dockerImageTag = () => buildDockerImageTag(latestVersion());
@@ -198,7 +200,7 @@ export const UpdatesSettingsPanel: Component<UpdatesSettingsPanelProps> = (props
</p>
<Show when={!props.versionInfo()?.isSourceBuild}>
<p class="mt-0.5 text-xs text-muted">
- {getUpdateCheckedLabel(updateStore.lastCheckedAt())}
+ {getUpdateCheckedLabel(updateStore.lastCheckedAt(), now())}
</p>
</Show>
</>
diff --git a/frontend-modern/src/components/Settings/__tests__/UpdatesSettingsPanel.clock.test.tsx b/frontend-modern/src/components/Settings/__tests__/UpdatesSettingsPanel.clock.test.tsx
new file mode 100644
index 0000000000..d3a2cc05f9
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/UpdatesSettingsPanel.clock.test.tsx
@@ -0,0 +1,84 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import type { UpdateInfo, VersionInfo } from '@/api/updates';
+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';
+
+const store = vi.hoisted(() => ({ lastCheckedAt: vi.fn(), lastError: () => null }));
+vi.mock('@/stores/updates', () => ({ updateStore: store }));
+vi.mock('../UpdateHistorySection', () => ({ UpdateHistorySection: () => null }));
+import { UpdatesSettingsPanel } from '../UpdatesSettingsPanel';
+
+const start = Date.parse('2026-10-11T04:00:00Z');
+const mount = (sourceBuild = false) => {
+ const [checkedAt, setCheckedAt] = createSignal<number | null>(start - 30_000);
+ store.lastCheckedAt.mockImplementation(checkedAt);
+ const [channel, setChannel] = createSignal<'stable' | 'rc'>('stable');
+ const [auto, setAuto] = createSignal(false);
+ const check = vi.fn(async () => {});
+ const install = vi.fn();
+ const dirty = vi.fn();
+ render(() => (
+ <UpdatesSettingsPanel
+ versionInfo={() => ({ version: '6.5.0', isSourceBuild: sourceBuild }) as VersionInfo}
+ updateInfo={() => ({ available: false, latestVersion: '6.5.0' }) as UpdateInfo}
+ checkingForUpdates={() => false}
+ updateChannel={channel}
+ setUpdateChannel={setChannel}
+ autoUpdateEnabled={auto}
+ setAutoUpdateEnabled={setAuto}
+ checkForUpdates={check}
+ setHasUnsavedChanges={dirty}
+ updatePlan={() => null}
+ onInstallUpdate={install}
+ isInstalling={() => false}
+ />
+ ));
+ return { setCheckedAt, setChannel, check, install, dirty };
+};
+
+describe('held global update check age', () => {
+ beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(start);
+ store.lastCheckedAt.mockReset();
+ });
+ afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ });
+ it('ages the mounted last check without changing the verdict or requesting a check or installation', () => {
+ const controls = mount();
+ expect(screen.getByText('Checked 30s ago')).toBeInTheDocument();
+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);
+ expect(screen.getByText('Checked 1 min ago')).toBeInTheDocument();
+ vi.advanceTimersByTime(60_000);
+ expect(screen.getByText('Checked 2 mins ago')).toBeInTheDocument();
+ expect(screen.getByText('Up to date')).toBeInTheDocument();
+ expect(controls.check).not.toHaveBeenCalled();
+ expect(controls.install).not.toHaveBeenCalled();
+ expect(controls.dirty).not.toHaveBeenCalled();
+ });
+ it('retains missing, future and withdrawn check semantics', () => {
+ const { setCheckedAt } = mount();
+ setCheckedAt(null);
+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);
+ expect(screen.getByText('Not checked yet')).toBeInTheDocument();
+ setCheckedAt(Date.now() + 60_000);
+ expect(screen.getByText('Checked 0s ago')).toBeInTheDocument();
+ setCheckedAt(null);
+ vi.advanceTimersByTime(60_000);
+ expect(screen.getByText('Not checked yet')).toBeInTheDocument();
+ });
+ it('keeps source-build checks and preview automatic updates unavailable as the clock advances', () => {
+ const controls = mount(true);
+ controls.setChannel('rc');
+ vi.advanceTimersByTime(60_000);
+ expect(screen.getByText('Source build')).toBeInTheDocument();
+ expect(screen.queryByText(/Checked .*ago/)).not.toBeInTheDocument();
+ expect(screen.getByText('Release updates disabled')).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Check Now' })).toBeDisabled();
+ expect(controls.check).not.toHaveBeenCalled();
+ expect(controls.install).not.toHaveBeenCalled();
+ });
+});
diff --git a/frontend-modern/src/utils/__tests__/updatesPresentation.test.ts b/frontend-modern/src/utils/__tests__/updatesPresentation.test.ts
index 761d375adc..5368651ecf 100644
--- a/frontend-modern/src/utils/__tests__/updatesPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/updatesPresentation.test.ts
@@ -78,6 +78,15 @@ describe('updatesPresentation', () => {
'Checked 1 day ago',
);
});
+
+ it('measures a held check from the supplied presentation clock', () => {
+ const checkedAt = Date.parse('2026-10-11T04:00:00Z');
+ expect(getUpdateCheckedLabel(checkedAt, checkedAt + 60_000)).toBe('Checked 1 min ago');
+ expect(getUpdateCheckedLabel(checkedAt, checkedAt + 120_000)).toBe('Checked 2 mins ago');
+ expect(getUpdateCheckedLabel(checkedAt, checkedAt - 60_000)).toBe('Checked 0s ago');
+ expect(getUpdateCheckedLabel(null, checkedAt)).toBe('Not checked yet');
+ expect(getUpdateCheckedLabel(NaN, checkedAt)).toBe('Not checked yet');
+ });
});
});
diff --git a/frontend-modern/src/utils/updatesPresentation.ts b/frontend-modern/src/utils/updatesPresentation.ts
index adbf9ab5f0..7a8730f385 100644
--- a/frontend-modern/src/utils/updatesPresentation.ts
+++ b/frontend-modern/src/utils/updatesPresentation.ts
@@ -78,9 +78,12 @@ export function getUpdateCheckModeLabel(enabled: boolean, sourceBuild = false):
// The displayed verdict can come from a day-old cached check, so "Up to date"
// must carry the age of the check it is based on or it reads as a live
// comparison (#1601).
-export function getUpdateCheckedLabel(lastCheckedMs: number | null | undefined): string {
+export function getUpdateCheckedLabel(
+ lastCheckedMs: number | null | undefined,
+ nowMs = Date.now(),
+): string {
if (!lastCheckedMs || lastCheckedMs <= 0) return 'Not checked yet';
- const relative = formatRelativeTime(lastCheckedMs);
+ const relative = formatRelativeTime(lastCheckedMs, { now: nowMs });
return relative ? `Checked ${relative}` : 'Not checked yet';
}