Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Reproduce misleading Pulse system-alert scope
pulse-triage[bot]63443e8712db
diff --git a/frontend-modern/src/components/Alerts/__tests__/InvestigateAlertButton.test.tsx b/frontend-modern/src/components/Alerts/__tests__/InvestigateAlertButton.test.tsxindex a7194f6f5b..516df51d18 100644--- a/frontend-modern/src/components/Alerts/__tests__/InvestigateAlertButton.test.tsx+++ b/frontend-modern/src/components/Alerts/__tests__/InvestigateAlertButton.test.tsx@@ -2,6 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';import { DEFAULT_LOCALE, setActiveLocale } from '@/i18n';import type { Alert } from '@/types/api';+import { makeSystemAlert } from '@/features/alerts/__fixtures__/systemAlerts';import { getPublicPricingUrl } from '@/utils/pricingHandoff';// ---------------------------------------------------------------------------@@ -155,6 +156,22 @@ beforeEach(() => {notificationStoreMock.info.mockReset();});+describe('system-alert investigation', () => {+ it.each([undefined, { systemAlert: true, resourceType: 'vm' }])(+ 'opens explanation, never resource Patrol, for a system alert with metadata %j',+ (metadata) => {+ const alert = makeSystemAlert('backup-evaluation', { resourceId: 'vm-wrong', metadata });+ render(() => <InvestigateAlertButton alert={alert} variant="full" patrolOption />);+ fireEvent.click(screen.getByRole('button', { name: 'Ask Pulse Assistant about this alert' }));+ expect(explainMock).toHaveBeenCalledTimes(1);+ expect(triggerPatrolRunMock).not.toHaveBeenCalled();+ expect(openedContext().targetId).toBeUndefined();+ expect(openedContext().handoffResources).toEqual([]);+ expect(formatAlertValueMock).not.toHaveBeenCalled();+ },+ );+});+// ---------------------------------------------------------------------------// Rendering / visibility// ---------------------------------------------------------------------------diff --git a/frontend-modern/src/components/Alerts/__tests__/alertAssistantHandoffModel.test.ts b/frontend-modern/src/components/Alerts/__tests__/alertAssistantHandoffModel.test.tsindex 3d0e532922..9f23bdbe9a 100644--- a/frontend-modern/src/components/Alerts/__tests__/alertAssistantHandoffModel.test.ts+++ b/frontend-modern/src/components/Alerts/__tests__/alertAssistantHandoffModel.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from 'vitest';import type { Alert } from '@/types/api';import { buildAlertAssistantHandoff } from '../alertAssistantHandoffModel';+import { makeSystemAlert, SYSTEM_ALERT_TYPES } from '@/features/alerts/__fixtures__/systemAlerts';function makeAlert(overrides: Partial<Alert> = {}): Alert {return {@@ -22,6 +23,39 @@ function makeAlert(overrides: Partial<Alert> = {}): Alert {}describe('alertAssistantHandoffModel', () => {+ it.each(SYSTEM_ALERT_TYPES)(+ 'explains Pulse %s without fabricated metric or resource context',+ (type) => {+ const alert = makeSystemAlert(type);+ const { context } = buildAlertAssistantHandoff({ alert, resourceType: 'vm', vmid: 101 });+ expect(context.targetType).toBeUndefined();+ expect(context.targetId).toBeUndefined();+ expect(context.handoffResources).toEqual([]);+ expect(context.autonomousMode).toBe(false);+ expect(context.handoffContext).toContain('Scope: Pulse itself (not a monitored resource)');+ expect(context.handoffContext).toContain(alert.message);+ expect(context.handoffContext).toContain(`Alert Identifier: ${alert.id}`);+ expect(context.handoffContext).toContain('Operator Boundary:');+ expect(context.handoffContext).not.toMatch(/Current Value:|Threshold:|Resource ID:|Node:/);+ expect(context.context?.guestName).toBeUndefined();+ expect(context.context?.vmid).toBeUndefined();+ expect(context.briefing?.detailLines?.join('\n')).not.toMatch(/Current value|threshold/);+ },+ );++ it('retains system scope for future types and legacy IDs carrying system metadata', () => {+ const { context } = buildAlertAssistantHandoff({+ alert: makeSystemAlert('future-condition', {+ id: 'legacy-system-id',+ resourceId: 'vm-wrong',+ node: 'wrong-node',+ metadata: { systemAlert: true, resourceType: 'vm' },+ }),+ });+ expect(context.targetId).toBeUndefined();+ expect(context.handoffResources).toEqual([]);+ expect(context.handoffContext).not.toMatch(/wrong-node|vm-wrong/);+ });it('builds a visible approval-required alert handoff without command payloads', () => {const handoff = buildAlertAssistantHandoff({alert: makeAlert(),diff --git a/frontend-modern/src/features/alerts/__fixtures__/systemAlerts.ts b/frontend-modern/src/features/alerts/__fixtures__/systemAlerts.tsnew file mode 100644index 0000000000..6f2f9086a1--- /dev/null+++ b/frontend-modern/src/features/alerts/__fixtures__/systemAlerts.ts@@ -0,0 +1,35 @@+import type { Alert } from '@/types/api';++// Synthetic payloads shaped like Manager.RaiseSystemAlert. No native services.+export const SYSTEM_ALERT_TYPES = [+ 'backup-evaluation',+ 'notification-delivery',+ 'deadman-delivery',+ 'deadman-monitoring-stalled',+ 'deadman-interruption',+ 'deadman-state',+] as const;++export function makeSystemAlert(+ type: string = 'backup-evaluation',+ overrides: Partial<Alert> = {},+): Alert {+ return {+ id: `pulse-system-${type}`,+ type,+ resourceId: '',+ resourceName: 'Pulse',+ node: '',+ instance: '',+ level: 'warning',+ message:+ "Backup-age alerts were not evaluated because recovery data could not be read. Existing backup alerts have been kept; check Pulse's logs.",+ value: 0,+ threshold: 0,+ startTime: '2026-10-04T15:00:00Z',+ lastSeen: '2026-10-04T15:01:00Z',+ acknowledged: false,+ metadata: { systemAlert: true, systemAlertType: type },+ ...overrides,+ };+}diff --git a/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsxnew file mode 100644index 0000000000..b150134fa8--- /dev/null+++ b/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx@@ -0,0 +1,88 @@+import { afterEach, describe, expect, it, vi } from 'vitest';+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import type { AlertOverviewState } from '../useAlertOverviewState';+import type { AlertIncidentTimelineState } from '../useAlertIncidentTimelineState';+import { makeSystemAlert, SYSTEM_ALERT_TYPES } from '../__fixtures__/systemAlerts';++vi.mock('@solidjs/router', () => ({+ A: (props: any) => (+ <a href={props.href} title={props.title}>+ {props.children}+ </a>+ ),+}));+vi.mock('@/components/Alerts/InvestigateAlertButton', () => ({+ InvestigateAlertButton: () => null,+}));+vi.mock('../ResourceMonitoringPolicyAction', () => ({+ ResourceMonitoringPolicyAction: () => <button>Resource monitoring policy</button>,+}));+vi.mock('../AlertSnoozeAction', () => ({ AlertSnoozeAction: () => null }));+import { AlertOverviewAlertCard } from '../AlertOverviewAlertCard';++const acknowledge = vi.fn();+const toggleTimeline = vi.fn();+const state = {+ processingAlerts: () => new Set(),+ snoozeProcessingAlerts: () => new Set(),+ deliveryDiagnoses: () => ({}),+ handleAlertAcknowledgement: acknowledge,+} as unknown as AlertOverviewState;+const timelineState = {+ expandedIncidents: () => new Set(),+ toggleIncidentTimeline: toggleTimeline,+} as unknown as AlertIncidentTimelineState;+afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe('Pulse system-alert overview scope', () => {+ it.each(SYSTEM_ALERT_TYPES)('does not link %s to a fictional Proxmox resource', (type) => {+ const alert = makeSystemAlert(type);+ render(() => (+ <AlertOverviewAlertCard alert={alert} state={state} timelineState={timelineState} />+ ));+ expect(screen.getByText('Pulse').closest('a')).toBeNull();+ expect(screen.getByText(alert.message)).toBeInTheDocument();+ expect(screen.queryByText('Resource monitoring policy')).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'Acknowledge' }));+ expect(acknowledge).toHaveBeenCalledWith(alert);+ fireEvent.click(screen.getByRole('button', { name: 'Timeline' }));+ expect(toggleTimeline).toHaveBeenCalledWith(alert.id, alert.id, alert.startTime);+ });++ it('ignores conflicting metric and resource hints on a marked system alert', () => {+ const alert = makeSystemAlert('future-system-condition', {+ id: 'legacy-id',+ resourceId: 'vm-wrong',+ threshold: 80,+ metadata: { systemAlert: true, resourceType: 'vm' },+ });+ render(() => (+ <AlertOverviewAlertCard alert={alert} state={state} timelineState={timelineState} />+ ));+ expect(screen.getByText('Pulse').closest('a')).toBeNull();+ expect(screen.queryByText(/limit:/)).toBeNull();+ expect(screen.queryByText('Resource monitoring policy')).toBeNull();+ });++ it('preserves the actual link and metric limit for a monitored resource called Pulse', () => {+ const alert = makeSystemAlert('cpu', {+ id: 'resource-cpu',+ resourceId: 'vm-pulse',+ value: 92,+ threshold: 80,+ metadata: undefined,+ });+ render(() => (+ <AlertOverviewAlertCard alert={alert} state={state} timelineState={timelineState} />+ ));+ expect(screen.getByRole('link', { name: 'Pulse' })).toHaveAttribute(+ 'href',+ '/proxmox/overview',+ );+ expect(screen.getByText('limit: 80%')).toBeInTheDocument();+ expect(screen.getByText('Resource monitoring policy')).toBeInTheDocument();+ });+});diff --git a/frontend-modern/src/features/alerts/__tests__/alertHistoryModel.system-scope.test.ts b/frontend-modern/src/features/alerts/__tests__/alertHistoryModel.system-scope.test.tsnew file mode 100644index 0000000000..df82138c8c--- /dev/null+++ b/frontend-modern/src/features/alerts/__tests__/alertHistoryModel.system-scope.test.ts@@ -0,0 +1,64 @@+import { describe, expect, it, vi } from 'vitest';+import type { Resource } from '@/types/resource';+import { buildAlertHistoryItems } from '../alertHistoryModel';+import { makeSystemAlert, SYSTEM_ALERT_TYPES } from '../__fixtures__/systemAlerts';++const pulseVM = { id: 'vm-pulse', name: 'Pulse', type: 'vm' } as Resource;++describe('Pulse system-alert history scope', () => {+ it.each(SYSTEM_ALERT_TYPES)(+ 'keeps active and resolved %s separate from a resource named Pulse',+ (type) => {+ const getResource = vi.fn(() => pulseVM);+ const active = makeSystemAlert(type);+ const resolved = makeSystemAlert(type, { id: `${active.id}-older`, acknowledged: true });+ const items = buildAlertHistoryItems({+ activeAlerts: { [active.id]: active },+ alertHistory: [active, resolved],+ getResource,+ allResources: [pulseVM],+ });+ expect(items).toHaveLength(2);+ for (const item of items) {+ expect(item.resourceType).toBe('Pulse');+ expect(item).toHaveProperty('systemAlert', true);+ expect(item.resourceId).toBe('');+ }+ expect(getResource).not.toHaveBeenCalled();+ },+ );++ it('prioritises explicit system metadata over conflicting resource hints', () => {+ const alert = makeSystemAlert('future-system-condition', {+ id: 'legacy-system-id',+ resourceId: pulseVM.id,+ metadata: { systemAlert: true, resourceType: 'vm' },+ });+ const [item] = buildAlertHistoryItems({+ activeAlerts: { [alert.id]: alert },+ alertHistory: [],+ getResource: () => pulseVM,+ allResources: [pulseVM],+ });+ expect(item.resourceType).toBe('Pulse');+ expect(item.resourceId).toBe('');+ expect(item).toHaveProperty('systemAlert', true);+ });++ it('does not turn a monitored VM called Pulse into a system alert', () => {+ const alert = makeSystemAlert('cpu', {+ id: 'resource-cpu',+ resourceId: pulseVM.id,+ metadata: { systemAlert: false },+ });+ const [item] = buildAlertHistoryItems({+ activeAlerts: { [alert.id]: alert },+ alertHistory: [],+ getResource: () => pulseVM,+ allResources: [pulseVM],+ });+ expect(item.resourceType).toBe('VM');+ expect(item.resourceId).toBe(pulseVM.id);+ expect(item.systemAlert).not.toBe(true);+ });+});