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
Add infrastructure-aware incident synthesis
Pulse Testcaa2f77d2331
diff --git a/docs/release-control/v6/internal/SERVICE_ASSURANCE_PLAN.md b/docs/release-control/v6/internal/SERVICE_ASSURANCE_PLAN.mdindex 99b4d85034..507cd9f049 100644--- a/docs/release-control/v6/internal/SERVICE_ASSURANCE_PLAN.md+++ b/docs/release-control/v6/internal/SERVICE_ASSURANCE_PLAN.md@@ -1,7 +1,7 @@# Infrastructure-Aware Service Assurance PlanLast updated: 2026-08-30-Status: ACCEPTED — SLICES A, B, C, AND D IMPLEMENTED+Status: ACCEPTED — SLICES A, B, C, D, AND E IMPLEMENTEDGovernance surfaces:- `status.json.coverage_gaps.infrastructure-aware-service-assurance`@@ -371,6 +371,23 @@ Exit conditions:- unsupported causality is labeled as an observation set, not a root cause;- recovery order and partial recovery remain visible.+Implementation record (2026-08-30): Slice E is delivered through the canonical+alert correlation seam. The alert manager classifies current detector evidence+as runtime, network path, application response, certificate, dependency, or+evidence-coverage failure; traverses only active canonical resource+relationships; and groups supported downstream symptoms beneath one primary+alert without merging detector identity, acknowledgement, history, or recovery.+Each group carries a bounded list of affected resources, observation times, and+evidence IDs. Contradictory resource health, weak relationship confidence, or+unsupported timing downgrades the result to a visible observation set rather+than a causal claim. Supported secondary symptoms stay visible and expandable+but use the primary alert's notification delivery, while observation sets keep+independent delivery. When the primary recovers first, remaining symptoms+immediately return to standalone presentation. The Alerts overview exposes the+classification, inference reason, affected count, and reviewable observation+set at desktop and narrow widths. Slices F through H remain ordered future+work.+### Slice F: Unified Timeline and Patrol InvestigationDeliver:diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 64eeda8862..b74df341b1 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -263,6 +263,7 @@ default construction path still restores.3. `internal/alerts/canonical_metric.go`4. `internal/alerts/canonical_lifecycle.go`5. `internal/alerts/unified_incidents.go`+5a. `internal/alerts/incident_synthesis.go`6. `frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx`7. `frontend-modern/src/utils/alertOverviewPresentation.ts`8. `frontend-modern/src/utils/alertResourceTablePresentation.ts`@@ -2442,3 +2443,42 @@ optional. `internal/alerts/correlation_test.go`,`internal/monitoring/alert_correlation_test.go`, and`frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx`pin lifecycle independence, fail-open identity, and client grouping.++### Infrastructure incident synthesis is deterministic and evidence preserving++The same optional alert `correlation` boundary also admits the+`infrastructure-incident` kind. It adds one of six typed failure classes+(`runtime`, `network-path`, `application-response`, `certificate`,+`dependency`, or `evidence-coverage`), an inference state+(`supported-cause` or `observation-set`), the primary alert and resource IDs,+sorted affected resource IDs, and a bounded observation list carrying alert,+resource, severity, observation time, and evidence IDs. It never copies+provider response bodies, credentials, arbitrary metadata, or error payloads.++`internal/alerts/incident_synthesis.go` derives this context from the complete+post-recovery active detector set plus active canonical relationships from+`ResourceRelationshipsWithCanonicalParent`. It may traverse at most eight+dependency edges and records at most 100 observations. Exact relationship+direction, confidence of at least 0.8, a current primary failure, and bounded+event ordering are required for `supported-cause`. Healthy or disagreeing+primary resource state, weaker topology, late timing, cycles, or incomplete+support must remain an `observation-set`. Name similarity, resource-ID prefix+truncation, message parsing, and coincident timestamps remain forbidden causal+evidence.++Every grouped alert still owns its canonical spec, acknowledgement, history,+timeline, evidence, and recovery. Synthesis is recomputed on each unified+incident reconciliation and clears stale synthesized links, so primary-first+recovery leaves the still-failing symptom visible as standalone immediately.+Existing `shared-system` correlations remain authoritative and are not+overwritten. Resource maintenance and monitoring intent continue through the+canonical resource-policy and intent gates before synthesis; no group-local+mute or maintenance state is allowed.++Only a supporting member of a `supported-cause` group suppresses duplicate+notification delivery, with the typed `correlated_primary` reason and primary+alert ID in the event log. The primary remains the one delivery owner.+`observation-set` members continue to notify independently because Pulse has+not established causality. `incident_synthesis_test.go` pins classification,+contradiction downgrade, bounded evidence, duplicate-delivery suppression, and+partial-recovery behavior.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex a40997736c..65aa92b2a6 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -4623,6 +4623,19 @@ by alert identifier and computed in one manager pass. No active alerts returns`[]`, never `null`. This bulk form is the list-surface contract; clients mustnot replace it with one request per alert, and an unavailable diagnosis readmust not change the independently sourced active-alert projection.+The active-alert and delivery-diagnosis contracts also expose deterministic+infrastructure incident synthesis additively. An alert correlation may be+`shared-system` or `infrastructure-incident`; the latter carries a typed failure+class, `supported-cause` or `observation-set` inference, primary identity,+affected resource IDs, and bounded observation/evidence references. Clients+must keep every returned alert independently addressable and must not infer+causality when the backend returns `observation-set`. A supported secondary+symptom reports delivery reason `correlated_primary`; it remains an active+alert even though the primary owns notification delivery. Older clients remain+compatible because the correlation object and its synthesis fields are+optional. `frontend-modern/src/types/api.ts`,+`internal/alerts/incident_synthesis_test.go`, and the alert overview tests pin+the wire vocabulary and independent detector presentation.`GET /api/alerts/events` is the read-only API projection of the additive alertevent log and also requires `monitoring:read`. Optional `alertIdentifier`,comma/repeated `type`, RFC 3339 `since`, and positive `limit` filters narrow adiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 97fa8d5dde..770324a27c 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -6913,6 +6913,24 @@ primitives, and introduce no parallel group component. Localization andpresentation proofs live in `frontend-modern/src/i18n/__tests__/i18n.test.ts`and `frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts`.+Infrastructure synthesis reuses that alert group and disclosure interaction+rather than introducing an incident dashboard beside Alerts. A backend-declared+`infrastructure-incident` group renders a compact summary immediately above its+primary alert, labels the failure layer and whether the backend established a+supported cause or only a related observation set, and exposes the backend+reason, affected count, observation times, and bounded evidence IDs inside a+native details disclosure. The existing linked-signal control expands every+supporting detector card, so the operator can compare timing and challenge the+inference without losing alert-level acknowledgement, snooze, timeline,+monitoring-policy, or Patrol actions.++The summary must not derive relationships, choose a root cause, hide+contradictory observations, or render an observation set as causal. Failure+class and synthesis labels route through the shared English, German, and+Spanish catalogs. `AlertIncidentSynthesisSummary.test.tsx`,+`useAlertOverviewState.test.tsx`, and `i18n.test.ts` pin inspectability,+uncertainty wording, and additive group behavior at the frontend boundary.+### Mobile destinations are links and update evidence stays explicitFixed mobile destinations and menu destinations that navigate are anchors withdiff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex 9a26e23e14..108ff17700 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -2378,6 +2378,7 @@"test_prefixes": [],"exact_files": ["internal/alerts/canonical_stateful_test.go",+ "internal/alerts/incident_synthesis_test.go","internal/alerts/intent_policy_test.go","internal/alerts/migration_characterization_test.go","internal/alerts/operational_contract_test.go",@@ -2428,6 +2429,7 @@"frontend-modern/src/components/Alerts/Thresholds/sections/__tests__/CollapsibleSection.test.tsx","frontend-modern/src/components/Alerts/WebhookConfig.test.tsx","frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsx",+ "frontend-modern/src/features/alerts/__tests__/AlertIncidentSynthesisSummary.test.tsx","frontend-modern/src/features/alerts/__tests__/AlertIntentPolicyPanel.test.tsx","frontend-modern/src/features/alerts/__tests__/alertsConfigurationModel.test.ts","frontend-modern/src/features/alerts/__tests__/helpers.test.ts",@@ -2438,6 +2440,7 @@"frontend-modern/src/features/alerts/__tests__/useAlertDestinationsState.test.tsx","frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx","frontend-modern/src/features/alerts/__tests__/useAlertOverridesState.test.tsx",+ "frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx","frontend-modern/src/features/alerts/AlertDeliveryHealthCard.test.tsx","frontend-modern/src/features/alerts/identity.test.ts","frontend-modern/src/features/alerts/thresholds/__tests__/helpers.test.ts",@@ -2623,6 +2626,7 @@"internal/alerts/history_projection_parity_test.go","internal/alerts/history_test.go","internal/alerts/host_unraid_lifecycle_test.go",+ "internal/alerts/incident_synthesis_test.go","internal/alerts/intent_policy_test.go","internal/alerts/operational_contract_test.go","internal/alerts/reducer/ack_test.go",diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.mdindex de88343ae9..e242253f2b 100644--- a/docs/release-control/v6/internal/subsystems/security-privacy.md+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md@@ -1346,6 +1346,15 @@ Patrol context must not retain or export customer network names, addresses,agent identity, or location labels. Durable categorical history remains keyedonly by the logical target and its aggregate conclusion; location identity isnot a new telemetry, history, or customer-identity dimension.+Infrastructure incident synthesis remains inside that same boundary. Its alert+correlation envelope may retain only canonical alert/resource IDs, typed+failure class and inference, severity, observation time, and existing evidence+IDs. It must not copy probe addresses, observation-location names, response or+request bodies, headers, credentials, raw provider metadata, or unbounded error+text into alerts, event logs, frontend catalogs, telemetry, or Patrol context.+Localized synthesis labels are product copy only and must not change API token+names, privacy disclosures, authentication terminology, or non-translatable+security identifiers.That same outbound usage telemetry floor now also permits content-free updatefunnel counters derived from local update history inside the same rotating30-day telemetry window: update attempts, successful updates, failed ordiff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.jsonindex 66f7f36318..e07b4ef276 100644--- a/frontend-modern/browser-verification.json+++ b/frontend-modern/browser-verification.json@@ -1,29 +1,30 @@{"version": 1,- "base_sha": "e094a55b4500d2a10b6ab44b350c2fffcc55e73d",- "verified_at": "2026-08-30T20:37:10Z",+ "base_sha": "47c1cee895fea1c395871acb307acbf3711cb4d5",+ "verified_at": "2026-08-30T21:19:54Z","result": "passed","changed_paths": [- "frontend-modern/src/api/availabilityTargets.ts",- "frontend-modern/src/components/Infrastructure/AvailabilityProbeStatusCard.tsx",- "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx",- "frontend-modern/src/components/Settings/availabilitySettingsModel.ts",- "frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx",- "frontend-modern/src/types/resource.ts",- "frontend-modern/src/utils/availabilityProbeAgents.ts"+ "frontend-modern/src/features/alerts/AlertIncidentSynthesisSummary.tsx",+ "frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx",+ "frontend-modern/src/features/alerts/incidentSynthesisPresentation.ts",+ "frontend-modern/src/features/alerts/useAlertOverviewState.ts",+ "frontend-modern/src/i18n/messages.de.ts",+ "frontend-modern/src/i18n/messages.es.ts",+ "frontend-modern/src/i18n/messages.ts",+ "frontend-modern/src/types/api.ts"],"content_sha256": {- "frontend-modern/src/api/availabilityTargets.ts": "0a20277a8c453b753e8c09f7250722670211a33bcae2addad7d19502f921f365",- "frontend-modern/src/components/Infrastructure/AvailabilityProbeStatusCard.tsx": "ec13f364ee9c55f6859c448797fed427255999723524ff0f51cb54cc9f864ea5",- "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx": "622e0c7ad72c4f313c8d971295662e6549d9f13c5fbd788d3cc8803c827af176",- "frontend-modern/src/components/Settings/availabilitySettingsModel.ts": "cd03ed43bca379c8359c11c67f235d49a4a1c6b905c987a4ce404ce59443bbf6",- "frontend-modern/src/features/standalone/AvailabilityChecksTable.tsx": "3c775ad5b08023f9a2814a9dc939992db363a7e5113a351d4fb65ad0946f0d97",- "frontend-modern/src/types/resource.ts": "a4e87ae08ec69349122075ca422ced08a56e1f14294088488198c5ff8af25dba",- "frontend-modern/src/utils/availabilityProbeAgents.ts": "7f92c5fc5012bdbb322825b4a03f26fb5dc6d20d260cda8b2c2e86b66283b005"+ "frontend-modern/src/features/alerts/AlertIncidentSynthesisSummary.tsx": "4c407221597fbe5bd39853d0cc4f35f62955e5e5354d5f520328bd61593f2f0a",+ "frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx": "d313bc7c99659a875bf474af48fbfc46e825e69fadca4787adf80c3d1e4d9ccc",+ "frontend-modern/src/features/alerts/incidentSynthesisPresentation.ts": "db413b54911aadb73a300b6460260a7c6dc2ce245375a0323cb6e0244f96f3e5",+ "frontend-modern/src/features/alerts/useAlertOverviewState.ts": "338aecd07546264d19e0db9a29a9c01ea337a416f316a3a4d24383d4eb9ab22e",+ "frontend-modern/src/i18n/messages.de.ts": "8240c64256088196a224939438b510aecbf55372639b5db4182af5becde4df59",+ "frontend-modern/src/i18n/messages.es.ts": "a932a856c2b4d83efe79c50c96e597767ba4a08c2e1252bdfca29a2e89b87875",+ "frontend-modern/src/i18n/messages.ts": "43a757e00eaa7879c400895c9c59a930e31513dbf03e0ae6d60f7e72a6ad9962",+ "frontend-modern/src/types/api.ts": "f6f313ff304c6d9eaf72fe3225cc7e1615e9f989c44862080ccdcbe267bb8cec"},"routes": [- "/standalone/availability",- "/settings/monitoring/availability?add=target&targetKind=service"+ "/alerts/overview"],"viewports": [{@@ -36,15 +37,17 @@}],"states": [- "multi-location target editor with the local Pulse path and connected-agent paths, including the Community-tier remote-path entitlement boundary",- "degraded service with one reachable and one unreachable observation path, preserved as Paths disagree with 2/2 reporting",- "expanded resource evidence showing per-path state, latency, checked time, freshness, aggregate degraded state, and no universal outage",- "desktop and narrow layouts with settled data, dialog bounds, responsive navigation, and no page or dialog horizontal overflow"+ "settled Alerts overview backed by the local mock runtime and a deterministic supported-cause Alert contract fixture",+ "supported infrastructure cause summary with runtime classification, affected-resource count, and bounded observation count",+ "expanded synthesis evidence with resource names, typed failure classes, observation times, and long evidence identifiers",+ "expanded linked signal cards beneath the declared primary alert",+ "desktop and narrow layouts with no horizontal overflow or clipped alert actions"],"interactions": [- "opened the add service/device check flow and inspected the bounded observation-location selector without saving a mock target",- "opened the Frontend Swarm service resource details from Availability checks and expanded the multi-location evidence",- "confirmed the local path reports 9 ms while edge-london reports Unreachable and the aggregate remains Degraded",- "repeated the final route, state, clipping, and overflow checks at 1280x800 and 390x844 after rebasing onto the current main base"+ "opened the Alerts overview after the local backend and WebSocket stream reported connected",+ "expanded Review synthesis evidence and inspected both independent detector observations",+ "expanded the linked signal group and confirmed the supporting alert retained its own actions and lifecycle card",+ "repeated the expanded evidence and linked-signal checks at 1280x800 and 390x844",+ "removed the temporary browser-only contract fixture and retained only the production synthesis implementation"]}diff --git a/frontend-modern/src/features/alerts/AlertIncidentSynthesisSummary.tsx b/frontend-modern/src/features/alerts/AlertIncidentSynthesisSummary.tsxnew file mode 100644index 0000000000..151b7057c3--- /dev/null+++ b/frontend-modern/src/features/alerts/AlertIncidentSynthesisSummary.tsx@@ -0,0 +1,58 @@+import { For, Show } from 'solid-js';++import type { Alert } from '@/types/api';+import {+ getAlertFailureClassLabel,+ getAlertIncidentSynthesisPresentation,+} from './incidentSynthesisPresentation';++interface AlertIncidentSynthesisSummaryProps {+ alert: Alert;+}++export function AlertIncidentSynthesisSummary(props: AlertIncidentSynthesisSummaryProps) {+ const correlation = () => props.alert.correlation;+ const presentation = () =>+ correlation() ? getAlertIncidentSynthesisPresentation(correlation()!) : null;++ return (+ <Show when={correlation()?.kind === 'infrastructure-incident' && presentation()}>+ {(value) => (+ <section class={value().panelClass} data-testid="incident-synthesis-summary">+ <div class="flex flex-wrap items-center gap-2">+ <h3 class="text-sm font-semibold text-base-content">{value().title}</h3>+ <span class={value().badgeClass}>{value().badge}</span>+ </div>+ <p class="mt-1 text-sm text-base-content/80">{correlation()!.reason}</p>+ <p class="mt-1 text-xs text-muted">{value().counts}</p>+ <details class="mt-2">+ <summary class="cursor-pointer text-xs font-medium text-blue-700 dark:text-blue-300">+ {value().review}+ </summary>+ <div class="mt-2 space-y-2 border-l-2 border-border pl-3">+ <For each={correlation()!.observations ?? []}>+ {(observation) => (+ <div class="text-xs text-base-content/80">+ <div class="font-medium text-base-content">+ {observation.resourceName || observation.resourceId}+ </div>+ <div>+ {getAlertFailureClassLabel(observation.failureClass)} ·{' '}+ {new Date(observation.observedAt).toLocaleString()}+ </div>+ <Show when={(observation.evidenceIds?.length ?? 0) > 0}>+ <div class="font-mono text-[11px] text-muted break-all">+ {observation.evidenceIds!.join(', ')}+ </div>+ </Show>+ </div>+ )}+ </For>+ <p class="text-xs text-muted">{value().challenge}</p>+ </div>+ </details>+ </section>+ )}+ </Show>+ );+}diff --git a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsxindex 9adaefa300..7e3782d075 100644--- a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx+++ b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx@@ -16,6 +16,7 @@ import {import { AlertOverviewAlertCard } from './AlertOverviewAlertCard';import { useAlertGroupExpansion } from './useAlertGroupExpansion';+import { AlertIncidentSynthesisSummary } from './AlertIncidentSynthesisSummary';import type { AlertIncidentTimelineState } from './useAlertIncidentTimelineState';import type { AlertOverviewState } from './useAlertOverviewState';@@ -129,6 +130,7 @@ export function AlertOverviewActiveAlertsSection(props: AlertOverviewActiveAlert>{(group) => (<div>+ <AlertIncidentSynthesisSummary alert={group.primary} /><AlertOverviewAlertCardalert={group.primary}state={props.state}diff --git a/frontend-modern/src/features/alerts/__tests__/AlertIncidentSynthesisSummary.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertIncidentSynthesisSummary.test.tsxnew file mode 100644index 0000000000..d265f5af8e--- /dev/null+++ b/frontend-modern/src/features/alerts/__tests__/AlertIncidentSynthesisSummary.test.tsx@@ -0,0 +1,77 @@+import { fireEvent, render, screen } from '@solidjs/testing-library';+import { describe, expect, it } from 'vitest';++import type { Alert } from '@/types/api';+import { AlertIncidentSynthesisSummary } from '../AlertIncidentSynthesisSummary';++function makeAlert(inference: 'supported-cause' | 'observation-set'): Alert {+ return {+ id: 'host-offline',+ type: 'offline',+ level: 'critical',+ resourceId: 'agent:edge-1',+ resourceName: 'Edge host',+ node: '',+ instance: '',+ message: 'Edge host is offline',+ value: 0,+ threshold: 0,+ startTime: '2026-08-30T18:00:00Z',+ acknowledged: false,+ correlation: {+ key: 'infrastructure:host-offline',+ kind: 'infrastructure-incident',+ role: 'primary',+ reason:+ inference === 'supported-cause'+ ? 'Runtime failure on Edge host is connected to one delivery symptom.'+ : 'The observations share context, but causality is not established.',+ failureClass: 'runtime',+ inference,+ primaryAlertId: 'host-offline',+ primaryResourceId: 'agent:edge-1',+ affectedResourceIds: ['availability:checkout'],+ observations: [+ {+ alertId: 'host-offline',+ resourceId: 'agent:edge-1',+ resourceName: 'Edge host',+ failureClass: 'runtime',+ level: 'critical',+ observedAt: '2026-08-30T18:01:00Z',+ },+ {+ alertId: 'checkout-unreachable',+ resourceId: 'availability:checkout',+ resourceName: 'Checkout',+ failureClass: 'network-path',+ level: 'critical',+ observedAt: '2026-08-30T18:01:30Z',+ evidenceIds: ['evidence_checkout'],+ },+ ],+ },+ };+}++describe('AlertIncidentSynthesisSummary', () => {+ it('shows the supported cause and lets the operator inspect every observation', async () => {+ render(() => <AlertIncidentSynthesisSummary alert={makeAlert('supported-cause')} />);++ expect(screen.getByText('Supported infrastructure cause')).toBeInTheDocument();+ expect(screen.getByText('1 affected resources · 2 observations')).toBeInTheDocument();+ await fireEvent.click(screen.getByText('Review synthesis evidence'));+ expect(screen.getByText('Checkout')).toBeInTheDocument();+ expect(screen.getByText('evidence_checkout')).toBeInTheDocument();+ expect(+ screen.getByText(/compare its timing before accepting this cause/i),+ ).toBeInTheDocument();+ });++ it('labels contradictory correlation as an observation set without claiming root cause', () => {+ render(() => <AlertIncidentSynthesisSummary alert={makeAlert('observation-set')} />);++ expect(screen.getByText('Related observation set')).toBeInTheDocument();+ expect(screen.getByText(/causality is not established/i)).toBeInTheDocument();+ });+});diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsxindex 3107a06b81..edc4f45695 100644--- a/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx+++ b/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx@@ -205,6 +205,53 @@ describe('useAlertOverviewState', () => {]);});+ it('groups explicit infrastructure synthesis without hiding the supporting detector', () => {+ const startTime = new Date(Date.now() - 60_000).toISOString();+ const root = {+ ...makeAlert('root', startTime),+ resourceId: 'agent:edge-1',+ correlation: {+ key: 'infrastructure:root',+ kind: 'infrastructure-incident' as const,+ role: 'primary' as const,+ reason: 'Supported by canonical relationships.',+ failureClass: 'runtime' as const,+ inference: 'supported-cause' as const,+ },+ };+ const symptom = {+ ...makeAlert('symptom', startTime),+ resourceId: 'availability:checkout',+ correlation: {+ key: 'infrastructure:root',+ kind: 'infrastructure-incident' as const,+ role: 'supporting' as const,+ reason: 'Grouped beneath Edge host.',+ failureClass: 'network-path' as const,+ inference: 'supported-cause' as const,+ },+ };+ const [activeAlerts] = createSignal<Record<string, Alert>>({ root, symptom });++ const { result } = renderHook(() =>+ useAlertOverviewState({+ activeAlerts,+ overrides: () => [],+ showAcknowledged: () => true,+ updateAlert: vi.fn(),+ }),+ );++ expect(result.groupedAlerts()).toEqual([+ expect.objectContaining({+ key: 'correlation:infrastructure-incident:infrastructure:root',+ primary: root,+ related: [symptom],+ correlated: true,+ }),+ ]);+ });+it('does not infer correlation by truncating resource paths', () => {const startTime = new Date(Date.now() - 60_000).toISOString();const first = { ...makeAlert('first', startTime), resourceId: 'host/one/disk:sda' };diff --git a/frontend-modern/src/features/alerts/incidentSynthesisPresentation.ts b/frontend-modern/src/features/alerts/incidentSynthesisPresentation.tsnew file mode 100644index 0000000000..a300928b87--- /dev/null+++ b/frontend-modern/src/features/alerts/incidentSynthesisPresentation.ts@@ -0,0 +1,50 @@+import { t } from '@/i18n';+import type { AlertCorrelation, AlertFailureClass } from '@/types/api';++export function getAlertFailureClassLabel(failureClass?: AlertFailureClass): string {+ switch (failureClass) {+ case 'runtime':+ return t('alerts.overview.synthesis.failure.runtime');+ case 'network-path':+ return t('alerts.overview.synthesis.failure.networkPath');+ case 'application-response':+ return t('alerts.overview.synthesis.failure.applicationResponse');+ case 'certificate':+ return t('alerts.overview.synthesis.failure.certificate');+ case 'evidence-coverage':+ return t('alerts.overview.synthesis.failure.evidenceCoverage');+ default:+ return t('alerts.overview.synthesis.failure.dependency');+ }+}++export function getAlertIncidentSynthesisPresentation(correlation: AlertCorrelation) {+ const supported = correlation.inference === 'supported-cause';+ const affectedCount = correlation.affectedResourceIds?.length ?? 0;+ const observationCount = correlation.observations?.length ?? 0;+ return {+ supported,+ title: t(+ supported+ ? 'alerts.overview.synthesis.title.supported'+ : 'alerts.overview.synthesis.title.observationSet',+ ),+ badge: getAlertFailureClassLabel(correlation.failureClass),+ badgeClass: supported+ ? 'rounded-full bg-red-100 px-2 py-0.5 text-xs font-medium text-red-700 dark:bg-red-950/60 dark:text-red-300'+ : 'rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700 dark:bg-amber-950/60 dark:text-amber-300',+ panelClass: supported+ ? 'mb-2 rounded-lg border border-red-200 bg-red-50/70 p-3 dark:border-red-900/70 dark:bg-red-950/20'+ : 'mb-2 rounded-lg border border-amber-200 bg-amber-50/70 p-3 dark:border-amber-900/70 dark:bg-amber-950/20',+ counts: t('alerts.overview.synthesis.counts', {+ affected: affectedCount,+ observations: observationCount,+ }),+ review: t('alerts.overview.synthesis.review'),+ challenge: t(+ supported+ ? 'alerts.overview.synthesis.challenge.supported'+ : 'alerts.overview.synthesis.challenge.observationSet',+ ),+ } as const;+}diff --git a/frontend-modern/src/features/alerts/useAlertOverviewState.ts b/frontend-modern/src/features/alerts/useAlertOverviewState.tsindex 13499fa00d..650a920634 100644--- a/frontend-modern/src/features/alerts/useAlertOverviewState.ts+++ b/frontend-modern/src/features/alerts/useAlertOverviewState.ts@@ -16,7 +16,10 @@ export interface AlertGroup {export function computeAlertGroupKey(alert: Alert): string {const correlation = alert.correlation;- if (correlation?.kind === 'shared-system' && correlation.key.trim() !== '') {+ if (+ (correlation?.kind === 'shared-system' || correlation?.kind === 'infrastructure-incident') &&+ correlation.key.trim() !== ''+ ) {return `correlation:${correlation.kind}:${correlation.key.trim()}`;}const resourceId = alert.resourceId?.trim();diff --git a/frontend-modern/src/i18n/__tests__/i18n.test.ts b/frontend-modern/src/i18n/__tests__/i18n.test.tsindex 5e110813e3..c0985fd210 100644--- a/frontend-modern/src/i18n/__tests__/i18n.test.ts+++ b/frontend-modern/src/i18n/__tests__/i18n.test.ts@@ -124,6 +124,10 @@ describe('i18n foundation', () => {for (const locale of SUPPORTED_LOCALES) {expect(t('alerts.overview.group.linkedSignals', { count: 2 }, locale)).toBeTruthy();expect(t('alerts.overview.group.acknowledge', { count: 3 }, locale)).toBeTruthy();+ expect(t('alerts.overview.synthesis.title.supported', undefined, locale)).toBeTruthy();+ expect(t('alerts.overview.synthesis.title.observationSet', undefined, locale)).toBeTruthy();+ expect(t('alerts.overview.synthesis.failure.applicationResponse', undefined, locale)).toBeTruthy();+ expect(t('alerts.overview.synthesis.review', undefined, locale)).toBeTruthy();}});diff --git a/frontend-modern/src/i18n/messages.de.ts b/frontend-modern/src/i18n/messages.de.tsindex 0193b0ed14..3cb03f8aab 100644--- a/frontend-modern/src/i18n/messages.de.ts+++ b/frontend-modern/src/i18n/messages.de.ts@@ -74,6 +74,20 @@ export const DE_MESSAGE_OVERRIDES = {'alerts.overview.group.linkedSignal': '+{count} verknuepftes Signal','alerts.overview.group.linkedSignals': '+{count} verknuepfte Signale','alerts.overview.group.related': '+{count} zugehoerig',+ 'alerts.overview.synthesis.title.supported': 'Gestuetzte Infrastrukturursache',+ 'alerts.overview.synthesis.title.observationSet': 'Zusammenhaengende Beobachtungen',+ 'alerts.overview.synthesis.failure.runtime': 'Laufzeit',+ 'alerts.overview.synthesis.failure.networkPath': 'Netzwerkpfad',+ 'alerts.overview.synthesis.failure.applicationResponse': 'Anwendungsantwort',+ 'alerts.overview.synthesis.failure.certificate': 'Zertifikat',+ 'alerts.overview.synthesis.failure.dependency': 'Abhaengigkeit',+ 'alerts.overview.synthesis.failure.evidenceCoverage': 'Evidenzabdeckung',+ 'alerts.overview.synthesis.counts': '{affected} betroffene Ressourcen · {observations} Beobachtungen',+ 'alerts.overview.synthesis.review': 'Synthese-Evidenz pruefen',+ 'alerts.overview.synthesis.challenge.supported':+ 'Alle verknuepften Signale unten oeffnen und ihre Zeitpunkte vergleichen, bevor diese Ursache akzeptiert wird.',+ 'alerts.overview.synthesis.challenge.observationSet':+ 'Diese Beobachtungen haengen zusammen, aber Pulse hat keine Grundursache festgestellt.','alerts.overview.acknowledgedBadge': 'Bestaetigt','alerts.overview.empty.description':'Warnmeldungen erscheinen hier, wenn Schwellwerte ueberschritten werden',diff --git a/frontend-modern/src/i18n/messages.es.ts b/frontend-modern/src/i18n/messages.es.tsindex e2fa409a7f..eec662653e 100644--- a/frontend-modern/src/i18n/messages.es.ts+++ b/frontend-modern/src/i18n/messages.es.ts@@ -73,6 +73,20 @@ export const ES_MESSAGE_OVERRIDES = {'alerts.overview.group.linkedSignal': '+{count} senal vinculada','alerts.overview.group.linkedSignals': '+{count} senales vinculadas','alerts.overview.group.related': '+{count} relacionadas',+ 'alerts.overview.synthesis.title.supported': 'Causa de infraestructura respaldada',+ 'alerts.overview.synthesis.title.observationSet': 'Conjunto de observaciones relacionadas',+ 'alerts.overview.synthesis.failure.runtime': 'Ejecucion',+ 'alerts.overview.synthesis.failure.networkPath': 'Ruta de red',+ 'alerts.overview.synthesis.failure.applicationResponse': 'Respuesta de aplicacion',+ 'alerts.overview.synthesis.failure.certificate': 'Certificado',+ 'alerts.overview.synthesis.failure.dependency': 'Dependencia',+ 'alerts.overview.synthesis.failure.evidenceCoverage': 'Cobertura de evidencia',+ 'alerts.overview.synthesis.counts': '{affected} recursos afectados · {observations} observaciones',+ 'alerts.overview.synthesis.review': 'Revisar la evidencia de la sintesis',+ 'alerts.overview.synthesis.challenge.supported':+ 'Expande cada senal vinculada y compara su tiempo antes de aceptar esta causa.',+ 'alerts.overview.synthesis.challenge.observationSet':+ 'Estas observaciones estan relacionadas, pero Pulse no ha establecido una causa raiz.','alerts.overview.acknowledgedBadge': 'Reconocida','alerts.overview.empty.description': 'Las alertas apareceran aqui cuando se superen los umbrales','alerts.overview.empty.title': 'No hay alertas activas',diff --git a/frontend-modern/src/i18n/messages.ts b/frontend-modern/src/i18n/messages.tsindex bbc5f9541f..fb414e7fe4 100644--- a/frontend-modern/src/i18n/messages.ts+++ b/frontend-modern/src/i18n/messages.ts@@ -166,6 +166,20 @@ export const EN_MESSAGES = {'alerts.overview.group.linkedSignal': '+{count} linked signal','alerts.overview.group.linkedSignals': '+{count} linked signals','alerts.overview.group.related': '+{count} related',+ 'alerts.overview.synthesis.title.supported': 'Supported infrastructure cause',+ 'alerts.overview.synthesis.title.observationSet': 'Related observation set',+ 'alerts.overview.synthesis.failure.runtime': 'Runtime',+ 'alerts.overview.synthesis.failure.networkPath': 'Network path',+ 'alerts.overview.synthesis.failure.applicationResponse': 'Application response',+ 'alerts.overview.synthesis.failure.certificate': 'Certificate',+ 'alerts.overview.synthesis.failure.dependency': 'Dependency',+ 'alerts.overview.synthesis.failure.evidenceCoverage': 'Evidence coverage',+ 'alerts.overview.synthesis.counts': '{affected} affected resources · {observations} observations',+ 'alerts.overview.synthesis.review': 'Review synthesis evidence',+ 'alerts.overview.synthesis.challenge.supported':+ 'Expand every linked signal below and compare its timing before accepting this cause.',+ 'alerts.overview.synthesis.challenge.observationSet':+ 'These observations are related, but Pulse has not established a root cause.','alerts.overview.acknowledgedBadge': 'Acknowledged','alerts.overview.empty.description': 'Alerts will appear here when thresholds are exceeded','alerts.overview.empty.title': 'No active alerts',@@ -774,6 +788,18 @@ export const ALERTS_OVERVIEW_MIGRATED_MESSAGE_KEYS = ['alerts.overview.group.linkedSignal','alerts.overview.group.linkedSignals','alerts.overview.group.related',+ 'alerts.overview.synthesis.title.supported',+ 'alerts.overview.synthesis.title.observationSet',+ 'alerts.overview.synthesis.failure.runtime',+ 'alerts.overview.synthesis.failure.networkPath',+ 'alerts.overview.synthesis.failure.applicationResponse',+ 'alerts.overview.synthesis.failure.certificate',+ 'alerts.overview.synthesis.failure.dependency',+ 'alerts.overview.synthesis.failure.evidenceCoverage',+ 'alerts.overview.synthesis.counts',+ 'alerts.overview.synthesis.review',+ 'alerts.overview.synthesis.challenge.supported',+ 'alerts.overview.synthesis.challenge.observationSet','alerts.overview.acknowledgedBadge','alerts.overview.empty.description','alerts.overview.empty.title',diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.tsindex dc0462dfb2..e246d4d81d 100644--- a/frontend-modern/src/types/api.ts+++ b/frontend-modern/src/types/api.ts@@ -1308,11 +1308,35 @@ export interface Stats {}// Alert types+export type AlertFailureClass =+ | 'runtime'+ | 'network-path'+ | 'application-response'+ | 'certificate'+ | 'dependency'+ | 'evidence-coverage';++export interface AlertCorrelationObservation {+ alertId: string;+ resourceId: string;+ resourceName: string;+ failureClass: AlertFailureClass;+ level: 'info' | 'warning' | 'critical';+ observedAt: string;+ evidenceIds?: string[];+}+export interface AlertCorrelation {key: string;- kind: 'shared-system';+ kind: 'shared-system' | 'infrastructure-incident';role: 'primary' | 'supporting';reason: string;+ failureClass?: AlertFailureClass;+ inference?: 'supported-cause' | 'observation-set';+ primaryAlertId?: string;+ primaryResourceId?: string;+ affectedResourceIds?: string[];+ observations?: AlertCorrelationObservation[];}export interface Alert {diff --git a/internal/alerts/incident_synthesis.go b/internal/alerts/incident_synthesis.gonew file mode 100644index 0000000000..3618640c68--- /dev/null+++ b/internal/alerts/incident_synthesis.go@@ -0,0 +1,484 @@+package alerts++import (+ "fmt"+ "sort"+ "strings"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"+)++const (+ maxIncidentSynthesisDepth = 8+ maxIncidentSynthesisObservations = 100+ maxSupportedCauseLead = 5 * time.Minute+)++type incidentSynthesisCandidate struct {+ storageKey string+ alert *Alert+ failureClass AlertFailureClass+ resource unifiedresources.Resource+}++type incidentCauseLink struct {+ primaryKey string+ depth int+ confidence float64+ relation unifiedresources.RelationshipType+ supported bool+}++// applyInfrastructureIncidentSynthesisNoLock derives presentation and+// notification context from the complete live detector set and canonical+// resource relationships. Detector identity and recovery remain independent;+// this method only replaces correlations it previously synthesized. Caller+// holds m.mu.+func (m *Manager) applyInfrastructureIncidentSynthesisNoLock(+ resourcesByID map[string]unifiedresources.Resource,+ desired map[string]*Alert,+) {+ if m == nil {+ return+ }++ candidates := make(map[string]*incidentSynthesisCandidate, len(m.activeAlerts)+len(desired))+ preservedCorrelationKeys := make(map[string]struct{})+ for storageKey, alert := range m.activeAlerts {+ if alert == nil {+ continue+ }+ if alert.Correlation != nil && alert.Correlation.Kind != AlertCorrelationKindInfrastructureIncident {+ preservedCorrelationKeys[storageKey] = struct{}{}+ continue+ }+ if alert.Correlation != nil && alert.Correlation.Kind == AlertCorrelationKindInfrastructureIncident {+ alert.Correlation = nil+ }+ candidates[storageKey] = newIncidentSynthesisCandidate(storageKey, alert, resourcesByID)+ }+ for storageKey, alert := range desired {+ if alert == nil {+ continue+ }+ if _, preserve := preservedCorrelationKeys[storageKey]; preserve {+ continue+ }+ if alert.Correlation != nil && alert.Correlation.Kind != AlertCorrelationKindInfrastructureIncident {+ continue+ }+ if alert.Correlation != nil && alert.Correlation.Kind == AlertCorrelationKindInfrastructureIncident {+ alert.Correlation = nil+ }+ candidates[storageKey] = newIncidentSynthesisCandidate(storageKey, alert, resourcesByID)+ }++ byResource := make(map[string][]*incidentSynthesisCandidate)+ for _, candidate := range candidates {+ resourceID := unifiedresources.CanonicalResourceID(candidate.alert.ResourceID)+ if resourceID == "" {+ continue+ }+ byResource[resourceID] = append(byResource[resourceID], candidate)+ }+ for resourceID := range byResource {+ sort.Slice(byResource[resourceID], func(i, j int) bool {+ return incidentCandidateLess(byResource[resourceID][i], byResource[resourceID][j])+ })+ }++ links := make(map[string]incidentCauseLink)+ for storageKey, candidate := range candidates {+ link, ok := strongestIncidentCause(candidate, resourcesByID, byResource, candidates)+ if ok && link.primaryKey != storageKey {+ links[storageKey] = link+ }+ }++ groups := make(map[string][]string)+ groupSupported := make(map[string]bool)+ for storageKey := range candidates {+ rootKey, supported := incidentSynthesisRoot(storageKey, links)+ if rootKey == storageKey {+ continue+ }+ groups[rootKey] = append(groups[rootKey], storageKey)+ if _, seen := groupSupported[rootKey]; !seen {+ groupSupported[rootKey] = supported+ } else {+ groupSupported[rootKey] = groupSupported[rootKey] && supported+ }+ }++ for primaryKey, supportingKeys := range groups {+ primary := candidates[primaryKey]+ if primary == nil || len(supportingKeys) == 0 {+ continue+ }+ sort.Slice(supportingKeys, func(i, j int) bool {+ return incidentCandidateLess(candidates[supportingKeys[i]], candidates[supportingKeys[j]])+ })+ memberKeys := append([]string{primaryKey}, supportingKeys...)+ observations, affected := incidentSynthesisEvidence(memberKeys, candidates)+ inference := AlertCorrelationInferenceObservationSet+ if groupSupported[primaryKey] && !incidentCauseContradicted(primary) {+ inference = AlertCorrelationInferenceSupportedCause+ }+ groupKey := "infrastructure:" + effectiveAlertID(primary.alert, primary.storageKey)+ primaryReason := fmt.Sprintf(+ "%s on %s is connected by current canonical relationships to %d dependent failure observation(s).",+ failureClassLabel(primary.failureClass),+ incidentCandidateName(primary),+ len(supportingKeys),+ )+ if inference == AlertCorrelationInferenceObservationSet {+ primaryReason = fmt.Sprintf(+ "%s and %d related failure observation(s) share canonical relationship context, but the current evidence does not establish this alert as the cause.",+ incidentCandidateName(primary),+ len(supportingKeys),+ )+ }+ primary.alert.Correlation = &AlertCorrelation{+ Key: groupKey,+ Kind: AlertCorrelationKindInfrastructureIncident,+ Role: AlertCorrelationRolePrimary,+ Reason: primaryReason,+ FailureClass: primary.failureClass,+ Inference: inference,+ PrimaryAlertID: effectiveAlertID(primary.alert, primary.storageKey),+ PrimaryResourceID: primary.alert.ResourceID,+ AffectedResourceIDs: affected,+ Observations: observations,+ }+ for _, supportingKey := range supportingKeys {+ supporting := candidates[supportingKey]+ if supporting == nil {+ continue+ }+ reason := fmt.Sprintf(+ "Grouped beneath %s because a current canonical resource relationship connects this %s observation to the primary failure.",+ incidentCandidateName(primary),+ failureClassLabel(supporting.failureClass),+ )+ if inference == AlertCorrelationInferenceObservationSet {+ reason = fmt.Sprintf(+ "Shown with %s as a related observation; Pulse has not established a causal direction.",+ incidentCandidateName(primary),+ )+ }+ supporting.alert.Correlation = &AlertCorrelation{+ Key: groupKey,+ Kind: AlertCorrelationKindInfrastructureIncident,+ Role: AlertCorrelationRoleSupporting,+ Reason: reason,+ FailureClass: supporting.failureClass,+ Inference: inference,+ PrimaryAlertID: effectiveAlertID(primary.alert, primary.storageKey),+ PrimaryResourceID: primary.alert.ResourceID,+ AffectedResourceIDs: append([]string(nil), affected...),+ Observations: cloneCorrelationObservations(observations),+ }+ }+ }+}++func newIncidentSynthesisCandidate(+ storageKey string,+ alert *Alert,+ resourcesByID map[string]unifiedresources.Resource,+) *incidentSynthesisCandidate {+ resource := resourcesByID[unifiedresources.CanonicalResourceID(alert.ResourceID)]+ return &incidentSynthesisCandidate{+ storageKey: storageKey,+ alert: alert,+ failureClass: classifyIncidentFailure(alert, resource),+ resource: resource,+ }+}++func classifyIncidentFailure(alert *Alert, resource unifiedresources.Resource) AlertFailureClass {+ code := strings.ToLower(alertMetadataString(alert, "incidentCode"))+ alertType := strings.ToLower(strings.TrimSpace(alert.Type))+ if strings.Contains(code, "certificate") || strings.HasPrefix(code, "tls_") {+ return AlertFailureClassCertificate+ }+ if alertType == strings.ToLower(ExternalProbeUnavailableAlertType) ||+ strings.Contains(code, "coverage") || strings.Contains(code, "stale") || strings.Contains(code, "probe_unavailable") {+ return AlertFailureClassEvidenceCoverage+ }+ if code == "availability_unreachable" && resource.Availability != nil {+ availability := resource.Availability+ if strings.EqualFold(availability.AggregateState, "unknown") ||+ (availability.ExpectedLocations > 0 && availability.ReportingLocations < availability.ExpectedLocations) {+ return AlertFailureClassEvidenceCoverage+ }+ if strings.EqualFold(availability.TransportOutcome, "reachable") &&+ availability.ApplicationOutcome != "" &&+ !strings.EqualFold(availability.ApplicationOutcome, "passed") {+ return AlertFailureClassApplicationResponse+ }+ return AlertFailureClassNetworkPath+ }+ if code == "availability_unreachable" {+ return AlertFailureClassNetworkPath+ }+ if alertType == "offline" || alertType == "connectivity" || alertType == "powered-off" ||+ alertType == "docker-host-offline" || alertType == strings.ToLower(connectionDegradedAlertType) ||+ strings.Contains(code, "offline") || strings.Contains(code, "unreachable") {+ return AlertFailureClassRuntime+ }+ return AlertFailureClassDependency+}++func strongestIncidentCause(+ symptom *incidentSynthesisCandidate,+ resourcesByID map[string]unifiedresources.Resource,+ byResource map[string][]*incidentSynthesisCandidate,+ byStorageKey map[string]*incidentSynthesisCandidate,+) (incidentCauseLink, bool) {+ resourceID := unifiedresources.CanonicalResourceID(symptom.alert.ResourceID)+ if resourceID == "" {+ return incidentCauseLink{}, false+ }+ type frontierItem struct {+ resourceID string+ depth int+ confidence float64+ relation unifiedresources.RelationshipType+ }+ frontier := []frontierItem{{resourceID: resourceID, confidence: 1}}+ visited := map[string]struct{}{resourceID: {}}+ var best incidentCauseLink+ found := false+ for len(frontier) > 0 {+ current := frontier[0]+ frontier = frontier[1:]+ if current.depth >= maxIncidentSynthesisDepth {+ continue+ }+ resource, ok := resourcesByID[current.resourceID]+ if !ok {+ continue+ }+ for _, relationship := range unifiedresources.ResourceRelationshipsWithCanonicalParent(resource) {+ if !relationship.Active || unifiedresources.CanonicalResourceID(relationship.SourceID) != current.resourceID {+ continue+ }+ targetID := unifiedresources.CanonicalResourceID(relationship.TargetID)+ if targetID == "" || targetID == resourceID {+ continue+ }+ confidence := current.confidence+ if relationship.Confidence > 0 && relationship.Confidence < confidence {+ confidence = relationship.Confidence+ }+ depth := current.depth + 1+ for _, primary := range byResource[targetID] {+ if !incidentCauseAllowed(symptom, primary, relationship.Type) {+ continue+ }+ supported := confidence >= 0.8 && incidentCauseTimingSupported(symptom.alert, primary.alert)+ link := incidentCauseLink{+ primaryKey: primary.storageKey,+ depth: depth,+ confidence: confidence,+ relation: relationship.Type,+ supported: supported,+ }+ if !found || incidentCauseLinkLess(link, best, primary, byStorageKey[best.primaryKey]) {+ best = link+ found = true+ }+ }+ if _, seen := visited[targetID]; !seen {+ visited[targetID] = struct{}{}+ frontier = append(frontier, frontierItem{resourceID: targetID, depth: depth, confidence: confidence, relation: relationship.Type})+ }+ }+ }+ return best, found+}++func incidentCauseAllowed(symptom, primary *incidentSynthesisCandidate, relation unifiedresources.RelationshipType) bool {+ if symptom == nil || primary == nil || symptom.storageKey == primary.storageKey {+ return false+ }+ switch relation {+ case unifiedresources.RelChecks,+ unifiedresources.RelRunsOn,+ unifiedresources.RelHostedBy,+ unifiedresources.RelOwnedBy,+ unifiedresources.RelMemberOf:+ return primary.failureClass == AlertFailureClassRuntime ||+ primary.failureClass == AlertFailureClassEvidenceCoverage ||+ primary.failureClass == AlertFailureClassDependency+ case unifiedresources.RelDependsOn,+ unifiedresources.RelMountedTo,+ unifiedresources.RelStoresOn,+ unifiedresources.RelProtectedBy,+ unifiedresources.RelAttachedTo,+ unifiedresources.RelExposedBy:+ return primary.failureClass != AlertFailureClassCertificate+ default:+ return false+ }+}++func incidentCauseTimingSupported(symptom, primary *Alert) bool {+ if symptom == nil || primary == nil || symptom.StartTime.IsZero() || primary.StartTime.IsZero() {+ return false+ }+ lead := symptom.StartTime.Sub(primary.StartTime)+ return lead >= 0 && lead <= maxSupportedCauseLead+}++func incidentCauseLinkLess(left, right incidentCauseLink, leftPrimary, rightPrimary *incidentSynthesisCandidate) bool {+ if left.supported != right.supported {+ return left.supported+ }+ if left.depth != right.depth {+ return left.depth < right.depth+ }+ if left.confidence != right.confidence {+ return left.confidence > right.confidence+ }+ if rightPrimary == nil {+ return true+ }+ return incidentCandidateLess(leftPrimary, rightPrimary)+}++func incidentSynthesisRoot(storageKey string, links map[string]incidentCauseLink) (string, bool) {+ current := storageKey+ supported := true+ visited := map[string]struct{}{storageKey: {}}+ for depth := 0; depth < maxIncidentSynthesisDepth; depth++ {+ link, ok := links[current]+ if !ok || link.primaryKey == "" {+ return current, supported+ }+ supported = supported && link.supported+ if _, cycle := visited[link.primaryKey]; cycle {+ return storageKey, false+ }+ visited[link.primaryKey] = struct{}{}+ current = link.primaryKey+ }+ return current, false+}++func incidentCauseContradicted(candidate *incidentSynthesisCandidate) bool {+ if candidate == nil {+ return true+ }+ if candidate.resource.ID != "" && candidate.resource.Status == unifiedresources.StatusOnline {+ return true+ }+ if availability := candidate.resource.Availability; availability != nil {+ if availability.Available || strings.EqualFold(availability.AggregateState, "healthy") || availability.Disagreement {+ return true+ }+ }+ return false+}++func incidentSynthesisEvidence(+ memberKeys []string,+ candidates map[string]*incidentSynthesisCandidate,+) ([]AlertCorrelationObservation, []string) {+ observations := make([]AlertCorrelationObservation, 0, min(len(memberKeys), maxIncidentSynthesisObservations))+ affectedSet := make(map[string]struct{})+ for index, storageKey := range memberKeys {+ candidate := candidates[storageKey]+ if candidate == nil || candidate.alert == nil {+ continue+ }+ if index > 0 {+ if resourceID := unifiedresources.CanonicalResourceID(candidate.alert.ResourceID); resourceID != "" {+ affectedSet[resourceID] = struct{}{}+ }+ }+ if len(observations) >= maxIncidentSynthesisObservations {+ continue+ }+ evidenceIDs := make([]string, 0, len(candidate.alert.Evidence))+ for _, evidence := range candidate.alert.Evidence {+ if id := strings.TrimSpace(evidence.ID); id != "" {+ evidenceIDs = append(evidenceIDs, id)+ }+ }+ sort.Strings(evidenceIDs)+ observedAt := candidate.alert.LastSeen+ if observedAt.IsZero() {+ observedAt = candidate.alert.StartTime+ }+ observations = append(observations, AlertCorrelationObservation{+ AlertID: effectiveAlertID(candidate.alert, candidate.storageKey),+ ResourceID: candidate.alert.ResourceID,+ ResourceName: candidate.alert.ResourceName,+ FailureClass: candidate.failureClass,+ Level: candidate.alert.Level,+ ObservedAt: observedAt,+ EvidenceIDs: evidenceIDs,+ })+ }+ affected := make([]string, 0, len(affectedSet))+ for resourceID := range affectedSet {+ affected = append(affected, resourceID)+ }+ sort.Strings(affected)+ return observations, affected+}++func cloneCorrelationObservations(input []AlertCorrelationObservation) []AlertCorrelationObservation {+ if len(input) == 0 {+ return nil+ }+ output := make([]AlertCorrelationObservation, len(input))+ for index := range input {+ output[index] = input[index]+ output[index].EvidenceIDs = append([]string(nil), input[index].EvidenceIDs...)+ }+ return output+}++func incidentCandidateLess(left, right *incidentSynthesisCandidate) bool {+ if left == nil || right == nil {+ return right != nil+ }+ if left.alert.Level != right.alert.Level {+ return alertSeveritySortRank(*left.alert) > alertSeveritySortRank(*right.alert)+ }+ if !left.alert.StartTime.Equal(right.alert.StartTime) {+ return left.alert.StartTime.Before(right.alert.StartTime)+ }+ return effectiveAlertID(left.alert, left.storageKey) < effectiveAlertID(right.alert, right.storageKey)+}++func incidentCandidateName(candidate *incidentSynthesisCandidate) string {+ if candidate == nil || candidate.alert == nil {+ return "the related resource"+ }+ if name := strings.TrimSpace(candidate.alert.ResourceName); name != "" {+ return name+ }+ return candidate.alert.ResourceID+}++func failureClassLabel(failureClass AlertFailureClass) string {+ switch failureClass {+ case AlertFailureClassRuntime:+ return "Runtime failure"+ case AlertFailureClassNetworkPath:+ return "Network path failure"+ case AlertFailureClassApplicationResponse:+ return "Application response failure"+ case AlertFailureClassCertificate:+ return "Certificate failure"+ case AlertFailureClassEvidenceCoverage:+ return "Evidence coverage failure"+ default:+ return "Dependency failure"+ }+}diff --git a/internal/alerts/incident_synthesis_test.go b/internal/alerts/incident_synthesis_test.gonew file mode 100644index 0000000000..5de5109e83--- /dev/null+++ b/internal/alerts/incident_synthesis_test.go@@ -0,0 +1,284 @@+package alerts++import (+ "testing"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/operationaltrust"+ "github.com/rcourtman/pulse-go-rewrite/internal/storagehealth"+ "github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"+)++func TestInfrastructureIncidentSynthesisGroupsSupportedDeliverySymptoms(t *testing.T) {+ manager := newTestManager(t)+ startedAt := time.Date(2026, 8, 30, 18, 0, 0, 0, time.UTC)+ observedAt := startedAt.Add(time.Minute)+ hostID := "agent:edge-1"+ endpointID := "availability:checkout"+ resources := map[string]unifiedresources.Resource{+ hostID: {+ ID: hostID, Type: unifiedresources.ResourceTypeAgent, Name: "Edge host",+ Status: unifiedresources.StatusOffline,+ },+ endpointID: {+ ID: endpointID, Type: unifiedresources.ResourceTypeNetworkEndpoint, Name: "Checkout",+ Status: unifiedresources.StatusOffline,+ Availability: &unifiedresources.AvailabilityData{+ AggregateState: "unavailable",+ TransportOutcome: "unreachable",+ },+ Relationships: []unifiedresources.ResourceRelationship{{+ SourceID: endpointID, TargetID: hostID, Type: unifiedresources.RelChecks,+ Confidence: 1, Active: true,+ }},+ },+ }+ root := &Alert{+ ID: "host-offline", Type: "offline", Level: AlertLevelCritical,+ ResourceID: hostID, ResourceName: "Edge host", StartTime: startedAt, LastSeen: observedAt,+ }+ symptom := &Alert{+ ID: "checkout-unreachable", Type: "resource-incident", Level: AlertLevelCritical,+ ResourceID: endpointID, ResourceName: "Checkout", StartTime: startedAt.Add(30 * time.Second), LastSeen: observedAt,+ Metadata: map[string]interface{}{"incidentCode": "availability_unreachable"},+ Evidence: []operationaltrust.EvidenceEnvelope{{ID: "evidence_checkout"}},+ }+ desired := map[string]*Alert{"root": root, "symptom": symptom}++ manager.mu.Lock()+ manager.applyInfrastructureIncidentSynthesisNoLock(resources, desired)+ manager.mu.Unlock()++ if root.Correlation == nil || root.Correlation.Role != AlertCorrelationRolePrimary {+ t.Fatalf("root correlation = %+v, want primary", root.Correlation)+ }+ if root.Correlation.Inference != AlertCorrelationInferenceSupportedCause {+ t.Fatalf("inference = %q, want supported cause", root.Correlation.Inference)+ }+ if root.Correlation.FailureClass != AlertFailureClassRuntime {+ t.Fatalf("root failure class = %q, want runtime", root.Correlation.FailureClass)+ }+ if symptom.Correlation == nil || symptom.Correlation.Role != AlertCorrelationRoleSupporting {+ t.Fatalf("symptom correlation = %+v, want supporting", symptom.Correlation)+ }+ if symptom.Correlation.FailureClass != AlertFailureClassNetworkPath {+ t.Fatalf("symptom failure class = %q, want network path", symptom.Correlation.FailureClass)+ }+ if !isSupportedInfrastructureSymptom(symptom) {+ t.Fatal("supported symptom must use the primary alert's notification delivery")+ }+ if len(root.Correlation.Observations) != 2 || root.Correlation.Observations[1].EvidenceIDs[0] != "evidence_checkout" {+ t.Fatalf("observations = %+v, want both detector records and endpoint evidence", root.Correlation.Observations)+ }+}++func TestInfrastructureIncidentSynthesisPreservesContradictionAsObservationSet(t *testing.T) {+ manager := newTestManager(t)+ startedAt := time.Date(2026, 8, 30, 18, 0, 0, 0, time.UTC)+ hostID := "agent:edge-1"+ endpointID := "availability:checkout"+ resources := map[string]unifiedresources.Resource{+ hostID: {ID: hostID, Type: unifiedresources.ResourceTypeAgent, Name: "Edge host", Status: unifiedresources.StatusOnline},+ endpointID: {+ ID: endpointID, Type: unifiedresources.ResourceTypeNetworkEndpoint, Name: "Checkout",+ Status: unifiedresources.StatusOffline,+ Relationships: []unifiedresources.ResourceRelationship{{+ SourceID: endpointID, TargetID: hostID, Type: unifiedresources.RelChecks,+ Confidence: 1, Active: true,+ }},+ },+ }+ root := &Alert{ID: "host-offline", Type: "offline", Level: AlertLevelCritical, ResourceID: hostID, ResourceName: "Edge host", StartTime: startedAt}+ symptom := &Alert{ID: "checkout-unreachable", Type: "resource-incident", Level: AlertLevelCritical, ResourceID: endpointID, ResourceName: "Checkout", StartTime: startedAt, Metadata: map[string]interface{}{"incidentCode": "availability_unreachable"}}++ manager.mu.Lock()+ manager.applyInfrastructureIncidentSynthesisNoLock(resources, map[string]*Alert{"root": root, "symptom": symptom})+ manager.mu.Unlock()++ if root.Correlation == nil || root.Correlation.Inference != AlertCorrelationInferenceObservationSet {+ t.Fatalf("correlation = %+v, want observation set for contradictory healthy root", root.Correlation)+ }+ if isSupportedInfrastructureSymptom(symptom) {+ t.Fatal("an observation set must not suppress an independently notifying symptom")+ }+}++func TestInfrastructureIncidentSynthesisRequiresOrderedBoundedTiming(t *testing.T) {+ manager := newTestManager(t)+ startedAt := time.Date(2026, 8, 30, 18, 0, 0, 0, time.UTC)+ hostID := "agent:edge-1"+ endpointID := "availability:checkout"+ resources := map[string]unifiedresources.Resource{+ hostID: {ID: hostID, Type: unifiedresources.ResourceTypeAgent, Status: unifiedresources.StatusOffline},+ endpointID: {+ ID: endpointID, Type: unifiedresources.ResourceTypeNetworkEndpoint, Status: unifiedresources.StatusOffline,+ Relationships: []unifiedresources.ResourceRelationship{{SourceID: endpointID, TargetID: hostID, Type: unifiedresources.RelChecks, Confidence: 1, Active: true}},+ },+ }+ root := &Alert{ID: "host-offline", Type: "offline", Level: AlertLevelCritical, ResourceID: hostID, StartTime: startedAt}+ symptom := &Alert{ID: "checkout-unreachable", Type: "resource-incident", Level: AlertLevelCritical, ResourceID: endpointID, StartTime: startedAt.Add(maxSupportedCauseLead + time.Second), Metadata: map[string]interface{}{"incidentCode": "availability_unreachable"}}++ manager.mu.Lock()+ manager.applyInfrastructureIncidentSynthesisNoLock(resources, map[string]*Alert{"root": root, "symptom": symptom})+ manager.mu.Unlock()++ if root.Correlation == nil || root.Correlation.Inference != AlertCorrelationInferenceObservationSet {+ t.Fatalf("correlation = %+v, want observation set when the primary is too early", root.Correlation)+ }+ if isSupportedInfrastructureSymptom(symptom) {+ t.Fatal("late timing must not suppress the symptom's notification")+ }+}++func TestInfrastructureIncidentSynthesisPreservesExistingSharedSystemCorrelation(t *testing.T) {+ manager := newTestManager(t)+ startedAt := time.Date(2026, 8, 30, 18, 0, 0, 0, time.UTC)+ hostID := "agent:edge-1"+ endpointID := "availability:checkout"+ shared := &Alert{+ ID: "host-offline", Type: "offline", Level: AlertLevelCritical, ResourceID: hostID, StartTime: startedAt,+ Correlation: &AlertCorrelation{Key: "pve:edge", Kind: AlertCorrelationKindSharedSystem, Role: AlertCorrelationRolePrimary, Reason: "Provider-owned membership."},+ }+ manager.activeAlerts["root"] = shared+ desiredRoot := &Alert{ID: shared.ID, Type: shared.Type, Level: shared.Level, ResourceID: hostID, StartTime: startedAt}+ symptom := &Alert{ID: "checkout-unreachable", Type: "resource-incident", Level: AlertLevelCritical, ResourceID: endpointID, StartTime: startedAt, Metadata: map[string]interface{}{"incidentCode": "availability_unreachable"}}+ resources := map[string]unifiedresources.Resource{+ hostID: {ID: hostID, Type: unifiedresources.ResourceTypeAgent, Status: unifiedresources.StatusOffline},+ endpointID: {+ ID: endpointID, Type: unifiedresources.ResourceTypeNetworkEndpoint, Status: unifiedresources.StatusOffline,+ Relationships: []unifiedresources.ResourceRelationship{{SourceID: endpointID, TargetID: hostID, Type: unifiedresources.RelChecks, Confidence: 1, Active: true}},+ },+ }++ manager.mu.Lock()+ manager.applyInfrastructureIncidentSynthesisNoLock(resources, map[string]*Alert{"root": desiredRoot, "symptom": symptom})+ manager.mu.Unlock()++ if shared.Correlation == nil || shared.Correlation.Kind != AlertCorrelationKindSharedSystem {+ t.Fatalf("shared-system correlation = %+v, want preserved", shared.Correlation)+ }+ if desiredRoot.Correlation != nil || symptom.Correlation != nil {+ t.Fatalf("synthesis must not route through an authoritative shared-system member: root=%+v symptom=%+v", desiredRoot.Correlation, symptom.Correlation)+ }+}++func TestInfrastructureIncidentSynthesisPersistsAcrossReconciliation(t *testing.T) {+ manager := newTestManager(t)+ configureUnifiedEvalManager(t, manager, unifiedEvalBaseConfig())+ startedAt := time.Date(2026, 8, 30, 18, 0, 0, 0, time.UTC)+ hostID := "agent:edge-1"+ endpointID := "availability:checkout"+ resources := []unifiedresources.Resource{+ {+ ID: hostID, Type: unifiedresources.ResourceTypeAgent, Name: "Edge host", Status: unifiedresources.StatusOffline,+ Incidents: []unifiedresources.ResourceIncident{{+ Provider: "agent", NativeID: "edge-1", Code: "agent_offline", Severity: storagehealth.RiskCritical,+ Source: "agent.heartbeat", Summary: "Edge host is offline", StartedAt: startedAt, ConfirmationsRequired: 1, RecoveryConfirmationsRequired: 1,+ }},+ },+ {+ ID: endpointID, Type: unifiedresources.ResourceTypeNetworkEndpoint, Name: "Checkout", Status: unifiedresources.StatusOffline,+ Availability: &unifiedresources.AvailabilityData{AggregateState: "unavailable", TransportOutcome: "unreachable"},+ Relationships: []unifiedresources.ResourceRelationship{{SourceID: endpointID, TargetID: hostID, Type: unifiedresources.RelChecks, Confidence: 1, Active: true}},+ Incidents: []unifiedresources.ResourceIncident{{+ Provider: "availability", NativeID: "checkout", Code: "availability_unreachable", Severity: storagehealth.RiskCritical,+ Source: "availability.probe", Summary: "Checkout is unreachable", StartedAt: startedAt.Add(time.Second), ConfirmationsRequired: 1, RecoveryConfirmationsRequired: 1,+ }},+ },+ }++ for pass := 1; pass <= 2; pass++ {+ manager.SyncUnifiedResourceIncidents(resources)+ active := manager.GetActiveAlerts()+ if len(active) != 2 {+ t.Fatalf("pass %d active alerts = %+v, want two", pass, active)+ }+ roles := map[AlertCorrelationRole]int{}+ for _, alert := range active {+ if alert.Correlation == nil || alert.Correlation.Kind != AlertCorrelationKindInfrastructureIncident {+ t.Fatalf("pass %d alert %q correlation = %+v, want infrastructure synthesis", pass, alert.ID, alert.Correlation)+ }+ roles[alert.Correlation.Role]+++ }+ if roles[AlertCorrelationRolePrimary] != 1 || roles[AlertCorrelationRoleSupporting] != 1 {+ t.Fatalf("pass %d roles = %+v, want one primary and one supporting", pass, roles)+ }+ }+}++func TestInfrastructureIncidentSynthesisShowsPartialRecovery(t *testing.T) {+ manager := newTestManager(t)+ startedAt := time.Date(2026, 8, 30, 18, 0, 0, 0, time.UTC)+ hostID := "agent:edge-1"+ endpointID := "availability:checkout"+ resources := map[string]unifiedresources.Resource{+ hostID: {ID: hostID, Type: unifiedresources.ResourceTypeAgent, Status: unifiedresources.StatusOffline},+ endpointID: {+ ID: endpointID, Type: unifiedresources.ResourceTypeNetworkEndpoint, Status: unifiedresources.StatusOffline,+ Relationships: []unifiedresources.ResourceRelationship{{SourceID: endpointID, TargetID: hostID, Type: unifiedresources.RelChecks, Confidence: 1, Active: true}},+ },+ }+ root := &Alert{ID: "host-offline", Type: "offline", Level: AlertLevelCritical, ResourceID: hostID, StartTime: startedAt}+ symptom := &Alert{ID: "checkout-unreachable", Type: "resource-incident", Level: AlertLevelCritical, ResourceID: endpointID, StartTime: startedAt, Metadata: map[string]interface{}{"incidentCode": "availability_unreachable"}}++ manager.mu.Lock()+ manager.applyInfrastructureIncidentSynthesisNoLock(resources, map[string]*Alert{"root": root, "symptom": symptom})+ if symptom.Correlation == nil {+ manager.mu.Unlock()+ t.Fatal("expected initial grouped symptom")+ }+ manager.applyInfrastructureIncidentSynthesisNoLock(resources, map[string]*Alert{"symptom": symptom})+ manager.mu.Unlock()++ if symptom.Correlation != nil {+ t.Fatalf("symptom correlation = %+v, want standalone active symptom after primary recovery", symptom.Correlation)+ }+}++func TestClassifyIncidentFailureSeparatesApplicationCertificateAndCoverage(t *testing.T) {+ applicationResource := unifiedresources.Resource{Availability: &unifiedresources.AvailabilityData{+ AggregateState: "unavailable", TransportOutcome: "reachable", ApplicationOutcome: "failed",+ }}+ application := &Alert{Type: "resource-incident", Metadata: map[string]interface{}{"incidentCode": "availability_unreachable"}}+ if got := classifyIncidentFailure(application, applicationResource); got != AlertFailureClassApplicationResponse {+ t.Fatalf("application failure class = %q", got)+ }+ certificate := &Alert{Type: "resource-incident", Metadata: map[string]interface{}{"incidentCode": "certificate_expired"}}+ if got := classifyIncidentFailure(certificate, unifiedresources.Resource{}); got != AlertFailureClassCertificate {+ t.Fatalf("certificate failure class = %q", got)+ }+ coverage := &Alert{Type: ExternalProbeUnavailableAlertType}+ if got := classifyIncidentFailure(coverage, unifiedresources.Resource{}); got != AlertFailureClassEvidenceCoverage {+ t.Fatalf("coverage failure class = %q", got)+ }+}++func TestSupportedInfrastructureSymptomUsesPrimaryNotification(t *testing.T) {+ manager := newTestManager(t)+ deliveries := 0+ manager.SetAlertCallback(func(*Alert) { deliveries++ })+ symptom := &Alert{+ ID: "checkout-unreachable", Type: "resource-incident", Level: AlertLevelCritical,+ ResourceID: "availability:checkout", ResourceName: "Checkout",+ Correlation: &AlertCorrelation{+ Key: "infrastructure:host-offline", Kind: AlertCorrelationKindInfrastructureIncident,+ Role: AlertCorrelationRoleSupporting, Reason: "Grouped beneath Edge host.",+ FailureClass: AlertFailureClassNetworkPath, Inference: AlertCorrelationInferenceSupportedCause,+ PrimaryAlertID: "host-offline", PrimaryResourceID: "agent:edge-1",+ },+ }++ if manager.dispatchAlert(symptom, false) {+ t.Fatal("supporting symptom must not dispatch a duplicate notification")+ }+ if deliveries != 0 {+ t.Fatalf("deliveries = %d, want none", deliveries)+ }++ manager.mu.Lock()+ diagnosis := manager.diagnoseActiveAlertLocked(symptom)+ manager.mu.Unlock()+ if diagnosis.Status != AlertDeliveryStatusSuppressed || diagnosis.Reason != AlertDeliveryReasonCorrelatedPrimary {+ t.Fatalf("diagnosis = %+v, want correlated-primary suppression", diagnosis)+ }+}diff --git a/internal/alerts/model.go b/internal/alerts/model.goindex b989c5a5ba..4b6324a2fd 100644--- a/internal/alerts/model.go+++ b/internal/alerts/model.go@@ -10,7 +10,8 @@ import (type AlertCorrelationKind stringconst (- AlertCorrelationKindSharedSystem AlertCorrelationKind = "shared-system"+ AlertCorrelationKindSharedSystem AlertCorrelationKind = "shared-system"+ AlertCorrelationKindInfrastructureIncident AlertCorrelationKind = "infrastructure-incident")type AlertCorrelationRole string@@ -20,14 +21,52 @@ const (AlertCorrelationRoleSupporting AlertCorrelationRole = "supporting")+type AlertFailureClass string++const (+ AlertFailureClassRuntime AlertFailureClass = "runtime"+ AlertFailureClassNetworkPath AlertFailureClass = "network-path"+ AlertFailureClassApplicationResponse AlertFailureClass = "application-response"+ AlertFailureClassCertificate AlertFailureClass = "certificate"+ AlertFailureClassDependency AlertFailureClass = "dependency"+ AlertFailureClassEvidenceCoverage AlertFailureClass = "evidence-coverage"+)++type AlertCorrelationInference string++const (+ AlertCorrelationInferenceSupportedCause AlertCorrelationInference = "supported-cause"+ AlertCorrelationInferenceObservationSet AlertCorrelationInference = "observation-set"+)++// AlertCorrelationObservation is a bounded, content-free description of one+// independently evaluated detector in an incident synthesis group. It keeps+// the source alert and its evidence addressable without copying arbitrary+// provider payloads into the correlation contract.+type AlertCorrelationObservation struct {+ AlertID string `json:"alertId"`+ ResourceID string `json:"resourceId"`+ ResourceName string `json:"resourceName"`+ FailureClass AlertFailureClass `json:"failureClass"`+ Level AlertLevel `json:"level"`+ ObservedAt time.Time `json:"observedAt"`+ EvidenceIDs []string `json:"evidenceIds,omitempty"`+}+// AlertCorrelation is presentation-only incident context. It lets clients// present independently evaluated alerts as signals from one verified system// without merging their canonical detector lifecycles.type AlertCorrelation struct {- Key string `json:"key"`- Kind AlertCorrelationKind `json:"kind"`- Role AlertCorrelationRole `json:"role"`- Reason string `json:"reason"`+ Key string `json:"key"`+ Kind AlertCorrelationKind `json:"kind"`+ Role AlertCorrelationRole `json:"role"`+ Reason string `json:"reason"`+ FailureClass AlertFailureClass `json:"failureClass,omitempty"`+ Inference AlertCorrelationInference `json:"inference,omitempty"`+ PrimaryAlertID string `json:"primaryAlertId,omitempty"`+ PrimaryResourceID string `json:"primaryResourceId,omitempty"`+ AffectedResourceIDs []string `json:"affectedResourceIds,omitempty"`+ Observations []AlertCorrelationObservation `json:"observations,omitempty"`}// NewSharedSystemAlertCorrelation returns a bounded shared-system correlation.@@ -50,10 +89,29 @@ func NewSharedSystemAlertCorrelation(key string, role AlertCorrelationRole, reas}func cloneAlertCorrelation(correlation *AlertCorrelation) *AlertCorrelation {- if correlation == nil || correlation.Kind != AlertCorrelationKindSharedSystem {+ if correlation == nil {+ return nil+ }+ if correlation.Kind == AlertCorrelationKindSharedSystem {+ return NewSharedSystemAlertCorrelation(correlation.Key, correlation.Role, correlation.Reason)+ }+ if correlation.Kind != AlertCorrelationKindInfrastructureIncident ||+ strings.TrimSpace(correlation.Key) == "" ||+ strings.TrimSpace(correlation.Reason) == "" ||+ (correlation.Role != AlertCorrelationRolePrimary && correlation.Role != AlertCorrelationRoleSupporting) ||+ (correlation.Inference != AlertCorrelationInferenceSupportedCause && correlation.Inference != AlertCorrelationInferenceObservationSet) {return nil}- return NewSharedSystemAlertCorrelation(correlation.Key, correlation.Role, correlation.Reason)+ clone := *correlation+ clone.AffectedResourceIDs = append([]string(nil), correlation.AffectedResourceIDs...)+ if len(correlation.Observations) > 0 {+ clone.Observations = make([]AlertCorrelationObservation, len(correlation.Observations))+ for index := range correlation.Observations {+ clone.Observations[index] = correlation.Observations[index]+ clone.Observations[index].EvidenceIDs = append([]string(nil), correlation.Observations[index].EvidenceIDs...)+ }+ }+ return &clone}// Alert represents an active alertdiff --git a/internal/alerts/notification_policy.go b/internal/alerts/notification_policy.goindex 933ab659a3..811767fc81 100644--- a/internal/alerts/notification_policy.go+++ b/internal/alerts/notification_policy.go@@ -38,6 +38,7 @@ const (AlertDeliveryReasonCooldown = "cooldown"AlertDeliveryReasonQuietHours = "quiet_hours"AlertDeliveryReasonMonitorOnly = "monitor_only"+ AlertDeliveryReasonCorrelatedPrimary = "correlated_primary")// AlertDeliveryDiagnosis is a read-only projection of the alert manager's@@ -183,6 +184,13 @@ func (m *Manager) dispatchAlert(alert *Alert, async bool) bool {details)return false}+ if isSupportedInfrastructureSymptom(alert) {+ m.recordAlertEvent(eventlog.TypeNotificationSuppressed, alert, "",+ AlertDeliveryReasonCorrelatedPrimary,+ "Notification suppressed: a supported primary infrastructure alert owns delivery for this incident group.",+ map[string]string{"primaryAlertId": alert.Correlation.PrimaryAlertID})+ return false+ }trackingKey := canonicalTrackingKeyForAlert(alert)@@ -360,6 +368,15 @@ func isMonitorOnlyAlert(alert *Alert) bool {return false}+func isSupportedInfrastructureSymptom(alert *Alert) bool {+ return alert != nil &&+ alert.Correlation != nil &&+ alert.Correlation.Kind == AlertCorrelationKindInfrastructureIncident &&+ alert.Correlation.Role == AlertCorrelationRoleSupporting &&+ alert.Correlation.Inference == AlertCorrelationInferenceSupportedCause &&+ strings.TrimSpace(alert.Correlation.PrimaryAlertID) != ""+}+// isInQuietHours checks if the current time is within quiet hoursfunc (m *Manager) isInQuietHours() bool {if !m.config.Schedule.QuietHours.Enabled {@@ -785,6 +802,8 @@ func (m *Manager) diagnoseActiveAlertLocked(alert *Alert) AlertDeliveryDiagnosisswitch {case alert.Acknowledged:diagnosis.setSuppressed(AlertDeliveryReasonAcknowledged, "Alert is acknowledged, so firing notifications are suppressed.")+ case isSupportedInfrastructureSymptom(alert):+ diagnosis.setSuppressed(AlertDeliveryReasonCorrelatedPrimary, "A supported primary infrastructure alert owns notification delivery for this grouped symptom.")case func() bool {until, snoozed := alertSnoozeUntil(alert, now)if !snoozed {diff --git a/internal/alerts/unified_incidents.go b/internal/alerts/unified_incidents.goindex 7c48c6e081..9b68c77916 100644--- a/internal/alerts/unified_incidents.go+++ b/internal/alerts/unified_incidents.go@@ -240,6 +240,11 @@ func (m *Manager) SyncUnifiedResourceIncidents(resources []unifiedresources.Resom.clearAlertNoLock(storageKey)}+ // Synthesize over the post-recovery live set before updating or dispatching+ // any detector. Supporting symptoms retain their independent lifecycle but+ // can share one evidence-backed incident presentation and delivery decision.+ m.applyInfrastructureIncidentSynthesisNoLock(resourcesByID, desired)+for storageKey, alert := range desired {if existing, exists := m.getActiveAlertNoLock(storageKey); exists && existing != nil {existing.LastSeen = alert.LastSeen@@ -251,6 +256,14 @@ func (m *Manager) SyncUnifiedResourceIncidents(resources []unifiedresources.Resoexisting.Instance = alert.Instanceexisting.Message = alert.Messageexisting.Metadata = alert.Metadata+ // Infrastructure synthesis is recomputed from the complete current+ // detector set on every pass. Copy that current result onto the+ // retained lifecycle object; otherwise an existing alert would lose+ // its group after one reconciliation. A pre-existing non-synthesis+ // correlation stays authoritative when this cycle has no replacement.+ if alert.Correlation != nil || existing.Correlation == nil {+ existing.Correlation = cloneAlertCorrelation(alert.Correlation)+ }// Each sync re-observes the incident, so carry the cycle's evidence// into the live alert. Without this the envelope attached at first// raise ages out (availability evidence drifts past its validity