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.

Use checked wording for limited Patrol recency

rcourtman5b18438528b9
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 7b3c954f58..28514ac078 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -1083,12 +1083,13 @@ the canonical monitored-system blocked payload.
a render-only consumer of the existing canonical signal so the
header line and the workspace's detailed Trust strip stay aligned.
The same page-header recency line also reads
- `PatrolRecencyPresentation.resourcesChecked` — populated by
+ `PatrolRecencyPresentation.resourcesCheckedLabel` — derived by
`getPatrolRecencyPresentation` from
- `PatrolRunRecord.resources_checked` on the latest completed run —
+ `PatrolRunRecord.resources_checked` and the latest completed run outcome —
so the operator sees coverage alongside recency without needing a
- new API surface, and the field stays optional (omitted on zero) to
- keep degenerate runs from rendering an alarm-shaped "verified 0"
+ new API surface. The label stays optional when coverage is zero, says
+ verified only for successful full patrols, and uses neutral checked wording
+ for errored full patrols or scoped activity.
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/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 9bace80cab..c6dab654f2 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1299,11 +1299,11 @@ line is the entry-point summary so operators see active, regressed,
and verified-fix counts before scrolling into the workspace tabs.
The recency line beside the header actions also renders coverage
alongside time when the canonical `getPatrolRecencyPresentation` helper
-returns `resourcesChecked` from the latest completed run. Render code
-must gate on `<Show when={recency().resourcesChecked}>` (truthy) so
-zero-coverage runs don't surface a misleading "verified 0 resources"
-line; the truthy gate also means the absence of the helper field
-gracefully omits the coverage span without code changes.
+returns `resourcesCheckedLabel` from the latest completed run. Render code
+must gate on `<Show when={recency().resourcesCheckedLabel}>` (truthy) so
+zero-coverage runs do not surface a misleading coverage phrase, failed or
+scoped runs use neutral checked wording, and only successful full patrols read
+as verified.
`frontend-modern/src/utils/discoveryPresentation.ts` owns resource discovery
command guidance targets. Discovery surfaces that need to tell operators where
@@ -2497,7 +2497,9 @@ sufficient as the only explanation path.
That same shell rule also owns Patrol recency labels. Shared Patrol header and
status-shell surfaces must keep `Last full patrol` tied only to the full-sweep
transport fact and use `Last activity` for scoped or verification work instead
-of collapsing both timestamps back into a generic `Last run` label.
+of collapsing both timestamps back into a generic `Last run` label. Coverage
+phrases on those recency surfaces must come from the Patrol recency presenter
+instead of hardcoding verified wording in the shell.
That same Patrol shell should make scoped trigger policy legible without
another navigation step. `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`
should present alert-triggered and anomaly-triggered Patrol toggles as distinct
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index b651f5dd3a..cb39652fce 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -88,6 +88,9 @@ Patrol-specific presentation helpers.
from the same current findings state. Patrol-owned runtime issues must stay
distinct from infrastructure findings in assessment copy rather than being
described as infrastructure warning findings about Patrol itself.
+ Recency coverage copy must also come from the shared presentation helper:
+ use verified wording only for successful full patrols, and use neutral
+ checked wording for failed full patrols or scoped activity.
3. Update this contract whenever a new Patrol-specific page, store, helper, or presentation component becomes canonical runtime surface area
4. Keep retired hosted-model and trial-like Patrol acquisition copy out of the
normal self-hosted GA app. Patrol may parse legacy transport fields, but
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
index b464fd4f50..1191a9bc38 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
@@ -88,12 +88,9 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
compact: true,
emptyText: 'Never',
})}
- <Show when={recency().resourcesChecked}>
+ <Show when={recency().resourcesCheckedLabel}>
{' '}
- <span class="text-muted">
- — verified {recency().resourcesChecked} resource
- {recency().resourcesChecked === 1 ? '' : 's'}
- </span>
+ <span class="text-muted">— {recency().resourcesCheckedLabel}</span>
</Show>
</span>
<Show when={state.patrolStatus()?.next_patrol_at}>
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
index 2b26fd20f4..e6b258f4f0 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
@@ -1727,20 +1727,20 @@ describe('patrolInvestigationContextModel', () => {
});
describe('Patrol page header IA framing', () => {
- it('surfaces verified-resource coverage on the recency line in the page header', () => {
+ it('surfaces presenter-owned coverage wording on the recency line in the page header', () => {
// Third wedge of the Patrol page IA reframe. The recency line tells the
// operator when Pulse last ran; the coverage signal tells them what it
// covered. Pin the wiring so the recency render reads
- // resourcesChecked from getPatrolRecencyPresentation and gates on a
- // truthy <Show> so zero-coverage runs don't render "verified 0
- // resources" as an alarm.
+ // resourcesCheckedLabel from getPatrolRecencyPresentation and gates on a
+ // truthy <Show> so zero-coverage runs do not render a coverage phrase,
+ // and failed or scoped runs do not get hardcoded "verified" wording.
const headerSource = readFileSync(
resolve(__dirname, '..', 'PatrolIntelligenceHeader.tsx'),
'utf-8',
);
- expect(headerSource).toContain('recency().resourcesChecked');
- expect(headerSource).toContain('Show when={recency().resourcesChecked}');
- expect(headerSource).toContain('verified ');
+ expect(headerSource).toContain('recency().resourcesCheckedLabel');
+ expect(headerSource).toContain('Show when={recency().resourcesCheckedLabel}');
+ expect(headerSource).not.toContain('verified {recency().resourcesChecked}');
});
it('hoists a trust-at-a-glance summary into the page header above the runtime row', () => {
diff --git a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
index 9f409b006c..68e459f325 100644
--- a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
@@ -838,6 +838,7 @@ describe('getPatrolSummaryPresentation', () => {
label: 'Last activity',
timestamp: '2026-03-12T09:59:00Z',
resourcesChecked: 1,
+ resourcesCheckedLabel: 'checked 1 resource',
});
});
@@ -879,6 +880,49 @@ describe('getPatrolSummaryPresentation', () => {
label: 'Last full patrol',
timestamp: '2026-03-12T09:57:00Z',
resourcesChecked: 58,
+ resourcesCheckedLabel: 'verified 58 resources',
+ });
+ });
+
+ it('uses checked coverage wording when a full patrol ends with errors', () => {
+ expect(
+ getPatrolRecencyPresentation({
+ runs: [
+ {
+ id: 'run-error',
+ 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,
+ truenas_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,
+ },
+ ] as never,
+ }),
+ ).toEqual({
+ label: 'Last full patrol',
+ timestamp: '2026-03-12T09:57:00Z',
+ resourcesChecked: 58,
+ resourcesCheckedLabel: 'checked 58 resources',
});
});
diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.ts
index a6f40a5131..994ca09bbc 100644
--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts
+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts
@@ -91,13 +91,12 @@ export interface PatrolVerificationPresentation {
export interface PatrolRecencyPresentation {
label: string;
timestamp?: string;
- // resourcesChecked is the coverage signal for the most recent completed
- // run — populated from `PatrolRunRecord.resources_checked` when a run is
- // available. Lets the page header read "Last full patrol: 3m ago —
- // verified 47 resources", giving operators temporal AND coverage signal
- // in one line. Stays optional because legacy fall-back paths
- // (lastPatrolAt / lastActivityAt without a run record) carry no count.
+ // resourcesChecked is the raw coverage signal for the most recent
+ // completed run. resourcesCheckedLabel is the operator-facing phrase; it
+ // says "verified" only for successful full patrols and uses "checked" for
+ // limited or errored activity.
resourcesChecked?: number;
+ resourcesCheckedLabel?: string;
}
type PatrolAssessmentFinding = Pick<
@@ -571,6 +570,16 @@ function hasRunErrors(run: PatrolRunRecord): boolean {
);
}
+function formatRecencyResourcesCheckedLabel(run: PatrolRunRecord): string | undefined {
+ const resourcesChecked = run.resources_checked || 0;
+ if (resourcesChecked <= 0) {
+ return undefined;
+ }
+
+ const verb = isFullPatrolRun(run) && !hasRunErrors(run) ? 'verified' : 'checked';
+ return `${verb} ${resourcesChecked} resource${resourcesChecked === 1 ? '' : 's'}`;
+}
+
export function getPatrolAssessmentPresentation(args: {
overallHealth?: IntelligenceHealthScore;
runtimeState?: PatrolRuntimeState;
@@ -765,10 +774,12 @@ export function getPatrolRecencyPresentation(args: {
const latestCompletedRun = (args.runs ?? []).find((run) => isCompletedPatrolRun(run));
if (latestCompletedRun?.completed_at) {
const resourcesChecked = latestCompletedRun.resources_checked || 0;
+ const resourcesCheckedLabel = formatRecencyResourcesCheckedLabel(latestCompletedRun);
return {
label: isFullPatrolRun(latestCompletedRun) ? 'Last full patrol' : 'Last activity',
timestamp: latestCompletedRun.completed_at,
resourcesChecked: resourcesChecked > 0 ? resourcesChecked : undefined,
+ resourcesCheckedLabel,
};
}