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 trust-at-a-glance on the Patrol page header

rcourtmanbb93279624b9
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 7ba091103a..bb198695cc 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -1058,7 +1058,14 @@ the canonical monitored-system blocked payload.
`getPatrolPageHeaderMeta()` rather than carrying inline copy, so the
operator-facing framing of what Patrol does (proactive
investigation, evidence capture, governed action) stays tied to the
- contract instead of drifting between hover and inline
+ contract instead of drifting between hover and inline.
+ The same Patrol page header also surfaces a compact trust summary
+ above the runtime status row, reading
+ `state.patrolStatus()?.trust` (the `FindingsTrustSummary` block
+ already plumbed through the patrol status payload). It must not
+ introduce a new fetch path or duplicate data plumbing — the strip is
+ a render-only consumer of the existing canonical signal so the
+ header line and the workspace's detailed Trust strip stay aligned
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 488c81c169..6ec724a529 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1254,6 +1254,14 @@ tooltip on `PatrolIntelligenceHeader.tsx` must read from
than carrying an inline copy, so hover and inline never drift apart on
what Patrol actually does (proactive investigation, evidence capture,
governed action under operator approval).
+The same `PatrolIntelligenceHeader.tsx` shell also renders a compact
+trust-at-a-glance summary directly under the page title (a
+render-only consumer of `state.patrolStatus()?.trust`), gated on at
+least one non-zero trust signal so fresh installs render no header
+strip. The detailed breakdown stays in
+`PatrolIntelligenceWorkspace.tsx` for the canonical view; the header
+line is the entry-point summary so operators see active, regressed,
+and verified-fix counts before scrolling into the workspace tabs.
`frontend-modern/src/utils/discoveryPresentation.ts` owns resource discovery
command guidance targets. Discovery surfaces that need to tell operators where
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 65b54a0236..bb4f90bd24 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -1144,3 +1144,12 @@ explanation + governed action). The tooltip on the page-header title
must read the same string from the canonical helper rather than
maintaining a parallel copy, so hover and inline never tell different
stories about what Patrol does.
+The same Patrol page header must also surface a compact trust summary
+("N active · M regressed · K fixes verified") read from
+`state.patrolStatus()?.trust` immediately under the page title, gated
+on at least one non-zero signal so a fresh install doesn't render an
+empty header strip. The detailed Trust strip in
+`PatrolIntelligenceWorkspace.tsx` stays as the canonical breakdown for
+operators reviewing findings; the header line is the
+trust-at-a-glance entry point that names what Patrol's loop has
+produced before the operator scrolls into the workspace tabs.
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
index d44cac904c..e5d6a34de3 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
@@ -133,6 +133,55 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
}
/>
+ {/* Page-header trust summary — a compact one-liner of FindingsTrustSummary
+ shown directly under the page title so the operator sees the trust
+ loop's own state ("3 active, 1 regressed, 5 fixes verified")
+ before they ever scroll into the workspace. The detailed Trust
+ strip in PatrolIntelligenceWorkspace stays as the canonical
+ breakdown for when the operator is reviewing findings. Visibility
+ is gated on at least one non-zero signal so a fresh install
+ doesn't render an empty header line. */}
+ <Show
+ when={(() => {
+ const trust = state.patrolStatus()?.trust;
+ if (!trust) return false;
+ return (
+ trust.currently_active > 0 ||
+ trust.fix_verified > 0 ||
+ trust.regressed_at_least_once > 0
+ );
+ })()}
+ >
+ {(() => {
+ const trust = state.patrolStatus()!.trust!;
+ return (
+ <div
+ class="flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted"
+ aria-label="Patrol trust summary header"
+ >
+ <Show when={trust.currently_active > 0}>
+ <span class="inline-flex items-center gap-1">
+ <span class="font-semibold text-base-content">{trust.currently_active}</span>
+ <span>active</span>
+ </span>
+ </Show>
+ <Show when={trust.regressed_at_least_once > 0}>
+ <span class="inline-flex items-center gap-1 text-amber-700 dark:text-amber-300">
+ <span class="font-semibold">{trust.regressed_at_least_once}</span>
+ <span>regressed</span>
+ </span>
+ </Show>
+ <Show when={trust.fix_verified > 0}>
+ <span class="inline-flex items-center gap-1 text-emerald-700 dark:text-emerald-300">
+ <span class="font-semibold">{trust.fix_verified}</span>
+ <span>fix{trust.fix_verified === 1 ? '' : 'es'} verified</span>
+ </span>
+ </Show>
+ </div>
+ );
+ })()}
+ </Show>
+
<div class="rounded-md border border-border bg-surface px-4 py-3">
<div class="flex flex-wrap items-center gap-3">
<div class="flex items-center gap-2 bg-surface-hover px-3 py-1.5 rounded-md border border-border">
diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.test.ts b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.test.ts
index 359105fd31..5ebc5cfa83 100644
--- a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.test.ts
@@ -1,7 +1,14 @@
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
import { getPatrolConfigurationFailureInlineDetails } from '../PatrolIntelligenceHeader';
+const headerSource = readFileSync(
+ resolve(__dirname, '..', 'PatrolIntelligenceHeader.tsx'),
+ 'utf-8',
+);
+
describe('PatrolIntelligenceHeader', () => {
it('keeps Patrol configuration readiness context visible inline', () => {
expect(
@@ -34,4 +41,22 @@ describe('PatrolIntelligenceHeader', () => {
}),
).toEqual(['patrol_autonomy_pro_required · license_required']);
});
+
+ it('renders a compact trust summary in the page header above the runtime status row', () => {
+ // Second wedge of the Patrol page IA reframe. The detailed Trust strip
+ // in PatrolIntelligenceWorkspace stays as the canonical breakdown, but
+ // operators should see "X active, Y regressed, Z fixes verified"
+ // immediately under the page title without scrolling into the
+ // workspace tabs. Pin the wiring so this trust-at-a-glance line cannot
+ // silently regress to an empty header during refactors.
+ expect(headerSource).toContain('aria-label="Patrol trust summary header"');
+ expect(headerSource).toContain('state.patrolStatus()?.trust');
+ expect(headerSource).toContain('trust.currently_active');
+ expect(headerSource).toContain('trust.regressed_at_least_once');
+ expect(headerSource).toContain('trust.fix_verified');
+ // Visibility must gate on at least one non-zero signal so fresh installs
+ // don't render an empty header strip.
+ expect(headerSource).toContain('trust.currently_active > 0');
+ expect(headerSource).toContain('trust.fix_verified > 0');
+ });
});
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
index a15628314a..e8d3b9dece 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
@@ -1,3 +1,5 @@
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
import type { RemediationPlan } from '@/api/ai';
import type { PatrolRunRecord } from '@/api/patrol';
@@ -1627,6 +1629,26 @@ describe('patrolInvestigationContextModel', () => {
});
describe('Patrol page header IA framing', () => {
+ it('hoists a trust-at-a-glance summary into the page header above the runtime row', () => {
+ // The compact trust summary on the Patrol page header is the second
+ // wedge of the IA reframe (the first being PATROL_PAGE_DESCRIPTION).
+ // It must read from the same FindingsTrustSummary block plumbed
+ // through state.patrolStatus()?.trust as the workspace strip — no
+ // duplicate data path — and surface the three highest-signal
+ // counts (active, regressed, fixes verified) so operators see the
+ // trust loop's own state before scrolling into the workspace tabs.
+ const headerSource = readFileSync(
+ resolve(__dirname, '..', 'PatrolIntelligenceHeader.tsx'),
+ 'utf-8',
+ );
+ expect(headerSource).toContain('aria-label="Patrol trust summary header"');
+ expect(headerSource).toContain('state.patrolStatus()?.trust');
+ expect(headerSource).toContain('trust.currently_active');
+ expect(headerSource).toContain('trust.regressed_at_least_once');
+ expect(headerSource).toContain('trust.fix_verified');
+ expect(headerSource).toContain('trust.currently_active > 0');
+ });
+
it('names the proactive trust loop on the canonical Patrol surface', async () => {
// The Patrol page header is the most visible piece of operator-facing
// copy on the canonical Patrol surface. The IA reframe replaces the