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.

Surface Finding.Impact through UnifiedFinding to operators

rcourtman10ff1c4dcf7c
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index efeafd6a2a..222f3718d5 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -426,7 +426,11 @@ profile and assignment columns, but embedded table framing must route through
through shared AI intelligence handlers and `internal/api/router.go`:
lifecycle surfaces may observe the resulting resource context, but they must
not reinterpret `investigation_record` as agent enrollment, installer,
- command policy, or fleet-control authority. Assistant chat enrichment from
+ command policy, or fleet-control authority. The same isolation rule applies
+ to operator-facing finding fields like `impact` and `recommendation`
+ propagated through that router conversion: lifecycle surfaces may render
+ them in finding context but must not treat them as enrollment, installer,
+ or fleet-control authority for the named resource. Assistant chat enrichment from
`finding_id` follows the same rule: lifecycle-owned command execution and
agent auto-approval policy stay canonical in the agent/runtime owners, not
in Patrol investigation-record prompt text. Model-only Assistant handoff
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 96cdeaf57f..2fdf9bd104 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -246,7 +246,15 @@ runtime cost control, and shared AI transport surfaces.
classifier (`internal/ai/patrol_runtime_failure.go`) is the canonical
example: it stamps a constant impact string on every runtime-failure
cause because the operational consequence of a non-running Patrol is
- invariant across causes, and only the recommendation varies. When `/api/ai/chat` receives `finding_id`, the
+ invariant across causes, and only the recommendation varies. That
+ detection-time impact text propagates through `FindingsStore.Add` (which
+ must overwrite `existing.Impact` alongside `Description` and
+ `Recommendation` so re-detected findings adopt freshly-classified
+ impact rather than preserving stale empty values left by older
+ binaries) and through the Finding to UnifiedFinding conversion in
+ `internal/api/router.go` so the operator-facing
+ `unified.UnifiedFinding` surface receives the same impact string the
+ durable investigation record carries. When `/api/ai/chat` receives `finding_id`, the
runtime must enrich the provider turn from that durable record while
preserving the user's authored prompt as the persisted conversation
message; the model-only handoff may persist as session metadata so
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index a0313c6ed5..a818dbae83 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -955,7 +955,17 @@ the canonical monitored-system blocked payload.
TS API client so frontend consumers see the same patrol-failure
attribution the backend persists. Both `impact` and `rollback` are
omitempty/normalize-empty and must remain absent rather than fabricated
- when Patrol has not yet populated them
+ when Patrol has not yet populated them. Top-level `impact` also lives on
+ `unified.UnifiedFinding` directly, not only on the nested investigation
+ record, so detection-time consequence-if-ignored copy authored on
+ `Finding.Impact` (for example by the Patrol runtime-failure classifier)
+ reaches API consumers even when no investigation record is attached. The
+ Finding to UnifiedFinding conversion in `internal/api/router.go` and the
+ dedup-merge path in `FindingsStore.Add` must both propagate `impact`
+ alongside `description` and `recommendation` rather than dropping it;
+ persisted findings created by older binaries must adopt the
+ freshly-classified impact text on next re-detection rather than
+ preserving the empty value
and the Assistant finding-context request contract, so `/api/ai/chat`
payloads carrying `finding_id` may hydrate a structured investigation
summary from the unified finding, but raw proposed-fix commands must stay
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index c7fca4c01a..818f0e8fbc 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -252,6 +252,17 @@ Patrol-specific presentation helpers.
may include populated impact text in its bounded detail lines but must
omit the placeholder copy from that compact card so it stays tight,
leaving placeholder rendering to the full investigation surface.
+ `frontend-modern/src/components/AI/FindingsPanel.tsx` is the canonical
+ renderer for that operator-facing impact text on the unified findings
+ surface: when an expanded finding card has populated `impact`, the panel
+ renders an `Impact:` line between `Description` and `Recommendation`. The
+ TS API client mirrors (`UnifiedFindingRecord.impact`,
+ `Finding.impact`) and the store normalizers
+ (`normalizeUnifiedFindingRecord`, `normalizePatrolFindingRecord`) must
+ carry impact through alongside description and recommendation rather
+ than dropping it; runtime-failure findings produced by
+ `internal/ai/patrol_runtime_failure.go` are the first source to depend
+ on that path reaching the Patrol page surface.
The primary Patrol assessment summary may open Assistant as a whole-surface
review handoff, but that handoff must also flow through
`frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`.
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 6012a8204a..4d5d47ab7a 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -174,6 +174,11 @@ regression protection.
the same bounded-work rule: the callback may copy the already-materialized
durable record into unified findings, but it must not add broad resource
scans, model calls, or persistence walks to protected request setup paths.
+ The same rule covers the operator-facing `impact` and `recommendation`
+ fields copied from Finding to UnifiedFinding through that router callback:
+ the callback may pass them through as already-materialized strings but must
+ not invoke models, persistence walks, or evidence aggregation to derive
+ them on the protected hot path.
Patrol run Assistant handoff wiring in `internal/api/router.go` follows the
same protected hot-path rule: the shared callback may resolve one requested
Patrol run ID from the already-owned Patrol service and strip tool traces
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index b4fa1b7cbc..7c3e107bc0 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -231,7 +231,11 @@ bypass the API fail-closed execution gate.
When shared `internal/api/` handlers expose structured Patrol readiness or
provider/model/tool causes, storage and recovery surfaces may treat them only
as adjacent operator context and must not convert them into storage health,
- recovery execution, or backup remediation authority.
+ recovery execution, or backup remediation authority. The same rule covers
+ the operator-facing `impact` and `recommendation` fields propagated through
+ `internal/api/router.go` Finding to UnifiedFinding conversion: storage and
+ recovery surfaces may render them as adjacent finding context but must not
+ reinterpret them as backup, restore, or storage remediation authority.
Shared Patrol autonomy routes may also touch broad `internal/api/` wiring,
but monitor-mode AI configuration and remediation entitlement responses stay
AI runtime/API-contract owned and must not become recovery-local policy,
diff --git a/frontend-modern/src/api/__tests__/ai.test.ts b/frontend-modern/src/api/__tests__/ai.test.ts
index fc98149176..9a60f77f95 100644
--- a/frontend-modern/src/api/__tests__/ai.test.ts
+++ b/frontend-modern/src/api/__tests__/ai.test.ts
@@ -146,6 +146,35 @@ describe('AIAPI', () => {
expect(record!.trigger.cause).toBe('storage_quota_exceeded');
});
+ it('preserves UnifiedFinding-level impact text alongside description and recommendation', async () => {
+ apiFetchJSONMock.mockResolvedValue({
+ findings: [
+ {
+ id: 'uf-impact',
+ resource_id: 'patrol-runtime',
+ source: 'ai-patrol',
+ severity: 'warning',
+ category: 'reliability',
+ title: 'Pulse Patrol: Provider connection issue',
+ description:
+ 'Pulse Patrol could not maintain a healthy connection to the configured provider during analysis.',
+ impact:
+ 'While Patrol cannot analyze, alerts continue to fire without evidence or recommended actions, and AI Intelligence summaries cannot refresh.',
+ recommendation:
+ 'Check provider reachability, base URL, firewall or proxy rules, and provider availability, then rerun Patrol.',
+ detected_at: '2026-05-08T12:00:00Z',
+ alert_identifier: 'patrol-runtime-failure',
+ },
+ ],
+ count: 1,
+ } as any);
+
+ const result = await AIAPI.getUnifiedFindings();
+ expect(result.findings[0].impact).toBe(
+ 'While Patrol cannot analyze, alerts continue to fire without evidence or recommended actions, and AI Intelligence summaries cannot refresh.',
+ );
+ });
+
it('encodes dynamic provider, approval, finding, and plan identifiers', async () => {
apiFetchJSONMock.mockResolvedValue({} as any);
diff --git a/frontend-modern/src/api/ai.ts b/frontend-modern/src/api/ai.ts
index ca3baaa58e..353a9810f0 100644
--- a/frontend-modern/src/api/ai.ts
+++ b/frontend-modern/src/api/ai.ts
@@ -420,6 +420,7 @@ export interface UnifiedFindingRecord {
node?: string;
title: string;
description: string;
+ impact?: string;
recommendation?: string;
evidence?: string;
alertIdentifier?: string;
diff --git a/frontend-modern/src/api/patrol.ts b/frontend-modern/src/api/patrol.ts
index fa2664fb44..145bd6be5b 100644
--- a/frontend-modern/src/api/patrol.ts
+++ b/frontend-modern/src/api/patrol.ts
@@ -27,6 +27,7 @@ export interface Finding {
node?: string;
title: string;
description: string;
+ impact?: string;
recommendation?: string;
evidence?: string;
detected_at: string;
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index efe96c2f74..d1560de5ce 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -875,6 +875,11 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
</div>
</Show>
<p class="text-sm text-muted">{finding.description}</p>
+ <Show when={finding.impact}>
+ <p class="text-sm text-base-content mt-2">
+ <span class="font-medium">Impact:</span> {finding.impact}
+ </p>
+ </Show>
<Show when={finding.recommendation}>
<p class="text-sm text-base-content mt-2">
<span class="font-medium">Recommendation:</span> {finding.recommendation}
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
index 4ab0c900f0..a111399fe4 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
@@ -40,6 +40,7 @@ const mockState = vi.hoisted(() => {
severity: 'warning',
title: 'Nextcloud failed readiness checks',
description: 'Pulse Patrol detected repeated readiness probe failures.',
+ impact: 'Nextcloud is unreachable for users until readiness recovers.',
detectedAt: '2026-03-30T10:00:00Z',
lastSeenAt: '2026-03-30T10:05:00Z',
status: 'active',
@@ -194,6 +195,9 @@ describe('FindingsPanel resource links', () => {
fireEvent.click(screen.getByText('Nextcloud failed readiness checks'));
+ expect(
+ screen.getByText('Nextcloud is unreachable for users until readiness recovers.'),
+ ).toBeInTheDocument();
expect(
screen.getByRole('link', { name: 'Open related infrastructure for Nextcloud' }),
).toHaveAttribute('href', '/infrastructure?resource=app-container%3Atruenas-main%3Anextcloud');
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index 3d829b3600..35feb3f2dd 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -75,6 +75,21 @@ describe('FindingsPanel assistant handoff', () => {
expect(findingsPanelSource).not.toContain('Command: `');
expect(findingsPanelSource).not.toContain('Rollback: `');
});
+
+ it('renders the operator-facing Impact line between Description and Recommendation', () => {
+ // The expanded finding card must surface Finding.Impact directly so
+ // detection-time consequence-if-ignored copy reaches the operator on the
+ // findings list, not just inside the durable investigation record.
+ expect(findingsPanelSource).toContain('Show when={finding.impact}');
+ expect(findingsPanelSource).toContain('>Impact:</span> {finding.impact}');
+ // Impact must precede Recommendation in the rendered card, mirroring the
+ // narrative order: what we found, why it matters, what to do about it.
+ const impactIndex = findingsPanelSource.indexOf('>Impact:</span>');
+ const recommendationIndex = findingsPanelSource.indexOf('>Recommendation:</span>');
+ expect(impactIndex).toBeGreaterThan(0);
+ expect(recommendationIndex).toBeGreaterThan(0);
+ expect(impactIndex).toBeLessThan(recommendationIndex);
+ });
});
describe('aiFindingPresentation', () => {
diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
index c9fb064090..fc8b00b291 100644
--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
@@ -61,6 +61,7 @@ describe('aiIntelligenceStore', () => {
resource_type: 'vm',
title: 'CPU high',
description: 'CPU usage is high',
+ impact: 'Workload stalls until CPU pressure clears.',
detected_at: '2026-03-01T00:00:00Z',
last_seen_at: '2026-03-05T00:00:00Z',
times_raised: 5,
@@ -98,6 +99,7 @@ describe('aiIntelligenceStore', () => {
alertIdentifier: 'instance:node:100::metric/cpu',
lastSeenAt: '2026-03-05T00:00:00Z',
timesRaised: 5,
+ impact: 'Workload stalls until CPU pressure clears.',
investigationRecord: {
id: 'investigation-1',
finding_id: 'finding-1',
diff --git a/frontend-modern/src/stores/aiIntelligence.ts b/frontend-modern/src/stores/aiIntelligence.ts
index 5e599002e8..ba63bdb7ce 100644
--- a/frontend-modern/src/stores/aiIntelligence.ts
+++ b/frontend-modern/src/stores/aiIntelligence.ts
@@ -141,6 +141,7 @@ export interface UnifiedFinding {
severity: 'critical' | 'warning' | 'info' | 'watch';
title: string;
description: string;
+ impact?: string;
recommendation?: string;
detectedAt: string;
lastSeenAt?: string;
@@ -204,6 +205,7 @@ function normalizeUnifiedFindingRecord(item: UnifiedFindingRecord, now: number):
severity: validateSeverity(item.severity),
title: item.title,
description: item.description,
+ impact: item.impact,
recommendation: item.recommendation,
detectedAt: item.detected_at,
lastSeenAt: item.last_seen_at || item.detected_at,
@@ -242,6 +244,7 @@ function normalizePatrolFindingRecord(item: PatrolFinding, now: number): Unified
severity: validateSeverity(item.severity),
title: item.title,
description: item.description,
+ impact: item.impact,
recommendation: item.recommendation,
detectedAt: item.detected_at,
lastSeenAt: item.last_seen_at || item.detected_at,
diff --git a/internal/ai/findings.go b/internal/ai/findings.go
index 686a2d8512..9784dcc2bf 100644
--- a/internal/ai/findings.go
+++ b/internal/ai/findings.go
@@ -986,6 +986,7 @@ func (s *FindingsStore) Add(f *Finding) bool {
// Update existing finding
existing.LastSeenAt = time.Now()
existing.Description = f.Description
+ existing.Impact = f.Impact
existing.Recommendation = f.Recommendation
existing.Evidence = f.Evidence
existing.Title = f.Title // Update title in case LLM phrased it better
diff --git a/internal/ai/findings_test.go b/internal/ai/findings_test.go
index 2501895282..514c594262 100644
--- a/internal/ai/findings_test.go
+++ b/internal/ai/findings_test.go
@@ -553,6 +553,41 @@ func TestFindingsStore_Add_UpdateExisting(t *testing.T) {
}
}
+// TestFindingsStore_Add_PropagatesImpactFieldOnUpdate covers the dedup-merge
+// path where a re-detected finding carries newly-authored Impact text. The
+// existing finding may have been persisted before Impact was a contract field,
+// so the store must overwrite Impact alongside Description/Recommendation
+// rather than preserve the stale empty value.
+func TestFindingsStore_Add_PropagatesImpactFieldOnUpdate(t *testing.T) {
+ store := NewFindingsStore()
+
+ store.Add(&Finding{
+ ID: "f-impact",
+ ResourceID: "res-1",
+ Severity: FindingSeverityWarning,
+ Title: "Initial",
+ Description: "Initial",
+ // Impact not authored on first add (e.g., persisted by older binary)
+ })
+
+ store.Add(&Finding{
+ ID: "f-impact",
+ ResourceID: "res-1",
+ Severity: FindingSeverityWarning,
+ Title: "Initial",
+ Description: "Initial",
+ Impact: "Workload stalls until pressure clears.",
+ })
+
+ stored := store.Get("f-impact")
+ if stored == nil {
+ t.Fatalf("expected finding to be present after re-add")
+ }
+ if stored.Impact != "Workload stalls until pressure clears." {
+ t.Fatalf("expected Impact to overwrite on update, got %q", stored.Impact)
+ }
+}
+
func TestFindingsStore_Add_SeverityEscalation(t *testing.T) {
store := NewFindingsStore()
diff --git a/internal/ai/unified/alerts.go b/internal/ai/unified/alerts.go
index 10d32efcf2..afcac29add 100644
--- a/internal/ai/unified/alerts.go
+++ b/internal/ai/unified/alerts.go
@@ -78,6 +78,7 @@ type UnifiedFinding struct {
Node string `json:"node,omitempty"`
Title string `json:"title"`
Description string `json:"description"`
+ Impact string `json:"impact,omitempty"` // Operator-facing consequence-if-ignored statement
Recommendation string `json:"recommendation,omitempty"`
Evidence string `json:"evidence,omitempty"`
@@ -134,6 +135,7 @@ type unifiedFindingJSON struct {
Node string `json:"node,omitempty"`
Title string `json:"title"`
Description string `json:"description"`
+ Impact string `json:"impact,omitempty"`
Recommendation string `json:"recommendation,omitempty"`
Evidence string `json:"evidence,omitempty"`
AlertIdentifier string `json:"alert_identifier,omitempty"`
@@ -182,6 +184,7 @@ func (f UnifiedFinding) MarshalJSON() ([]byte, error) {
Node: f.Node,
Title: f.Title,
Description: f.Description,
+ Impact: f.Impact,
Recommendation: f.Recommendation,
Evidence: f.Evidence,
AlertIdentifier: alertIdentifier,
@@ -235,6 +238,7 @@ func (f *UnifiedFinding) UnmarshalJSON(data []byte) error {
Node: payload.Node,
Title: payload.Title,
Description: payload.Description,
+ Impact: payload.Impact,
Recommendation: payload.Recommendation,
Evidence: payload.Evidence,
AlertIdentifier: strings.TrimSpace(payload.AlertIdentifier),
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 804918367d..7806bcc5e1 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -29,6 +29,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation"
"github.com/rcourtman/pulse-go-rewrite/internal/ai/memory"
"github.com/rcourtman/pulse-go-rewrite/internal/ai/providers"
+ "github.com/rcourtman/pulse-go-rewrite/internal/ai/unified"
"github.com/rcourtman/pulse-go-rewrite/internal/alerts"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/license/entitlements"
@@ -2942,6 +2943,38 @@ func TestContract_FindingJSONSnapshot(t *testing.T) {
assertJSONSnapshot(t, got, want)
}
+// TestContract_UnifiedFindingImpactJSONSnapshot pins the canonical JSON shape
+// for UnifiedFinding payloads carrying the operator-facing Impact field. The
+// AI engine populates Finding.Impact at detection time and the Finding to
+// UnifiedFinding conversion in the API router must preserve that string under
+// the canonical "impact" key so the operator-visible card shows
+// consequence-if-ignored copy.
+func TestContract_UnifiedFindingImpactJSONSnapshot(t *testing.T) {
+ now := time.Date(2026, 2, 8, 13, 14, 15, 0, time.UTC)
+ finding := unified.UnifiedFinding{
+ ID: "uf-impact",
+ Source: unified.SourceAIPatrol,
+ Severity: unified.SeverityWarning,
+ Category: unified.CategoryReliability,
+ ResourceID: "patrol-runtime",
+ ResourceName: "Pulse Patrol Service",
+ ResourceType: "service",
+ Title: "Pulse Patrol: Provider connection issue",
+ Description: "Pulse Patrol could not maintain a healthy connection to the configured provider during analysis.",
+ Impact: "While Patrol cannot analyze, alerts continue to fire without evidence or recommended actions, and AI Intelligence summaries cannot refresh.",
+ Recommendation: "Check provider reachability, base URL, firewall or proxy rules, and provider availability, then rerun Patrol.",
+ DetectedAt: now,
+ LastSeenAt: now,
+ }
+ got, err := json.Marshal(finding)
+ if err != nil {
+ t.Fatalf("marshal unified finding: %v", err)
+ }
+ if !strings.Contains(string(got), `"impact":"While Patrol cannot analyze`) {
+ t.Fatalf("expected impact field in canonical UnifiedFinding payload, got %s", got)
+ }
+}
+
func TestContract_ApprovalJSONSnapshot(t *testing.T) {
now := time.Date(2026, 2, 8, 13, 14, 15, 0, time.UTC)
expires := now.Add(5 * time.Minute)
diff --git a/internal/api/router.go b/internal/api/router.go
index 8c2c2b7dfb..f8cdabadc8 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -1718,6 +1718,7 @@ func (r *Router) startPatrolForContext(ctx context.Context, orgID string) bool {
Node: f.Node,
Title: f.Title,
Description: f.Description,
+ Impact: f.Impact,
Recommendation: f.Recommendation,
Evidence: f.Evidence,
DetectedAt: f.DetectedAt,
@@ -1780,6 +1781,7 @@ func (r *Router) startPatrolForContext(ctx context.Context, orgID string) bool {
Node: f.Node,
Title: f.Title,
Description: f.Description,
+ Impact: f.Impact,
Recommendation: f.Recommendation,
Evidence: f.Evidence,
DetectedAt: f.DetectedAt,