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
Explain Patrol verification scope
rcourtmane04f8369551f
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 959a077604..c3c4d23b13 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -115,6 +115,7 @@ Own canonical runtime payload shapes between backend and frontend.while keeping the learning counters backend-only coverage, so the summary page keeps Patrol health and findings primary and renders timeline, correlation, and policy-posture data as secondary investigation context rather than as a separate headline product metricand the Patrol findings empty-state behavior, so `0 active findings` only renders as a healthy frontend conclusion when the same governed AI summary contract still reports healthy overall health; degraded or not-fully-verified health predictions must flow through to the Patrol findings surface instead of being replaced by page-local "looks healthy" copyand the Patrol assessment headline plus compact summary-strip behavior, so the same governed AI summary contract decides whether the page leads with verified health, issues detected, coverage incomplete, or another attention state instead of letting count-only page fragments emit a stale `No issues found` conclusion+ and the Patrol verification summary derived from run history, so the page also states whether recent Patrol evidence came from a successful full patrol or only from scoped/erroring runs instead of leaving verification scope implicitand the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` card, so canonical recent-change timelines stay rendered through one governed frontend card instead of separate page-local list loopsand the shared `frontend-modern/src/utils/resourceChangePresentation.ts` formatter used by the summary page and resource drawer, so canonical change wording does not drift across surfacesand the `/api/ai/intelligence/changes` route plus `internal/api/contract_test.go`, so the canonical recent-changes endpoint stays on the same intelligence facade and contract snapshot instead of bypassing the shared timeline sourcediff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex bdc8fa604d..dd947f7935 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -746,6 +746,10 @@ That same rule also applies to compact Patrol summary fragments inside thefeature surface: count-only strips or metric cards must not emit `No issuesfound` or other reassuring copy when the owning overall-health summary isdegraded or not fully verified.+That same summary shell should also surface verification scope from the+owning run-history contract. Operators should be able to see, inside the same+summary surface, whether Patrol recently completed a full verification pass or+whether recent activity was limited to scoped/erroring patrol runs.Shared primitive consumers that split status-dot tone and status-text tonemust now keep both values routed through the same exported presentation helper.diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 36336c0125..5068a230f7 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -128,6 +128,12 @@ 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 summary surface must also explain what Patrol actually verified.+Recent run history should drive a visible verification summary that tells the+operator whether Patrol recently completed a successful full patrol, only ran+scoped alert-triggered checks, or ended its most recent full patrol with+errors, so the page does not leave trust and coverage as implicit background+knowledge.hook-local fallback logic.The Patrol header now also has explicit helper ownership for its quickstart andschedule presentation. `frontend-modern/src/utils/aiQuickstartPresentation.ts`diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsxindex 9e16e5d32c..6ac9d1c081 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx@@ -6,6 +6,7 @@ import AlertCircleIcon from 'lucide-solid/icons/alert-circle';import AlertTriangleIcon from 'lucide-solid/icons/alert-triangle';import {getPatrolAssessmentPresentation,+ getPatrolVerificationPresentation,getPatrolSummaryPresentation,} from '@/utils/patrolSummaryPresentation';import { getPatrolRuntimePresentation } from '@/utils/patrolRuntimePresentation';@@ -25,9 +26,6 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStatconst warningSummaryPresentation = createMemo(() =>getPatrolSummaryPresentation('warning', summaryStats().warningFindings > 0),);- const fixedSummaryPresentation = createMemo(() =>- getPatrolSummaryPresentation('success', summaryStats().fixedCount > 0),- );const runtimePresentation = createMemo(() =>getPatrolRuntimePresentation(state.runtimeState(), state.blockedReason()),);@@ -62,6 +60,23 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStattrue,),);+ const verification = createMemo(() =>+ getPatrolVerificationPresentation({+ runs: state.patrolRunHistory() ?? [],+ runtimeState: state.runtimeState(),+ blockedReason: state.blockedReason(),+ }),+ );+ const verificationSummaryPresentation = createMemo(() =>+ getPatrolSummaryPresentation(+ verification().tone === 'error'+ ? 'critical'+ : verification().tone === 'warning'+ ? 'warning'+ : 'success',+ true,+ ),+ );return (<>@@ -157,6 +172,26 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat</span></Show></div>++ <div class="mt-4 rounded-md border border-border-subtle bg-base/90 p-3">+ <p class="text-xs font-semibold uppercase tracking-[0.16em] text-muted">+ Verification+ </p>+ <p class="mt-1 text-sm font-medium text-base-content">+ {verification().title}+ <Show when={verification().lastFullRunAt}>+ <span class="text-muted">+ {' '}+ ·{' '}+ {formatRelativeTime(verification().lastFullRunAt!, {+ compact: true,+ emptyText: 'never',+ })}+ </span>+ </Show>+ </p>+ <p class="mt-1 text-sm text-muted">{verification().description}</p>+ </div></div></div>@@ -267,14 +302,32 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat<div class="bg-surface rounded-md border border-border p-3"><div class="flex items-center gap-2"><div- class={`p-1.5 rounded-md border ${criticalSummaryPresentation().iconContainerClass}`}+ class={`p-1.5 rounded-md border ${verificationSummaryPresentation().iconContainerClass}`}>- <ShieldAlertIcon class={`w-4 h-4 ${criticalSummaryPresentation().iconClass}`} />+ <Show+ when={verification().tone === 'success'}+ fallback={+ <Show+ when={verification().tone === 'error'}+ fallback={+ <AlertTriangleIcon+ class={`w-4 h-4 ${verificationSummaryPresentation().iconClass}`}+ />+ }+ >+ <ShieldAlertIcon+ class={`w-4 h-4 ${verificationSummaryPresentation().iconClass}`}+ />+ </Show>+ }+ >+ <CheckCircleIcon class={`w-4 h-4 ${verificationSummaryPresentation().iconClass}`} />+ </Show></div><div>- <p class="text-xs text-muted">Critical</p>- <p class={`text-lg font-bold ${criticalSummaryPresentation().valueClass}`}>- {state.summaryStats().criticalFindings}+ <p class="text-xs text-muted">Verification</p>+ <p class={`text-sm font-semibold ${verificationSummaryPresentation().valueClass}`}>+ {verification().compactLabel}</p></div></div>@@ -283,14 +336,14 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat<div class="bg-surface rounded-md border border-border p-3"><div class="flex items-center gap-2"><div- class={`p-1.5 rounded-md border ${warningSummaryPresentation().iconContainerClass}`}+ class={`p-1.5 rounded-md border ${criticalSummaryPresentation().iconContainerClass}`}>- <ActivityIcon class={`w-4 h-4 ${warningSummaryPresentation().iconClass}`} />+ <ShieldAlertIcon class={`w-4 h-4 ${criticalSummaryPresentation().iconClass}`} /></div><div>- <p class="text-xs text-muted">Warnings</p>- <p class={`text-lg font-bold ${warningSummaryPresentation().valueClass}`}>- {state.summaryStats().warningFindings}+ <p class="text-xs text-muted">Critical</p>+ <p class={`text-lg font-bold ${criticalSummaryPresentation().valueClass}`}>+ {state.summaryStats().criticalFindings}</p></div></div>@@ -299,18 +352,19 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat<div class="bg-surface rounded-md border border-border p-3"><div class="flex items-center gap-2"><div- class={`p-1.5 rounded-md border ${fixedSummaryPresentation().iconContainerClass}`}+ class={`p-1.5 rounded-md border ${warningSummaryPresentation().iconContainerClass}`}>- <CheckCircleIcon class={`w-4 h-4 ${fixedSummaryPresentation().iconClass}`} />+ <ActivityIcon class={`w-4 h-4 ${warningSummaryPresentation().iconClass}`} /></div><div>- <p class="text-xs text-muted">Fixed</p>- <p class={`text-lg font-bold ${fixedSummaryPresentation().valueClass}`}>- {state.summaryStats().fixedCount}+ <p class="text-xs text-muted">Warnings</p>+ <p class={`text-lg font-bold ${warningSummaryPresentation().valueClass}`}>+ {state.summaryStats().warningFindings}</p></div></div></div>+</div></Show></>diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsxindex bd4ed1e5b2..fd631a019c 100644--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx@@ -738,6 +738,39 @@ describe('AIIntelligence entitlement gating', () => {last_patrol_at: '2026-03-12T09:57:00Z',}),);+ getPatrolRunHistoryMock.mockResolvedValue([+ {+ id: 'run-scoped',+ started_at: '2026-03-12T09:56:00Z',+ completed_at: '2026-03-12T09:57:00Z',+ duration_ms: 60000,+ type: 'scoped',+ trigger_reason: 'alert_fired',+ scope_resource_ids: ['vm-100'],+ effective_scope_resource_ids: ['vm-100'],+ scope_resource_types: ['vm'],+ resources_checked: 1,+ nodes_checked: 0,+ guests_checked: 1,+ docker_checked: 0,+ storage_checked: 0,+ hosts_checked: 0,+ pbs_checked: 0,+ pmg_checked: 0,+ kubernetes_checked: 0,+ new_findings: 0,+ existing_findings: 0,+ rejected_findings: 0,+ resolved_findings: 0,+ auto_fix_count: 0,+ findings_summary: '',+ finding_ids: [],+ error_count: 1,+ status: 'error',+ triage_flags: 0,+ tool_call_count: 0,+ },+ ]);intelligenceState.summary = {timestamp: '2026-03-12T10:00:00Z',overall_health: {@@ -779,6 +812,8 @@ describe('AIIntelligence entitlement gating', () => {await waitFor(() => {expect(screen.getAllByText('Coverage incomplete').length).toBeGreaterThan(0);+ expect(screen.getByText('No recent full patrol')).toBeInTheDocument();+ expect(screen.getByText('Partial verification')).toBeInTheDocument();});expect(screen.queryByText('No issues found')).not.toBeInTheDocument();diff --git a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.tsindex 486e72c957..761b51e2ce 100644--- a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from 'vitest';import {getPatrolAssessmentPresentation,+ getPatrolVerificationPresentation,getPatrolNoIssuesPresentation,getPatrolSummaryPresentation,PATROL_NO_ISSUES_LABEL,@@ -89,4 +90,89 @@ describe('getPatrolSummaryPresentation', () => {tone: 'success',});});++ it('reports recent successful full patrol verification', () => {+ expect(+ getPatrolVerificationPresentation({+ runs: [+ {+ id: 'run-1',+ started_at: '2026-03-12T09:50:00Z',+ completed_at: '2026-03-12T09:57:00Z',+ duration_ms: 420000,+ type: 'patrol',+ 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: 0,+ existing_findings: 1,+ rejected_findings: 0,+ resolved_findings: 0,+ auto_fix_count: 0,+ findings_summary: '1 warning',+ finding_ids: ['finding-1'],+ error_count: 0,+ status: 'issues_found',+ triage_flags: 0,+ tool_call_count: 0,+ },+ ] as never,+ }),+ ).toEqual({+ title: 'Recently verified',+ description: 'The most recent full patrol completed successfully and checked 58 resources.',+ compactLabel: 'Recently verified',+ tone: 'success',+ lastFullRunAt: '2026-03-12T09:57:00Z',+ });+ });++ it('reports partial verification when only scoped runs are recent', () => {+ expect(+ getPatrolVerificationPresentation({+ runs: [+ {+ id: 'run-1',+ started_at: '2026-03-12T09:58:00Z',+ completed_at: '2026-03-12T09:59:00Z',+ duration_ms: 60000,+ type: 'scoped',+ trigger_reason: 'alert_fired',+ resources_checked: 1,+ 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: 0,+ existing_findings: 0,+ rejected_findings: 0,+ resolved_findings: 0,+ auto_fix_count: 0,+ findings_summary: '',+ finding_ids: [],+ error_count: 1,+ status: 'error',+ triage_flags: 0,+ tool_call_count: 0,+ },+ ] as never,+ }),+ ).toEqual({+ title: 'No recent full patrol',+ description:+ 'Recent activity was limited to scoped alert fired runs over 1 resource, so Patrol has not recently re-verified your full infrastructure.',+ compactLabel: 'Partial verification',+ tone: 'warning',+ });+ });});diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.tsindex ddda82f995..6113da27aa 100644--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts@@ -1,4 +1,4 @@-import type { PatrolRuntimeState } from '@/api/patrol';+import type { PatrolRunRecord, PatrolRuntimeState } from '@/api/patrol';import type { IntelligenceHealthScore } from '@/types/aiIntelligence';import type { SemanticTone } from '@/utils/semanticTonePresentation';import { getPatrolRuntimePresentation } from '@/utils/patrolRuntimePresentation';@@ -23,6 +23,14 @@ export interface PatrolAssessmentPresentation {tone: SemanticTone;}+export interface PatrolVerificationPresentation {+ title: string;+ description: string;+ compactLabel: string;+ tone: SemanticTone;+ lastFullRunAt?: string;+}+export const PATROL_NO_ISSUES_LABEL = 'No issues found';const QUIET_ICON_CONTAINER = 'bg-surface border-border';@@ -65,6 +73,25 @@ function getHealthSummaryTone(overallHealth: IntelligenceHealthScore): SemanticTreturn overallHealth.grade === 'D' || overallHealth.grade === 'F' ? 'error' : 'warning';}+function normalizeRunType(type: string | undefined): string {+ return String(type || '')+ .trim()+ .toLowerCase()+ .replace(/\s+/g, '_');+}++function isFullPatrolRun(run: PatrolRunRecord): boolean {+ return normalizeRunType(run.type) !== 'scoped';+}++function isCompletedPatrolRun(run: PatrolRunRecord): boolean {+ return Boolean(run.completed_at?.trim());+}++function hasRunErrors(run: PatrolRunRecord): boolean {+ return run.error_count > 0 || String(run.status || '').trim().toLowerCase() === 'error';+}+export function getPatrolAssessmentPresentation(args: {overallHealth?: IntelligenceHealthScore;runtimeState?: PatrolRuntimeState;@@ -130,6 +157,77 @@ export function getPatrolAssessmentPresentation(args: {};}+export function getPatrolVerificationPresentation(args: {+ runs?: PatrolRunRecord[];+ runtimeState?: PatrolRuntimeState;+ blockedReason?: string;+}): PatrolVerificationPresentation {+ if (+ args.runtimeState === 'blocked' ||+ args.runtimeState === 'disabled' ||+ args.runtimeState === 'unavailable'+ ) {+ const runtime = getPatrolRuntimePresentation(args.runtimeState, args.blockedReason);+ return {+ title: runtime.label,+ description: runtime.description,+ compactLabel: runtime.label,+ tone: runtime.tone,+ };+ }++ const completedRuns = (args.runs ?? []).filter((run) => isCompletedPatrolRun(run));+ const recentFullRun = completedRuns.find((run) => isFullPatrolRun(run));++ if (recentFullRun) {+ const resourcesChecked = recentFullRun.resources_checked || 0;+ if (hasRunErrors(recentFullRun)) {+ return {+ title: 'Full patrol needs review',+ description:+ resourcesChecked > 0+ ? `The most recent full patrol checked ${resourcesChecked} resource${resourcesChecked === 1 ? '' : 's'} but ended with ${recentFullRun.error_count} error${recentFullRun.error_count === 1 ? '' : 's'}.`+ : 'The most recent full patrol ended with errors, so Patrol has not fully re-verified your infrastructure.',+ compactLabel: 'Verification limited',+ tone: 'warning',+ lastFullRunAt: recentFullRun.completed_at,+ };+ }++ return {+ title: 'Recently verified',+ description:+ resourcesChecked > 0+ ? `The most recent full patrol completed successfully and checked ${resourcesChecked} resource${resourcesChecked === 1 ? '' : 's'}.`+ : 'The most recent full patrol completed successfully.',+ compactLabel: 'Recently verified',+ tone: 'success',+ lastFullRunAt: recentFullRun.completed_at,+ };+ }++ const recentScopedRun = completedRuns.find((run) => !isFullPatrolRun(run));+ if (recentScopedRun) {+ const resourcesChecked = recentScopedRun.resources_checked || 0;+ return {+ title: 'No recent full patrol',+ description:+ resourcesChecked > 0+ ? `Recent activity was limited to scoped ${recentScopedRun.trigger_reason ? String(recentScopedRun.trigger_reason).replace(/_/g, ' ') : 'patrol'} runs over ${resourcesChecked} resource${resourcesChecked === 1 ? '' : 's'}, so Patrol has not recently re-verified your full infrastructure.`+ : 'Recent activity was limited to scoped patrol runs, so Patrol has not recently re-verified your full infrastructure.',+ compactLabel: 'Partial verification',+ tone: 'warning',+ };+ }++ return {+ title: 'Verification pending',+ description: 'Patrol has not completed a recent full verification run yet.',+ compactLabel: 'Verification pending',+ tone: 'info',+ };+}+export function getPatrolNoIssuesPresentation(args: {overallHealth?: IntelligenceHealthScore;runtimeState?: PatrolRuntimeState;