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
Unify Patrol assessment explanation
rcourtman47bf13f09683
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex cadea59897..3729267673 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -134,6 +134,11 @@ supporting evidence. Secondary metric strips must not render `No issues found`when the same governed overall-health summary says coverage is incomplete orhealth still requires attention; that compact summary state now belongs to theshared `frontend-modern/src/utils/patrolSummaryPresentation.ts` helper.+That same helper also owns the primary assessment explanation. The summary card+must not pair an `Issues detected` headline with a raw coverage-only+`overall_health.prediction` sentence from a separate source; when active+findings and incomplete verification are both true, the Patrol summary should+describe both in one canonical assessment message.That summary surface must also avoid reintroducing a second compact assessmentor verification layer beneath the primary card. Supporting metric stripsbelong to counts and outcomes such as active findings, critical findings,diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsxindex cd43cf7397..dbf0036b4b 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx@@ -146,7 +146,7 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat<h2 class="mt-1 text-lg font-semibold text-base-content">{assessment().title}</h2>- <p class="mt-1 text-sm text-base-content">{summary().overall_health.prediction}</p>+ <p class="mt-1 text-sm text-base-content">{assessment().description}</p><div class="mt-3 flex flex-wrap items-center gap-2"><span class="rounded-full border border-border-subtle bg-base px-2.5 py-1 text-xs font-medium text-base-content">Health {summary().overall_health.grade} ·{' '}diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsxindex 15985b1911..092529e518 100644--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx@@ -18,6 +18,7 @@ const { findingsPanelState, runHistoryState, intelligenceState } = vi.hoisted(()selection: null as Record<string, unknown> | null,},intelligenceState: {+ findings: [] as Array<Record<string, unknown>>,summary: null as {timestamp: string;overall_health: {@@ -141,7 +142,6 @@ vi.mock('@/stores/notifications', () => ({vi.mock('@/stores/aiIntelligence', () => {const store = {- findings: [],loadFindings: vi.fn().mockResolvedValue(undefined),loadIntelligenceSummary: vi.fn().mockResolvedValue(undefined),loadCircuitBreakerStatus: vi.fn().mockResolvedValue(undefined),@@ -161,6 +161,9 @@ vi.mock('@/stores/aiIntelligence', () => {store.loadCorrelations(),]);}),+ get findings() {+ return intelligenceState.findings;+ },get intelligenceSummary() {return intelligenceState.summary;},@@ -300,6 +303,7 @@ describe('AIIntelligence entitlement gating', () => {notificationErrorMock.mockReset();findingsPanelState.latestProps = null;runHistoryState.selection = null;+ intelligenceState.findings = [];intelligenceState.summary = null;intelligenceState.correlations = null;setCorrelationsState(null);@@ -825,6 +829,110 @@ describe('AIIntelligence entitlement gating', () => {).toHaveLength(1);});+ it('describes both findings and incomplete coverage when active issues exist', async () => {+ hasFeatureMock.mockReturnValue(true);+ licenseStatusMock.mockReturnValue({ subscription_state: 'active' });+ getPatrolStatusMock.mockResolvedValue(defaultPatrolStatus({ license_required: false }));+ getPatrolRunHistoryMock.mockResolvedValue([+ {+ id: 'run-full-error',+ started_at: '2026-03-12T09:56:00Z',+ completed_at: '2026-03-12T09:57:00Z',+ duration_ms: 60000,+ type: 'patrol',+ trigger_reason: 'startup',+ scope_resource_ids: [],+ effective_scope_resource_ids: [],+ scope_resource_types: [],+ resources_checked: 58,+ nodes_checked: 0,+ guests_checked: 0,+ docker_checked: 0,+ storage_checked: 0,+ hosts_checked: 0,+ pbs_checked: 0,+ pmg_checked: 0,+ kubernetes_checked: 0,+ new_findings: 1,+ existing_findings: 0,+ rejected_findings: 0,+ resolved_findings: 0,+ auto_fix_count: 0,+ findings_summary: '1 warning',+ finding_ids: ['finding-1'],+ error_count: 1,+ status: 'error',+ triage_flags: 0,+ tool_call_count: 0,+ },+ ]);+ intelligenceState.findings = [+ {+ id: 'finding-1',+ source: 'patrol',+ isThreshold: false,+ status: 'active',+ severity: 'warning',+ resourceId: 'svc-patrol',+ resourceType: 'service',+ detectedAt: '2026-03-12T09:57:00Z',+ },+ ];+ intelligenceState.summary = {+ timestamp: '2026-03-12T10:00:00Z',+ overall_health: {+ score: 60,+ grade: 'C',+ trend: 'stable',+ factors: [+ {+ name: 'Patrol coverage incomplete',+ impact: -0.35,+ description:+ 'Patrol coverage is incomplete: recent activity was limited to scoped runs and ended with errors, so overall health is not fully verified.',+ category: 'coverage',+ },+ ],+ prediction:+ 'Patrol coverage is incomplete: recent activity was limited to scoped runs and ended with errors, so overall health is not fully verified.',+ },+ findings_count: {+ critical: 0,+ warning: 1,+ watch: 0,+ info: 0,+ total: 1,+ },+ predictions_count: 0,+ recent_changes_count: 0,+ learning: {+ resources_with_knowledge: 0,+ total_notes: 0,+ resources_with_baselines: 0,+ patterns_detected: 0,+ correlations_learned: 0,+ incidents_tracked: 0,+ },+ };++ render(() => <AIIntelligence />);++ await waitFor(() => {+ expect(screen.getByText('Issues detected')).toBeInTheDocument();+ expect(+ screen.getByText(+ 'Patrol surfaced 1 active warning finding. Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.',+ ),+ ).toBeInTheDocument();+ });++ expect(+ screen.queryByText(+ 'Patrol coverage is incomplete: recent activity was limited to scoped runs and ended with errors, so overall health is not fully verified.',+ ),+ ).not.toBeInTheDocument();+ });+it('treats a selected zero-finding run as an empty snapshot and uses effective scope ids', async () => {hasFeatureMock.mockReturnValue(true);licenseStatusMock.mockReturnValue({ subscription_state: 'active' });diff --git a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.tsindex 761b51e2ce..028e232235 100644--- a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts@@ -48,6 +48,7 @@ describe('getPatrolSummaryPresentation', () => {}),).toEqual({title: 'Coverage incomplete',+ description: 'Patrol coverage is incomplete.',eyebrow: 'Patrol assessment',compactLabel: 'Coverage incomplete',tone: 'warning',@@ -68,6 +69,37 @@ describe('getPatrolSummaryPresentation', () => {}),).toEqual({title: 'Issues detected',+ description: 'Warnings require review.',+ eyebrow: 'Patrol assessment',+ compactLabel: 'Issues detected',+ tone: 'warning',+ });+ });++ it('combines active findings with the coverage caveat when both are present', () => {+ expect(+ getPatrolAssessmentPresentation({+ overallHealth: {+ score: 60,+ grade: 'C',+ trend: 'stable',+ factors: [+ {+ name: 'Patrol coverage incomplete',+ impact: -0.35,+ description: 'Patrol coverage is incomplete.',+ category: 'coverage',+ },+ ],+ prediction:+ 'Patrol coverage is incomplete: recent activity was limited to scoped runs and ended with errors, so overall health is not fully verified.',+ },+ warningFindings: 1,+ }),+ ).toEqual({+ title: 'Issues detected',+ description:+ 'Patrol surfaced 1 active warning finding. Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.',eyebrow: 'Patrol assessment',compactLabel: 'Issues detected',tone: 'warning',diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.tsindex 6113da27aa..f8a3aa7b70 100644--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts@@ -18,6 +18,7 @@ export interface PatrolNoIssuesPresentation {export interface PatrolAssessmentPresentation {title: string;+ description: string;eyebrow: string;compactLabel: string;tone: SemanticTone;@@ -73,6 +74,43 @@ function getHealthSummaryTone(overallHealth: IntelligenceHealthScore): SemanticTreturn overallHealth.grade === 'D' || overallHealth.grade === 'F' ? 'error' : 'warning';}+function getCoverageDescription(overallHealth: IntelligenceHealthScore | undefined): string {+ return (+ overallHealth?.prediction?.trim() ||+ 'Patrol coverage is incomplete, so overall infrastructure health is not fully verified.'+ );+}++function formatFindingCount(count: number, severity: 'critical' | 'warning'): string {+ return `${count} active ${severity} finding${count === 1 ? '' : 's'}`;+}++function getFindingAssessmentDescription(args: {+ criticalFindings?: number;+ warningFindings?: number;+ overallHealth?: IntelligenceHealthScore;+}): string {+ const criticalFindings = args.criticalFindings ?? 0;+ const warningFindings = args.warningFindings ?? 0;+ const hasCoverageGap = Boolean(+ args.overallHealth?.factors.some((factor) => factor.category === 'coverage'),+ );++ const findingSummary =+ criticalFindings > 0+ ? `Patrol surfaced ${formatFindingCount(criticalFindings, 'critical')}.`+ : `Patrol surfaced ${formatFindingCount(warningFindings, 'warning')}.`;++ if (hasCoverageGap) {+ return `${findingSummary} Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.`;+ }++ return (+ args.overallHealth?.prediction?.trim() ||+ `${findingSummary} Review the active findings for more detail.`+ );+}+function normalizeRunType(type: string | undefined): string {return String(type || '').trim()@@ -107,6 +145,7 @@ export function getPatrolAssessmentPresentation(args: {const runtime = getPatrolRuntimePresentation(args.runtimeState, args.blockedReason);return {title: runtime.label,+ description: runtime.description,eyebrow: runtime.title,compactLabel: runtime.label,tone: runtime.tone,@@ -116,6 +155,7 @@ export function getPatrolAssessmentPresentation(args: {if ((args.criticalFindings ?? 0) > 0) {return {title: 'Critical issues detected',+ description: getFindingAssessmentDescription(args),eyebrow: 'Patrol assessment',compactLabel: 'Issues detected',tone: 'error',@@ -125,6 +165,7 @@ export function getPatrolAssessmentPresentation(args: {if ((args.warningFindings ?? 0) > 0) {return {title: 'Issues detected',+ description: getFindingAssessmentDescription(args),eyebrow: 'Patrol assessment',compactLabel: 'Issues detected',tone: 'warning',@@ -134,6 +175,7 @@ export function getPatrolAssessmentPresentation(args: {if (args.overallHealth?.factors.some((factor) => factor.category === 'coverage')) {return {title: 'Coverage incomplete',+ description: getCoverageDescription(args.overallHealth),eyebrow: 'Patrol assessment',compactLabel: 'Coverage incomplete',tone: getHealthSummaryTone(args.overallHealth),@@ -143,6 +185,9 @@ export function getPatrolAssessmentPresentation(args: {if (args.overallHealth && args.overallHealth.grade !== 'A') {return {title: 'Health requires attention',+ description:+ args.overallHealth.prediction?.trim() ||+ 'Patrol assessment still needs attention.',eyebrow: 'Patrol assessment',compactLabel: 'Health requires attention',tone: getHealthSummaryTone(args.overallHealth),@@ -151,6 +196,9 @@ export function getPatrolAssessmentPresentation(args: {return {title: 'No active issues detected',+ description:+ args.overallHealth?.prediction?.trim() ||+ 'Infrastructure is healthy with no significant issues detected.',eyebrow: 'Patrol assessment',compactLabel: PATROL_NO_ISSUES_LABEL,tone: 'success',