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 Pulse system alerts separate from monitored resources

pulse-triage[bot]813846485825
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index c0943f501d..3c89b76df0 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -15,6 +15,25 @@
## Purpose
+### Pulse system alerts retain their service scope in the existing UI
+
+The `pulse-system-` identity prefix or explicit `systemAlert: true` metadata
+marks a Pulse service condition, not a monitored resource. Overview retains
+the warning, acknowledgement, snooze and occurrence timeline but offers no
+resource link or monitoring-policy action. History preserves this scope for
+active and retained conditions before any resource-name fallback: a machine
+named Pulse is not evidence that it owns the service warning. Ordinary resource
+alerts, including those called Pulse, retain their existing target affordances.
+
+The Assistant explanation keeps the exact alert identity, message and
+approval-required boundary, without invented metric values, a guest target or
+resource Patrol. Reconstructed History explanations preserve the system marker;
+new system types need no frontend allowlist. Connected overview/history/handoff
+and investigation-button controls verify both authoritative markers, legacy
+metadata, name collisions and ordinary resource controls. Browser acceptance
+checks the actual components on desktop and narrow touch views. This changes
+presentation only, not alert evaluation, delivery, API or operator permissions.
+
### Backup-age evaluation failures use the existing system-alert lifecycle
`pulse-system-backup-evaluation` is a warning about Pulse's inability to read
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index c6951e64ab..e12228086b 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -20,6 +20,16 @@
## Purpose
+Pulse system-alert presentation uses the existing reserved ID/metadata markers,
+not the displayed name or a platform fallback. Overview and both History layouts
+keep service warnings, occurrence timelines and acknowledgement usable without
+a false resource link/policy action. History retains the system marker when
+reconstructing Assistant context; the explanation has no fabricated metric,
+guest target or targeted Patrol. Ordinary monitored resources named Pulse keep
+their original affordances. The shared scope helper, mounted alert controls and
+desktop/narrow-touch browser fixture cover this boundary. No navigation entry,
+page, API, alert policy or operator permission is introduced.
+
### Guest-agent coverage is not inferred from metadata
The existing workload drawer distinguishes assigned Pulse Agent action ownership,
diff --git a/frontend-modern/browser-tests/system-alert-scope.cjs b/frontend-modern/browser-tests/system-alert-scope.cjs
new file mode 100644
index 0000000000..a91ae3d078
--- /dev/null
+++ b/frontend-modern/browser-tests/system-alert-scope.cjs
@@ -0,0 +1,378 @@
+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 output = '/workspace/tmp/system-alert-scope-proof';
+const runtime = [
+ 'frontend-modern/src/utils/alertScope.ts',
+ 'frontend-modern/src/components/Alerts/alertAssistantHandoffModel.ts',
+ 'frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx',
+ 'frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx',
+ 'frontend-modern/src/features/alerts/alertHistoryModel.ts',
+ 'frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx',
+];
+const systemTypes = [
+ 'backup-evaluation',
+ 'notification-delivery',
+ 'deadman-delivery',
+ 'deadman-monitoring-stalled',
+ 'deadman-interruption',
+ 'deadman-state',
+];
+const legacy = {
+ id: 'retained-legacy-system-id',
+ type: 'notification-delivery',
+ level: 'warning',
+ resourceId: 'vm-wrong',
+ resourceName: 'Pulse',
+ node: 'wrong-node',
+ metadata: { systemAlert: true, resourceType: 'vm' },
+ message: 'Synthetic retained notification delivery outage.',
+ startTime: '2026-10-04T14:00:00Z',
+ lastSeen: '2026-10-04T14:30:00Z',
+ acknowledged: true,
+ value: 0,
+ threshold: 0,
+};
+const hash = (file) => crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex');
+(async () => {
+ fs.mkdirSync(output, { recursive: true });
+ const version = require('playwright/package.json').version;
+ assert.equal(
+ version,
+ JSON.parse(fs.readFileSync('/workspace/tests/integration/package-lock.json')).packages[
+ 'node_modules/@playwright/test'
+ ].version,
+ );
+ const hashes = Object.fromEntries(
+ runtime.map((file) => [file, hash(path.join('/workspace', file))]),
+ );
+ process.chdir(root);
+ const { createServer } = await import(path.join(root, 'node_modules/vite/dist/node/index.js'));
+ const server = await createServer({
+ root,
+ configFile: path.join(root, 'vite.config.ts'),
+ cacheDir: path.join(output, 'vite-cache'),
+ server: { host: '127.0.0.1', port: 5297, strictPort: true, watch: null },
+ });
+ const origin = 'http://127.0.0.1:5297';
+ const results = [],
+ screenshots = [];
+ let browser,
+ phase = 'server';
+ try {
+ await server.listen();
+ for (const [name, engine, width, dark] of [
+ ['chromium-desktop-light', chromium, 1365, false],
+ ['chromium-desktop-dark', chromium, 1365, true],
+ ['webkit-phone-dark', webkit, 390, true],
+ ['webkit-narrow-light', webkit, 320, false],
+ ]) {
+ phase = name;
+ browser = await engine.launch(
+ engine === chromium
+ ? { headless: true, channel: 'chromium', args: ['--no-sandbox'] }
+ : { headless: true },
+ );
+ const page = await browser.newPage({
+ viewport: { width, height: width < 500 ? 844 : 900 },
+ isMobile: width < 500,
+ hasTouch: width < 500,
+ locale: 'en-GB',
+ timezoneId: 'UTC',
+ });
+ page.setDefaultTimeout(10000);
+ page.setDefaultNavigationTimeout(60000);
+ const errors = [],
+ requests = [],
+ offOrigin = [],
+ writes = [],
+ checks = [];
+ page.on('pageerror', (error) => errors.push(error.message));
+ await page.addInitScript((dark) => {
+ localStorage.clear();
+ const apply = () => document.documentElement.classList.toggle('dark', dark);
+ if (document.documentElement) apply();
+ else document.addEventListener('DOMContentLoaded', apply, { once: true });
+ }, dark);
+ await page.routeWebSocket(/.*/, (socket) => socket.close());
+ await page.route('**/*', async (route) => {
+ const req = route.request(),
+ url = new URL(req.url());
+ if (url.origin !== origin) {
+ offOrigin.push(url.origin);
+ return route.abort();
+ }
+ if (!url.pathname.startsWith('/api/')) return route.continue();
+ requests.push({ path: url.pathname, query: url.search, method: req.method() });
+ if (req.method() !== 'GET') {
+ writes.push({ path: url.pathname, method: req.method(), body: req.postDataJSON() });
+ assert.ok(
+ ['/api/alerts/acknowledge', '/api/alerts/unacknowledge'].includes(url.pathname),
+ 'unexpected write',
+ );
+ assert.equal(req.method(), 'POST');
+ assert.deepEqual(req.postDataJSON(), {
+ alertIdentifier: 'pulse-system-backup-evaluation',
+ });
+ return route.fulfill({ json: { success: true } });
+ }
+ if (url.pathname === '/api/alerts/history') return route.fulfill({ json: [legacy] });
+ if (url.pathname === '/api/alerts/incidents') return route.fulfill({ json: null });
+ if (url.pathname === '/api/notifications/health')
+ return route.fulfill({
+ json: {
+ overall_healthy: true,
+ queue: {
+ healthy: true,
+ status: 'healthy',
+ pending: 0,
+ sending: 0,
+ sent: 0,
+ failed: 0,
+ dlq: 0,
+ attention_required: 0,
+ reason_codes: [],
+ completed_retention_days: 7,
+ dead_letter_retention_days: 30,
+ counts_are_retention_bounded: true,
+ retry_attempts_affect_health: false,
+ terminal_failures_affect_health: true,
+ failure_classes_7d: {
+ authentication: 0,
+ rate_limited: 0,
+ connectivity: 0,
+ tls: 0,
+ configuration: 0,
+ rejected: 0,
+ server_error: 0,
+ unknown: 0,
+ },
+ failure_class_window_days: 7,
+ failure_classes_available: true,
+ },
+ },
+ });
+ if (url.pathname.includes('license'))
+ return route.fulfill({
+ json: { capabilities: [], entitlements: [], limits: [], max_history_days: 90 },
+ });
+ if (url.pathname === '/api/security/status')
+ return route.fulfill({
+ json: {
+ hasAuthentication: true,
+ requiresAuth: false,
+ sessionCapabilities: { assistantEnabled: true },
+ },
+ });
+ return route.fulfill({ json: [] });
+ });
+ const check = async (label, action) => {
+ phase = `${name}: ${label}`;
+ await action();
+ checks.push({ label, passed: true });
+ };
+ const capture = async (locator, state) => {
+ const file = `${name}-${state}.png`;
+ await locator.screenshot({ path: path.join(output, file) });
+ screenshots.push({ file, state, width, dark, sha256: hash(path.join(output, file)) });
+ };
+ const assertSystemContext = async (id) => {
+ const context = await page.evaluate(() => window.__systemAlertScope.context());
+ assert.equal(context.targetId, undefined);
+ assert.equal(context.targetType, undefined);
+ assert.deepEqual(context.handoffResources, []);
+ assert.equal(context.autonomousMode, false);
+ assert.equal(context.context.guestName, undefined);
+ assert.equal(context.context.node, undefined);
+ assert.match(context.handoffContext, /Scope: Pulse itself \(not a monitored resource\)/);
+ assert.ok(context.handoffContext.includes(`Alert Identifier: ${id}`));
+ assert.ok(context.handoffContext.includes('Operator Boundary:'));
+ assert.doesNotMatch(
+ context.handoffContext,
+ /Current Value:|Threshold:|wrong-node|vm-wrong/,
+ );
+ assert.doesNotMatch(context.briefing.detailLines.join('\n'), /Current value|threshold/);
+ await page.evaluate(() => window.__systemAlertScope.closeExplanation());
+ };
+ try {
+ await page.goto(`${origin}/browser-tests/system-alert-scope.html`);
+ const overview = page.getByRole('region', { name: 'Existing alert overview' });
+ const history = page.getByRole('region', { name: 'Existing alert history' });
+ const backupCard = page.locator('#alert-pulse-system-backup-evaluation');
+ await check(
+ 'canonical service warning has no false resource link or policy action',
+ async () => {
+ await backupCard.waitFor({ state: 'visible' });
+ assert.equal(
+ await overview
+ .getByText('Notification delivery status is unavailable', { exact: true })
+ .count(),
+ 0,
+ );
+ assert.equal(await backupCard.getByRole('link').count(), 0);
+ assert.equal(
+ await backupCard.getByRole('button', { name: 'Have Patrol investigate' }).count(),
+ 0,
+ );
+ assert.match(await backupCard.textContent(), /Backup-age alerts were not evaluated/);
+ await page.waitForFunction(() => window.__systemAlertScope.historyRows().length === 3);
+ const rows = await page.evaluate(() => window.__systemAlertScope.historyRows());
+ for (const row of rows.filter((r) => r.systemAlert)) {
+ assert.equal(row.resourceType, 'Pulse');
+ assert.equal(row.resourceId, '');
+ }
+ assert.equal(rows.find((r) => r.id === 'resource-cpu').resourceType, 'vm');
+ },
+ );
+ await capture(overview, 'backup-warning');
+ await check('acknowledgement remains active, not recovery', async () => {
+ await backupCard.getByRole('button', { name: 'Acknowledge', exact: true }).click();
+ await backupCard.getByText('Acknowledged', { exact: true }).waitFor();
+ assert.match(await backupCard.textContent(), /Backup-age alerts were not evaluated/);
+ await backupCard.getByRole('button', { name: 'Unacknowledge', exact: true }).click();
+ await backupCard.getByRole('button', { name: 'Acknowledge', exact: true }).waitFor();
+ });
+ await check('occurrence timeline keeps exact service identity', async () => {
+ await backupCard.getByRole('button', { name: 'Timeline', exact: true }).click();
+ await page.waitForFunction(() =>
+ document
+ .querySelector('#alert-pulse-system-backup-evaluation')
+ ?.textContent.includes('No incident'),
+ );
+ const incident = requests.find((r) => r.path === '/api/alerts/incidents');
+ assert.ok(incident);
+ const query = new URLSearchParams(incident.query);
+ assert.equal(query.get('alertIdentifier'), 'pulse-system-backup-evaluation');
+ assert.equal(query.get('started_at'), '2026-10-04T15:00:00Z');
+ await backupCard.getByRole('button', { name: 'Hide Timeline', exact: true }).click();
+ });
+ for (const type of systemTypes) {
+ await check(`${type} explanation is service-scoped and model-only`, async () => {
+ await page.evaluate((type) => window.__systemAlertScope.updateSystem(type), type);
+ const card = page.locator(`#alert-pulse-system-${type}`);
+ await card.waitFor({ state: 'visible' });
+ assert.equal(await card.getByRole('link').count(), 0);
+ const button = card.getByRole('button', { name: 'Ask Pulse Assistant', exact: true });
+ if (width > 500) {
+ await button.focus();
+ await page.keyboard.press('Enter');
+ } else await button.tap();
+ await assertSystemContext(`pulse-system-${type}`);
+ });
+ }
+ await check(
+ 'legacy system metadata wins over conflicting resource/metric hints',
+ async () => {
+ await page.evaluate(() =>
+ window.__systemAlertScope.updateSystem('future-condition', true),
+ );
+ const card = page.locator('#alert-legacy-system-id');
+ await card.waitFor({ state: 'visible' });
+ assert.equal(await card.getByRole('link').count(), 0);
+ assert.doesNotMatch(await card.textContent(), /limit:|wrong-node/);
+ await card.getByRole('button', { name: 'Ask Pulse Assistant', exact: true }).click();
+ await assertSystemContext('legacy-system-id');
+ },
+ );
+ await check(
+ 'desktop and phone History reconstruct the retained service marker',
+ async () => {
+ const row =
+ width < 500
+ ? history
+ .locator('[data-alert-history-row-key]')
+ .filter({ hasText: legacy.message })
+ : history.getByRole('row').filter({ hasText: legacy.message });
+ assert.equal(await row.locator('[data-alert-history-action="resource"]').count(), 0);
+ await row.getByRole('button', { name: 'Ask Pulse Assistant about this alert' }).click();
+ await assertSystemContext(legacy.id);
+ },
+ );
+ await capture(history, 'retained-history');
+ await check(
+ 'monitored VM called Pulse retains its link and targeted affordances',
+ async () => {
+ const card = page.locator('#alert-resource-cpu');
+ assert.equal(
+ await card.getByRole('link', { name: 'Pulse', exact: true }).getAttribute('href'),
+ '/proxmox/overview',
+ );
+ assert.match(await card.textContent(), /limit: 80%/);
+ await card
+ .getByRole('button', { name: 'Have Patrol investigate' })
+ .waitFor({ state: 'visible' });
+ },
+ );
+ await check(
+ 'authoritative recovery withdraws only the current service warning',
+ async () => {
+ await page.evaluate(() => window.__systemAlertScope.recover());
+ assert.equal(await overview.locator('[id^="alert-legacy"]').count(), 0);
+ assert.equal(await overview.locator('#alert-resource-cpu').count(), 1);
+ assert.ok(
+ (await page.evaluate(() => window.__systemAlertScope.historyRows())).some(
+ (r) => r.id === legacy.id,
+ ),
+ );
+ },
+ );
+ assert.deepEqual(errors, []);
+ assert.deepEqual(offOrigin, []);
+ assert.equal(writes.length, 2);
+ assert.ok(
+ !requests.some((r) => /patrol\/run|execute|diagnostic|ai\/chat|guest-agent/.test(r.path)),
+ );
+ results.push({
+ name,
+ width,
+ dark,
+ browser_version: browser.version(),
+ checks,
+ requests,
+ writes,
+ errors,
+ offOrigin,
+ });
+ } finally {
+ await browser.close();
+ browser = null;
+ }
+ }
+ fs.writeFileSync(
+ path.join(output, 'result.json'),
+ JSON.stringify(
+ { passed: true, playwright_version: version, content_sha256: hashes, results, screenshots },
+ null,
+ 2,
+ ) + '\n',
+ );
+ console.log(
+ JSON.stringify({
+ passed: true,
+ groups: results.length,
+ checks: results.reduce((n, r) => n + r.checks.length, 0),
+ screenshots: screenshots.length,
+ playwright_version: version,
+ }),
+ );
+ } catch (error) {
+ fs.writeFileSync(
+ path.join(output, 'failed.json'),
+ JSON.stringify(
+ { passed: false, phase, error: error.message, results, screenshots },
+ null,
+ 2,
+ ) + '\n',
+ );
+ throw error;
+ } finally {
+ if (browser) await browser.close();
+ await server.close();
+ }
+})().catch((error) => {
+ console.error(error);
+ process.exitCode = 1;
+});
diff --git a/frontend-modern/browser-tests/system-alert-scope.html b/frontend-modern/browser-tests/system-alert-scope.html
new file mode 100644
index 0000000000..5538407dca
--- /dev/null
+++ b/frontend-modern/browser-tests/system-alert-scope.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>System-alert scope verification</title>
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="./system-alert-scope.tsx"></script>
+ </body>
+</html>
diff --git a/frontend-modern/browser-tests/system-alert-scope.tsx b/frontend-modern/browser-tests/system-alert-scope.tsx
new file mode 100644
index 0000000000..ca02744e78
--- /dev/null
+++ b/frontend-modern/browser-tests/system-alert-scope.tsx
@@ -0,0 +1,107 @@
+// Production alert components/state/router and real Assistant handoff store.
+// Synthetic API evidence; no native service, model, diagnostic or command.
+import { createSignal, Show } from 'solid-js';
+import { render } from 'solid-js/web';
+import { Router, Route } from '@solidjs/router';
+import { OverviewTab } from '../src/features/alerts/OverviewTab';
+import { AlertHistoryTableSection } from '../src/features/alerts/AlertHistoryTableSection';
+import { useAlertHistoryState } from '../src/features/alerts/useAlertHistoryState';
+import { makeSystemAlert } from '../src/features/alerts/__fixtures__/systemAlerts';
+import { aiChatStore } from '../src/stores/aiChat';
+import type { Alert } from '../src/types/api';
+import type { Resource } from '../src/types/resource';
+import '../src/index.css';
+
+aiChatStore.setEnabled(true);
+const pulseVM = { id: 'vm-pulse', name: 'Pulse', type: 'vm' } as Resource;
+const control = makeSystemAlert('cpu', {
+ id: 'resource-cpu',
+ resourceId: pulseVM.id,
+ metadata: { resourceType: 'vm' },
+ value: 92,
+ threshold: 80,
+ message: 'Synthetic CPU reading on the monitored VM called Pulse.',
+});
+
+function Fixture() {
+ const initial = makeSystemAlert();
+ const [alerts, setAlerts] = createSignal<Record<string, Alert>>({
+ [initial.id]: initial,
+ [control.id]: control,
+ });
+ const [showAcknowledged, setShowAcknowledged] = createSignal(true);
+ const history = useAlertHistoryState({
+ activeAlerts: alerts,
+ getResource: () => pulseVM,
+ allResources: () => [pulseVM],
+ });
+ (window as any).__systemAlertScope = {
+ updateSystem: (type: string, legacy = false) => {
+ const next = makeSystemAlert(
+ type,
+ legacy
+ ? {
+ id: 'legacy-system-id',
+ resourceId: 'vm-wrong',
+ node: 'wrong-node',
+ metadata: { systemAlert: true, resourceType: 'vm' },
+ threshold: 80,
+ }
+ : {},
+ );
+ setAlerts({ [next.id]: next, [control.id]: control });
+ },
+ recover: () => setAlerts({ [control.id]: control }),
+ alerts,
+ historyRows: history.alertData,
+ context: () => aiChatStore.context,
+ closeExplanation: () => aiChatStore.close(),
+ };
+ return (
+ <main class="mx-auto min-h-screen max-w-5xl space-y-4 bg-surface p-3 text-base-content">
+ <h1 class="text-base font-semibold">Pulse system-alert evidence</h1>
+ <p class="text-xs text-muted">
+ Synthetic observations. No workload, diagnostic or model is contacted.
+ </p>
+ <section aria-label="Existing alert overview">
+ <OverviewTab
+ activeAlerts={alerts()}
+ overrides={[]}
+ updateAlert={(id, updates) =>
+ setAlerts((previous) => ({ ...previous, [id]: { ...previous[id], ...updates } }))
+ }
+ showAcknowledged={showAcknowledged}
+ setShowAcknowledged={setShowAcknowledged}
+ showQuickTip={() => false}
+ dismissQuickTip={() => {}}
+ alertsDisabled={() => false}
+ />
+ </section>
+ <section aria-label="Existing alert history">
+ <h2 class="mb-2 font-semibold">History</h2>
+ <AlertHistoryTableSection state={history} />
+ </section>
+ <Show when={aiChatStore.isOpenSignal()}>
+ <section
+ aria-label="Captured explanation context"
+ class="rounded-md border border-border p-3"
+ >
+ <p class="text-sm">
+ Test capture of the real explanation store; no Assistant request is executed.
+ </p>
+ <pre class="whitespace-pre-wrap break-all text-xs">
+ {JSON.stringify(aiChatStore.context, null, 2)}
+ </pre>
+ </section>
+ </Show>
+ </main>
+ );
+}
+render(
+ () => (
+ <Router>
+ <Route path="/*" component={Fixture} />
+ </Router>
+ ),
+ document.getElementById('root')!,
+);
diff --git a/frontend-modern/browser-verification/4c16797de9c711c2.json b/frontend-modern/browser-verification/4c16797de9c711c2.json
new file mode 100644
index 0000000000..196b87c2f8
--- /dev/null
+++ b/frontend-modern/browser-verification/4c16797de9c711c2.json
@@ -0,0 +1,54 @@
+{
+ "version": 1,
+ "base_sha": "63443e8712dbb6d3866bdc5fce9f2b89c13be51c",
+ "verified_at": "2026-10-04T16:33:49Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx",
+ "frontend-modern/src/components/Alerts/alertAssistantHandoffModel.ts",
+ "frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx",
+ "frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx",
+ "frontend-modern/src/features/alerts/alertHistoryModel.ts",
+ "frontend-modern/src/utils/alertScope.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx": "f68c7c887abd83ee4b8c022874951b6be06d5b9975bb2a78a0f782d3d5419001",
+ "frontend-modern/src/components/Alerts/alertAssistantHandoffModel.ts": "01eaea04cf8730fca4342d12b2be4e2fefd6e31b530ab1e416a937557cb4d664",
+ "frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx": "9e7bf38b1f3e57f4a8b178ee48770561e5eef7f93440c190d3001ed95526e765",
+ "frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx": "198eecb8d3f94aaf14020686c494f343db687d49c0933589005adb795b35bc8b",
+ "frontend-modern/src/features/alerts/alertHistoryModel.ts": "69e754d21e4b700bd8e7308e72082786373b1f25f0e2d4ea4434a2d4ba804a1a",
+ "frontend-modern/src/utils/alertScope.ts": "b10844bcf4a3a2a829d49c385369a0559102477b84688f27c311de02ce931065"
+ },
+ "routes": ["/browser-tests/system-alert-scope.html"],
+ "viewports": [
+ {
+ "width": 1365,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ },
+ {
+ "width": 320,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Production Overview and desktop/mobile History with synthetic canonical system-alert payloads; no native service or full-App acceptance.",
+ "Backup evaluation unavailable, all six current system types, metadata-only future/legacy type with conflicting resource/metric hints.",
+ "Monitored VM named Pulse remains resource scoped; independent synthetic notification queue health is complete and healthy.",
+ "Acknowledged service warning remains active; explicit source recovery removes only current service warning and retains historical occurrence.",
+ "Light/dark desktop and 390px/320px WebKit touch layouts; eight final screenshots inspected."
+ ],
+ "interactions": [
+ "Acknowledgement and unacknowledgement retain exact canonical service alert identifier and do not resolve its condition.",
+ "Occurrence timeline fetch preserves service identifier and original start timestamp.",
+ "Six real explanation-button handoffs use keyboard Enter on desktop and touch tap on phones; no metric values, resource targets, Patrol, model or diagnostic calls.",
+ "History explanation reconstructs metadata-only system scope; resource link/Monitoring/Patrol remain only on actual VM control."
+ ],
+ "browser_command": "pulse-worker-browser frontend-modern/browser-tests/system-alert-scope.cjs",
+ "playwright_version": "1.56.1",
+ "passed_groups": 4,
+ "passed_checks": 52
+}
diff --git a/frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx b/frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx
index e7098f7af4..6834affd70 100644
--- a/frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx
+++ b/frontend-modern/src/components/Alerts/InvestigateAlertButton.tsx
@@ -7,6 +7,7 @@ import { notificationStore } from '@/stores/notifications';
import { triggerPatrolRun } from '@/api/patrol';
import { t } from '@/i18n';
import type { Alert } from '@/types/api';
+import { isPulseSystemAlert } from '@/utils/alertScope';
import { useUpgradeNavigation } from '@/components/shared/useUpgradeNavigation';
import { getUpgradeActionDestination } from '@/stores/licenseCommercial';
import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';
@@ -54,7 +55,10 @@ export function InvestigateAlertButton(props: InvestigateAlertButtonProps) {
}
const showPatrolOption = () =>
- props.patrolOption === true && !isLocked() && !!(props.alert.resourceId || '').trim();
+ props.patrolOption === true &&
+ !isLocked() &&
+ !isPulseSystemAlert(props.alert) &&
+ !!(props.alert.resourceId || '').trim();
const usesPatrolPrimary = () => showPatrolOption() && props.variant !== 'icon';
const buttonTitle = () =>
isLocked()
@@ -97,7 +101,7 @@ export function InvestigateAlertButton(props: InvestigateAlertButtonProps) {
const startPatrolInvestigation = async () => {
const resourceId = (props.alert.resourceId || '').trim();
- if (!resourceId) {
+ if (isPulseSystemAlert(props.alert) || !resourceId) {
notificationStore.warning(t('alerts.assistant.patrol.noResource'));
return;
}
diff --git a/frontend-modern/src/components/Alerts/__tests__/InvestigateAlertButton.test.tsx b/frontend-modern/src/components/Alerts/__tests__/InvestigateAlertButton.test.tsx
index 516df51d18..bc93b32485 100644
--- a/frontend-modern/src/components/Alerts/__tests__/InvestigateAlertButton.test.tsx
+++ b/frontend-modern/src/components/Alerts/__tests__/InvestigateAlertButton.test.tsx
@@ -157,6 +157,28 @@ beforeEach(() => {
});
describe('system-alert investigation', () => {
+ it('retains resource Patrol for a monitored VM named Pulse', async () => {
+ const alert = makeAlert({ resourceName: 'Pulse' });
+ render(() => <InvestigateAlertButton alert={alert} variant="full" patrolOption />);
+ fireEvent.click(screen.getByRole('button', { name: 'Have Patrol investigate' }));
+ await waitFor(() => expect(triggerPatrolRunMock).toHaveBeenCalledTimes(1));
+ expect(triggerPatrolRunMock).toHaveBeenCalledWith({
+ resource_ids: ['vm-101'],
+ alert_identifier: alert.id,
+ alert_type: 'cpu',
+ });
+ expect(explainMock).not.toHaveBeenCalled();
+ });
+
+ it('retains metadata-only system scope on a historical ID', () => {
+ const alert = makeSystemAlert('future-condition', { id: 'legacy-id', resourceId: 'vm-wrong' });
+ render(() => <InvestigateAlertButton alert={alert} variant="full" patrolOption />);
+ fireEvent.click(screen.getByRole('button', { name: 'Ask Pulse Assistant about this alert' }));
+ expect(triggerPatrolRunMock).not.toHaveBeenCalled();
+ expect(openedContext().targetId).toBeUndefined();
+ expect(openedContext().handoffResources).toEqual([]);
+ });
+
it.each([undefined, { systemAlert: true, resourceType: 'vm' }])(
'opens explanation, never resource Patrol, for a system alert with metadata %j',
(metadata) => {
diff --git a/frontend-modern/src/components/Alerts/alertAssistantHandoffModel.ts b/frontend-modern/src/components/Alerts/alertAssistantHandoffModel.ts
index a006e379af..3a6a08b9c7 100644
--- a/frontend-modern/src/components/Alerts/alertAssistantHandoffModel.ts
+++ b/frontend-modern/src/components/Alerts/alertAssistantHandoffModel.ts
@@ -4,6 +4,7 @@ import { DEFAULT_LOCALE, t, type SupportedLocale } from '@/i18n';
import { getCanonicalAlertId } from '@/features/alerts/identity';
import { formatAlertValue } from '@/utils/alertFormatters';
import { isMetricAlertType } from '@/utils/alerts';
+import { isPulseSystemAlert } from '@/utils/alertScope';
import { resolveAlertTargetType } from '@/utils/alertTargetTypes';
interface BuildAlertAssistantHandoffInput {
@@ -32,23 +33,27 @@ export function buildAlertAssistantHandoff({
// threshold 0.0%" in operator-facing copy is misleading default-zero
// noise. Suppress those fields and rely on alert.type + alert.message
// to convey what's wrong.
- const hasMetricValues = isMetricAlertType(alert.type);
+ const systemScoped = isPulseSystemAlert(alert);
+ const hasMetricValues = !systemScoped && isMetricAlertType(alert.type);
const currentValue = hasMetricValues ? formatAlertValue(alert.value, alert.type) : '';
const thresholdValue = hasMetricValues ? formatAlertValue(alert.threshold, alert.type) : '';
- const nodeLabel = alert.node ? alert.nodeDisplayName || alert.node : '';
+ const nodeLabel = !systemScoped && alert.node ? alert.nodeDisplayName || alert.node : '';
const levelLabel = formatAlertLevel(alert.level);
const modelLevelLabel = formatAlertLevel(alert.level, DEFAULT_LOCALE);
- const targetType = resolveAlertTargetType({
- alertType: alert.type,
- resourceType,
- metadataResourceType:
- typeof alert.metadata?.resourceType === 'string'
- ? (alert.metadata.resourceType as string)
- : undefined,
- resourceId: alert.resourceId,
- });
+ const targetType = systemScoped
+ ? undefined
+ : resolveAlertTargetType({
+ alertType: alert.type,
+ resourceType,
+ metadataResourceType:
+ typeof alert.metadata?.resourceType === 'string'
+ ? (alert.metadata.resourceType as string)
+ : undefined,
+ resourceId: alert.resourceId,
+ });
const handoffContext = buildAlertAssistantModelContext({
alert,
+ systemScoped,
alertIdentifier,
currentValue,
thresholdValue,
@@ -60,17 +65,19 @@ export function buildAlertAssistantHandoff({
return {
context: {
targetType,
- targetId: alert.resourceId,
+ targetId: systemScoped ? undefined : alert.resourceId,
autonomousMode: false,
handoffContext,
- handoffResources: [
- {
- id: alert.resourceId,
- name: alert.resourceName,
- type: targetType,
- node: alert.node,
- },
- ],
+ handoffResources: systemScoped
+ ? []
+ : [
+ {
+ id: alert.resourceId,
+ name: alert.resourceName,
+ type: targetType,
+ node: alert.node,
+ },
+ ],
briefing: {
sourceLabel: t('alerts.assistant.sourceLabel'),
title: t('alerts.assistant.title'),
@@ -103,9 +110,9 @@ export function buildAlertAssistantHandoff({
alertType: alert.type,
alertLevel: alert.level,
alertMessage: alert.message,
- guestName: alert.resourceName,
- node: alert.node,
- vmid,
+ guestName: systemScoped ? undefined : alert.resourceName,
+ node: systemScoped ? undefined : alert.node,
+ vmid: systemScoped ? undefined : vmid,
},
},
};
@@ -113,6 +120,7 @@ export function buildAlertAssistantHandoff({
function buildAlertAssistantModelContext({
alert,
+ systemScoped,
alertIdentifier,
currentValue,
thresholdValue,
@@ -121,6 +129,7 @@ function buildAlertAssistantModelContext({
levelLabel,
}: {
alert: Alert;
+ systemScoped: boolean;
alertIdentifier: string;
currentValue: string;
thresholdValue: string;
@@ -135,8 +144,9 @@ function buildAlertAssistantModelContext({
formatContextLine('Alert Type', alert.type),
formatContextLine('Alert Level', levelLabel),
formatContextLine('Alert Status', 'active'),
- formatContextLine('Resource', alert.resourceName),
- formatContextLine('Resource ID', alert.resourceId),
+ systemScoped ? 'Scope: Pulse itself (not a monitored resource)' : undefined,
+ formatContextLine(systemScoped ? 'Service' : 'Resource', alert.resourceName),
+ systemScoped ? undefined : formatContextLine('Resource ID', alert.resourceId),
formatContextLine('Current Value', currentValue),
formatContextLine('Threshold', thresholdValue),
formatContextLine('Duration', durationText),
diff --git a/frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx b/frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx
index 4532b62297..74697f961e 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx
@@ -91,6 +91,7 @@ export function AlertHistoryItemActions(props: AlertHistoryItemActionsProps) {
startTime: props.alert.startTime,
lastSeen: props.alert.startTime,
acknowledged: props.alert.status === 'acknowledged',
+ metadata: props.alert.systemAlert ? { systemAlert: true } : undefined,
}}
resourceType={props.alert.resourceType}
variant="icon"
diff --git a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
index 2510d165ed..77b59924a6 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
@@ -31,6 +31,7 @@ import type { AlertOverviewState } from './useAlertOverviewState';
import { ResourceMonitoringPolicyAction } from './ResourceMonitoringPolicyAction';
import { AlertSnoozeAction } from './AlertSnoozeAction';
import { isAlertSnoozed } from './useAlertSnoozeState';
+import { isPulseSystemAlert } from '@/utils/alertScope';
interface AlertOverviewAlertCardProps {
alert: Alert;
@@ -40,6 +41,8 @@ interface AlertOverviewAlertCardProps {
export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
const alertKey = () => getCanonicalAlertId(props.alert);
+ const hasResource = () =>
+ !isPulseSystemAlert(props.alert) && Boolean(props.alert.resourceId?.trim());
const processing = () =>
props.state.processingAlerts().has(alertKey()) ||
props.state.snoozeProcessingAlerts().has(alertKey());
@@ -124,20 +127,29 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
</div>
<div class="flex-1 min-w-0">
<div class="flex flex-wrap items-center gap-2">
- <A
- href={resourceLink()}
- class={`${alertCardPresentation().resourceClassName} hover:underline cursor-pointer`}
- title="View resource"
+ <Show
+ when={hasResource()}
+ fallback={
+ <span class={alertCardPresentation().resourceClassName}>
+ {props.alert.resourceName}
+ </span>
+ }
>
- {props.alert.resourceName}
- </A>
+ <A
+ href={resourceLink()}
+ class={`${alertCardPresentation().resourceClassName} hover:underline cursor-pointer`}
+ title="View resource"
+ >
+ {props.alert.resourceName}
+ </A>
+ </Show>
<span class="text-xs text-muted">({alertTypeDisplayLabel(props.alert.type)})</span>
<Show when={!props.alert.acknowledged}>
<span class={getAlertSeverityBadgeClass(props.alert.level)}>
{formatAlertSeverityLabel(props.alert.level)}
</span>
</Show>
- <Show when={props.alert.node}>
+ <Show when={!isPulseSystemAlert(props.alert) && props.alert.node}>
<span class="text-xs text-muted">
{getAlertOverviewNodeLabel(props.alert.nodeDisplayName || props.alert.node)}
</span>
@@ -158,7 +170,7 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
<p class={getAlertOverviewStartedAtClass()}>
{getAlertOverviewStartedAtLabel(new Date(props.alert.startTime).toLocaleString())}
</p>
- <Show when={props.alert.threshold > 0}>
+ <Show when={!isPulseSystemAlert(props.alert) && props.alert.threshold > 0}>
<span class="text-xs text-muted">
limit: {props.alert.threshold}
{props.alert.type === 'temperature' || props.alert.type === 'diskTemperature'
@@ -231,7 +243,7 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
props.timelineState.expandedIncidents().has(alertKey()),
)}
</button>
- <Show when={(props.alert.resourceId || '').trim()}>
+ <Show when={hasResource()}>
<ResourceMonitoringPolicyAction
resourceId={props.alert.resourceId}
resourceName={props.alert.resourceName || props.alert.resourceId}
diff --git a/frontend-modern/src/features/alerts/alertHistoryModel.ts b/frontend-modern/src/features/alerts/alertHistoryModel.ts
index d224291543..bd2d89af25 100644
--- a/frontend-modern/src/features/alerts/alertHistoryModel.ts
+++ b/frontend-modern/src/features/alerts/alertHistoryModel.ts
@@ -1,5 +1,6 @@
import type { Alert } from '@/types/api';
import type { Resource } from '@/types/resource';
+import { isPulseSystemAlert } from '@/utils/alertScope';
import { alertTypeDisplayLabel, unifiedTypeToAlertDisplayType } from './helpers';
@@ -25,6 +26,7 @@ export interface HistoryItem {
rawAlertType?: string;
description?: string;
acknowledged?: boolean;
+ systemAlert?: boolean;
}
export interface AlertTrendSeries {
@@ -121,15 +123,18 @@ export function resolveAlertHistoryResourceType({
resourceName,
metadata,
resourceId,
+ alertId,
getResource,
allResources,
}: {
resourceName: string;
metadata?: Record<string, unknown>;
resourceId?: string;
+ alertId?: string;
getResource: (resourceId: string) => Resource | undefined;
allResources: Resource[];
}) {
+ if (isPulseSystemAlert({ id: alertId || '', metadata })) return 'Pulse';
const metadataType =
typeof metadata?.resourceType === 'string' ? (metadata.resourceType as string) : undefined;
if (metadataType && metadataType.trim().length > 0) {
@@ -169,6 +174,7 @@ export function buildAlertHistoryItems({
const items: HistoryItem[] = [];
Object.values(activeAlerts).forEach((alert) => {
+ const systemScoped = isPulseSystemAlert(alert);
items.push({
id: alert.id,
source: 'alert',
@@ -177,15 +183,17 @@ export function buildAlertHistoryItems({
duration: formatAlertHistoryDuration(alert.startTime, undefined, now),
resourceName: alert.resourceName,
resourceType: resolveAlertHistoryResourceType({
+ alertId: alert.id,
resourceName: alert.resourceName,
metadata: alert.metadata,
resourceId: alert.resourceId,
getResource,
allResources,
}),
- resourceId: alert.resourceId,
- node: alert.node,
- nodeDisplayName: alert.nodeDisplayName,
+ resourceId: systemScoped ? '' : alert.resourceId,
+ node: systemScoped ? undefined : alert.node,
+ nodeDisplayName: systemScoped ? undefined : alert.nodeDisplayName,
+ ...(systemScoped ? { systemAlert: true } : {}),
severity: alert.level,
title: alertTypeDisplayLabel(alert.type),
rawAlertType: alert.type,
@@ -197,6 +205,7 @@ export function buildAlertHistoryItems({
const activeAlertIds = new Set(Object.keys(activeAlerts));
alertHistory.forEach((alert) => {
if (activeAlertIds.has(alert.id)) return;
+ const systemScoped = isPulseSystemAlert(alert);
items.push({
id: alert.id,
@@ -207,15 +216,17 @@ export function buildAlertHistoryItems({
duration: formatAlertHistoryDuration(alert.startTime, alert.lastSeen, now),
resourceName: alert.resourceName,
resourceType: resolveAlertHistoryResourceType({
+ alertId: alert.id,
resourceName: alert.resourceName,
metadata: alert.metadata,
resourceId: alert.resourceId,
getResource,
allResources,
}),
- resourceId: alert.resourceId,
- node: alert.node,
- nodeDisplayName: alert.nodeDisplayName,
+ resourceId: systemScoped ? '' : alert.resourceId,
+ node: systemScoped ? undefined : alert.node,
+ nodeDisplayName: systemScoped ? undefined : alert.nodeDisplayName,
+ ...(systemScoped ? { systemAlert: true } : {}),
severity: alert.level,
title: alertTypeDisplayLabel(alert.type),
rawAlertType: alert.type,
diff --git a/frontend-modern/src/utils/__tests__/alertScope.test.ts b/frontend-modern/src/utils/__tests__/alertScope.test.ts
new file mode 100644
index 0000000000..6337a4d201
--- /dev/null
+++ b/frontend-modern/src/utils/__tests__/alertScope.test.ts
@@ -0,0 +1,17 @@
+import { describe, expect, it } from 'vitest';
+import { isPulseSystemAlert } from '../alertScope';
+
+describe('Pulse system-alert scope markers', () => {
+ it('accepts the canonical ID even when metadata is absent', () => {
+ expect(isPulseSystemAlert({ id: 'pulse-system-future-condition' })).toBe(true);
+ });
+ it('accepts explicit metadata on a retained legacy ID', () => {
+ expect(isPulseSystemAlert({ id: 'legacy-id', metadata: { systemAlert: true } })).toBe(true);
+ });
+ it.each([undefined, false, 'true', 1])(
+ 'does not infer system scope from metadata %j',
+ (marker) => {
+ expect(isPulseSystemAlert({ id: 'vm-pulse', metadata: { systemAlert: marker } })).toBe(false);
+ },
+ );
+});
diff --git a/frontend-modern/src/utils/alertScope.ts b/frontend-modern/src/utils/alertScope.ts
new file mode 100644
index 0000000000..1eafe470d6
--- /dev/null
+++ b/frontend-modern/src/utils/alertScope.ts
@@ -0,0 +1,10 @@
+import type { Alert } from '@/types/api';
+
+/**
+ * Mirror the existing system-alert identity/metadata contract. Names and alert
+ * types are not scope evidence: a monitored machine can also be called Pulse,
+ * and future system conditions must not need a frontend type allowlist.
+ */
+export function isPulseSystemAlert(alert: Pick<Alert, 'id' | 'metadata'>): boolean {
+ return alert.id.startsWith('pulse-system-') || alert.metadata?.systemAlert === true;
+}