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.

Clarify Patrol recency labels

rcourtman631c997eaae4
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 3729267673..13fec92fac 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -139,6 +139,10 @@ 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.
+The summary recency chip must follow the same governed scope distinction. When
+the latest completed activity was only a scoped run, the summary should label
+that timestamp as `Last activity` instead of `Last patrol`; `Last full patrol`
+belongs only to the most recent completed full Patrol run.
That summary surface must also avoid reintroducing a second compact assessment
or verification layer beneath the primary card. Supporting metric strips
belong 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.tsx
index dbf0036b4b..a2de3309a1 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,
+ getPatrolRecencyPresentation,
getPatrolVerificationPresentation,
getPatrolSummaryPresentation,
} from '@/utils/patrolSummaryPresentation';
@@ -67,6 +68,12 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat
blockedReason: state.blockedReason(),
}),
);
+ const recency = createMemo(() =>
+ getPatrolRecencyPresentation({
+ runs: state.patrolRunHistory() ?? [],
+ lastPatrolAt: state.patrolStatus()?.last_patrol_at,
+ }),
+ );
const fixedSummaryPresentation = createMemo(() =>
getPatrolSummaryPresentation('success', summaryStats().fixedCount > 0),
);
@@ -87,10 +94,10 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat
{runtimePresentation().label}
</h2>
<p class="mt-1 text-sm text-base-content">{runtimePresentation().description}</p>
- <Show when={state.patrolStatus()?.last_patrol_at}>
+ <Show when={recency().timestamp}>
<p class="mt-2 text-xs text-muted">
- Last completed patrol{' '}
- {formatRelativeTime(state.patrolStatus()!.last_patrol_at, {
+ {recency().label}{' '}
+ {formatRelativeTime(recency().timestamp!, {
compact: true,
emptyText: 'never',
})}
@@ -155,10 +162,10 @@ export function PatrolIntelligenceSummary(props: { state: PatrolIntelligenceStat
<span class="rounded-full border border-border-subtle bg-base px-2.5 py-1 text-xs font-medium text-base-content">
Active findings {summaryStats().totalActive}
</span>
- <Show when={state.patrolStatus()?.last_patrol_at}>
+ <Show when={recency().timestamp}>
<span class="rounded-full border border-border-subtle bg-base px-2.5 py-1 text-xs font-medium text-base-content">
- Last patrol{' '}
- {formatRelativeTime(state.patrolStatus()!.last_patrol_at, {
+ {recency().label}{' '}
+ {formatRelativeTime(recency().timestamp!, {
compact: true,
emptyText: 'never',
})}
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index 092529e518..102ad06322 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -817,10 +817,12 @@ 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(/Last activity/i)).toBeInTheDocument();
expect(screen.getByText('Warnings')).toBeInTheDocument();
});
expect(screen.queryByText('No issues found')).not.toBeInTheDocument();
+ expect(screen.queryByText(/Last patrol/i)).not.toBeInTheDocument();
expect(screen.queryByText('Partial verification')).not.toBeInTheDocument();
expect(
screen.getAllByText(
diff --git a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
index 028e232235..f345b22ffc 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,
+ getPatrolRecencyPresentation,
getPatrolVerificationPresentation,
getPatrolNoIssuesPresentation,
getPatrolSummaryPresentation,
@@ -207,4 +208,83 @@ describe('getPatrolSummaryPresentation', () => {
tone: 'warning',
});
});
+
+ it('labels scoped recency as activity rather than patrol', () => {
+ expect(
+ getPatrolRecencyPresentation({
+ 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({
+ label: 'Last activity',
+ timestamp: '2026-03-12T09:59:00Z',
+ });
+ });
+
+ it('labels full patrol recency explicitly when the latest completed run is full', () => {
+ expect(
+ getPatrolRecencyPresentation({
+ 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({
+ label: 'Last full patrol',
+ timestamp: '2026-03-12T09:57:00Z',
+ });
+ });
});
diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.ts
index f8a3aa7b70..4a10c76c50 100644
--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts
+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts
@@ -32,6 +32,11 @@ export interface PatrolVerificationPresentation {
lastFullRunAt?: string;
}
+export interface PatrolRecencyPresentation {
+ label: string;
+ timestamp?: string;
+}
+
export const PATROL_NO_ISSUES_LABEL = 'No issues found';
const QUIET_ICON_CONTAINER = 'bg-surface border-border';
@@ -276,6 +281,30 @@ export function getPatrolVerificationPresentation(args: {
};
}
+export function getPatrolRecencyPresentation(args: {
+ runs?: PatrolRunRecord[];
+ lastPatrolAt?: string;
+}): PatrolRecencyPresentation {
+ const latestCompletedRun = (args.runs ?? []).find((run) => isCompletedPatrolRun(run));
+ if (latestCompletedRun?.completed_at) {
+ return {
+ label: isFullPatrolRun(latestCompletedRun) ? 'Last full patrol' : 'Last activity',
+ timestamp: latestCompletedRun.completed_at,
+ };
+ }
+
+ if (args.lastPatrolAt?.trim()) {
+ return {
+ label: 'Last activity',
+ timestamp: args.lastPatrolAt,
+ };
+ }
+
+ return {
+ label: 'Last activity',
+ };
+}
+
export function getPatrolNoIssuesPresentation(args: {
overallHealth?: IntelligenceHealthScore;
runtimeState?: PatrolRuntimeState;