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.

Remove test-only Patrol context summary helpers

rcourtman6a5b7d04c084
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 48b93c4c1a..69a9617c2b 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -6851,13 +6851,11 @@ The related-resource correlation section now also comes from the shared
correlation formatter in `internal/ai/correlation`, so resource chat and
incident prompts reuse the same learned-edge wording instead of rebuilding a
second patrol-local bullet format.
-The Patrol intelligence page now also fetches the learned correlation list
-from the canonical AI correlations endpoint, so the global AI surface and the
-resource drawer both expose the same learned edge evidence instead of only
-showing a correlation count. The same page and drawer now render that list
-through the shared `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx`
-card, so the learned-correlation layout and edge wording stay aligned across
-both surfaces. That shared card also owns the correlation ordering and
+The Patrol intelligence page renders no learned correlations. The resource
+drawer renders its resource-scoped learned edges through the shared
+`frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx`
+card, so any surface that shows learned correlations keeps the same layout and
+edge wording. That shared card also owns the correlation ordering and
truncation rule, so callers pass raw learned edges instead of page-specific
top-N slices.
Assistant finding handoffs now also receive a model-only finding briefing
@@ -6881,10 +6879,13 @@ and related context are policy-sanitized by the chat handoff runtime before
prompt injection, so governed resource names, IDs, aliases, nodes, paths, and
addresses are redacted or represented through the canonical AI-safe summary
instead of leaking through product prose.
-The same page and drawer now also render their recent-change timeline through
-the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx`
-card, so the canonical recent-change layout and relative-time wording stay
-aligned across both surfaces instead of being rebuilt as page-local feeds.
+The Patrol page renders no recent-change timeline. The resource drawer renders
+its latest canonical change through the shared
+`frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx`
+card, and its `Change history` list through the shared
+`frontend-modern/src/utils/resourceChangePresentation.ts` helpers, so the
+canonical recent-change wording stays aligned instead of being rebuilt per
+surface.
The Patrol intelligence seed context now also prefers the canonical
unified-resource timeline before falling back to the patrol-local change
detector, so deterministic patrol context and resource detail context share
@@ -6922,8 +6923,9 @@ silently dropping the summary block.
The per-resource intelligence payload returned from
`/api/ai/intelligence?resource_id=...` now carries recent changes,
dependencies, dependents, correlations, and knowledge only; policy posture
-stays on the system-wide intelligence summary and the Patrol governance card
-instead of riding the resource-detail payload.
+stays on the system-wide intelligence summary instead of riding the
+resource-detail payload, and no frontend surface currently renders those
+posture counts.
That same resource-intelligence payload also carries dependency and
dependent correlation context from unified-resource correlations, so the drawer
can show canonical correlation relationships without reconstructing them from the
@@ -6982,10 +6984,9 @@ slice that the prompt context uses.
The system-wide `/api/ai/intelligence` summary should also surface the same
canonical recent-change slice, alongside the count, so the aggregate payload
and the prompt context stay aligned on the same shared timeline source.
-The frontend Patrol intelligence page now also consumes that canonical
-summary payload directly through the shared AI client and store, so the
-visible summary card stays aligned with the same recent-change slice that the
-runtime and API contracts expose.
+The frontend Patrol page reads that canonical summary payload through the
+shared AI client and store, but only for its overall health; it renders no
+summary card and no recent-change slice.
The Patrol runtime now also exports a canonical `runtime_state` alongside
`blocked_reason` in the Patrol status payload, so provider-availability and any
legacy managed-credit block conditions remain part of the governed runtime
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 6b204396df..e16912d9dc 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -3133,13 +3133,12 @@ a new API state machine, queue contract, or verification-accounting field.
strip after current work has been ruled out. Latest coverage may appear only
as bounded empty-state copy inside the current-findings surface, not as a
separate calm-day posture list
- while keeping the learning counters backend-only coverage, so Patrol keeps health and findings primary and renders timeline, correlation, and policy-posture data as selected-item investigation context rather than as a separate headline product metric
+ while keeping the learning counters backend-only coverage, so Patrol keeps health and findings primary and does not render timeline, correlation, or policy-posture data as a headline product metric
and that secondary investigation context remains explanatory API evidence,
- not a default workspace mode: the Patrol page may expand recent-change,
- correlation, and policy-posture details only for an active Patrol finding or
- an explicitly selected run record, and must not surface those backend
- context payloads as a page-level forensic block from degraded summary health
- alone
+ not a Patrol workspace mode: the Patrol page renders no recent-change,
+ correlation, or policy-posture details, whether or not a finding is active
+ or a run record is selected, and must not surface those backend context
+ payloads as a page-level forensic block
and the Patrol status presentation boundary, so trigger/scheduling status
from Patrol status APIs stays in the header/control surface instead of being
repeated as default status chrome, watch-only presentation says Patrol checks
@@ -3291,15 +3290,15 @@ a new API state machine, queue contract, or verification-accounting field.
workflow; Assistant handoffs remain contextual selected-finding actions, not
the canonical API completion step for Patrol current work.
and the canonical alert-triggered Patrol enqueue path in `internal/api/router.go`, so alert-fired Patrol work flows through the unified alert bridge and trigger manager instead of being duplicated by monitor callback wiring
- and 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 loops
- and 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 surfaces
- and the Patrol-owned `Details` context selector, so same-state recent-change
- records from the canonical AI payload are normalized into changed-substate
- wording before Patrol renders them or attaches them to Assistant, avoiding
+ and the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` card, so a compact recent-change summary renders through one governed frontend card instead of a page-local list loop; the resource drawer's full `Change history` timeline is a separate list built on the shared `frontend-modern/src/utils/resourceChangePresentation.ts` helpers
+ and the shared `frontend-modern/src/utils/resourceChangePresentation.ts` formatter used by the resource drawer, so canonical change wording does not drift across surfaces
+ and the Patrol supporting-context boundary, so the Patrol page keeps
+ recent-change payloads off the page with no `Details` context selector or
+ default forensic block, and any Patrol surface that does render same-state
+ recent-change records from the canonical AI payload or attach them to
+ Assistant normalizes them into changed-substate wording first, avoiding
no-op operator copy such as `online` to `online` while preserving the
- backend-owned timeline event, and so those context payloads stay behind a
- compact operator-opened affordance rather than creating a default forensic
- block on the Patrol page
+ backend-owned timeline event
and 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 source
and the canonical policy-posture snapshot derived from unified resources, so sensitivity, routing, and redaction counts stay owned by the same AI summary contract instead of being reconstructed as a page-local governance rollup
and the resource-intelligence payload carried by the drawer AI card, so the resource-detail surface stays on one canonical intelligence contract instead of introducing a separate detail endpoint
@@ -3308,7 +3307,7 @@ a new API state machine, queue contract, or verification-accounting field.
and the Patrol page refresh lifecycle in `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, so slow or stalled secondary reads from that shared dashboard-load bundle may continue resolving in the background while the operator-facing Patrol refresh control remains generation-aware, timeout-bounded, and reusable once Patrol findings and status are already visible
and the Patrol header support drawer in `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`, so API-owned Patrol status and trigger facts can feed a secondary Schedule & model surface without turning provider model, schedule, trigger tuning, or background-only runtime-policy pauses into the primary Patrol control decision
and any frontend presentation of the AI summary's `policy_posture` counts, which must render that canonical snapshot through one shared component instead of page-local posture loops; no frontend surface renders those counts today, and the resource drawer stays on per-resource policy lines
- and the dedicated `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts` owner, so recent-change, learned-correlation, and policy-coverage summary text stays derived from the canonical AI payload in one place instead of as hook-local count and pluralization logic
+ and the dedicated `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts` owner, so any Patrol recent-change, learned-correlation, or policy-coverage summary text is derived from the canonical AI payload in that one place instead of as hook-local count and pluralization logic; Patrol renders no such summary today
and the Watch-only forward-path handoffs owned by `frontend-modern/src/features/patrol/patrolControlPresentation.ts` together with the Actions inbox empty-state read of `GET /api/ai/patrol/autonomy`, so finding-level and inbox-level mode guidance consumes the canonical Patrol autonomy read/save contract through the Patrol state hook (`handleAutonomyChange`) instead of introducing a second mode mutation path or a page-local autonomy dialect
and that same Patrol investigation-context owner, so the current Patrol
assessment summary may open Assistant with bounded model-only assessment,
@@ -3354,7 +3353,7 @@ a new API state machine, queue contract, or verification-accounting field.
and the dedicated `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` owner, so recent-change counts and governed policy-posture fallbacks normalize once at the shared store boundary instead of as Patrol-hook-local payload repair
and the shared `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` card, so learned correlations and correlation context stay rendered through one governed frontend card instead of separate page-local list loops
and the same shared correlation card's ordering and truncation rule, so callers pass raw correlations instead of encoding their own top-N sort behavior
- and the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` and `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` cards' infrastructure resource-link default, so the Patrol page, resource drawer, and problem-resource dashboard panels inherit the canonical resource-filter path construction instead of rebuilding infrastructure URLs inline
+ and the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` and `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` cards' optional `buildResourceHref` input, so a surface that needs resource-filter links passes them into the shared card instead of rebuilding infrastructure URLs inline; the cards carry no link default since the cross-resource drilldown links were retired, and render resource labels as plain text
and the Patrol runtime-remediation destination shared with the AI settings endpoint, so summary actions, run-history runtime-failure actions, and runtime-finding actions may reuse the governed provider-settings route while still presenting that destination in Patrol as provider configuration instead of generic `AI Settings` copy
and the Patrol route-shell destination itself, so the thin page shell at `frontend-modern/src/pages/AIIntelligence.tsx` may continue to bridge the shared AI-runtime payload boundary while exposing `/patrol` as the canonical product route and keeping retired `/ai` browser entry points unregistered
and the Patrol route-shell accessibility boundary, so brand icons in `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx` stay decorative when the same heading already exposes visible Patrol text, preventing duplicate accessible names such as `Pulse Patrol Patrol`
@@ -3495,9 +3494,9 @@ a new API state machine, queue contract, or verification-accounting field.
score, current risk facts, verification facts, and action state needed for a
compact operator summary, but it must not imply a hero, card, duplicate
verdict layout, or expanded assessment panel. Normal Patrol page consumers
- should keep explanatory assessment, verification, activity, and supporting
- context in the owning Findings, Runs, and `Details` surfaces rather
- than re-expanding the primary assessment strip.
+ should keep explanatory assessment, verification, and activity context in
+ the owning Findings and Runs surfaces rather than re-expanding the primary
+ assessment strip.
18. Keep Pulse Mobile relay credential minting and permission ownership on backend ownership: `internal/api/router_routes_auth_security.go`, `internal/api/security_tokens.go`, `internal/api/auth.go`, `internal/api/relay_mobile_capability.go`, `internal/api/router_routes_ai_relay.go`, and `frontend-modern/src/api/security.ts` may expose the canonical mobile runtime token creator and governed route gates, but browser callers must only consume that route and must not define the mobile runtime scope, compatibility gate list, route inventory, or token-purpose metadata locally.
19. Keep hosted tenant browser-session precedence on the shared auth boundary: `internal/api/auth.go`, `internal/api/contract_test.go`, and hosted tenant callers must treat a valid `pulse_session` as authoritative before any API-only token fallback or no-local-auth anonymous fallback, so cloud handoff can continue into protected hosted routes without flattening the operator back to `anonymous` or forcing a browser session through bearer-token-only mode after the tenant has minted API tokens.
That same shared auth boundary also owns hosted handoff authorization. `internal/api/cloud_handoff.go`,
@@ -4303,10 +4302,10 @@ the authoritative analysis outcome.
and the main Patrol page composition boundary, so once that governed
secondary area exists inside the Current issues and history workspace the same payloads must not
also drive a second page-level status strip elsewhere on the route
- and the Patrol `Details` disclosure rule, so recent changes,
+ and the Patrol supporting-context rule, so recent changes,
learned correlations, and policy coverage stay backend and Assistant context
- instead of advertising a parallel Patrol workflow on otherwise healthy fully
- verified states or degraded summary health alone. First-party Patrol page
+ instead of advertising a parallel Patrol workflow in any page state, healthy
+ or degraded. First-party Patrol page
consumers must not turn those payloads into a generic Details/supporting
context panel; selected finding and run records remain the source of truth for
what the operator can inspect or do next.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index dad8ba31f5..cb012165c1 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -3073,10 +3073,10 @@ Agent`), with the plain-language source phrase available through accessible
`frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`,
`frontend-modern/src/components/patrol/RunHistoryEntry.tsx`, and
`frontend-modern/src/utils/patrolRuntimeActions.ts` must keep
- Patrol assessment, verification, and findings primary; surface recent
- changes, learned correlations, and policy coverage only as backend,
- Assistant, selected-finding, or selected-run context when investigation
- makes that evidence relevant; and use Patrol/provider wording for the shared provider settings,
+ Patrol assessment, verification, and findings primary; keep recent
+ changes, learned correlations, and policy coverage out of Patrol-owned
+ shells as backend or Assistant context, with no selected-finding or
+ selected-run page section for them; and use Patrol/provider wording for the shared provider settings,
provider model, and provider circuit-breaker affordances instead of
generic AI labels inside Patrol-owned shells. The shared app shell in
`frontend-modern/src/App.tsx` and `frontend-modern/src/AppLayout.tsx` must
@@ -3091,9 +3091,10 @@ Agent`), with the plain-language source phrase available through accessible
Assistant context rather than a default page section. Patrol initial data
refresh failures must stay inside the Patrol feature shell as one compact
stale-data retry banner; they must not replace the route with Suspense,
- blank loading, raw transport errors, or page-local diagnostic panels. The Patrol
- investigation-context owner normalizes same-state recent-change records into
- changed-substate wording before Assistant handoff renders them. The same shared feature-shell
+ blank loading, raw transport errors, or page-local diagnostic panels. If a
+ Patrol Assistant handoff attaches recent-change records, the Patrol
+ investigation-context owner must first normalize same-state records into
+ changed-substate wording. The same shared feature-shell
boundary owns the
commercial-facing Patrol capability language: autonomy segmented controls
and run-history/result labels must present the operator-facing policy levels
@@ -4912,8 +4913,8 @@ supporting metrics under that strip must stay metric-oriented and must not
repeat assessment or verification labels as a second compact verdict row.
The collapsed Patrol assessment strip itself must remain a compact readout
rather than a headline-plus-paragraph block; explanatory assessment and
-recommendation copy belongs in the owning Findings, Runs, `Details`,
-or Assistant chat surfaces rather than a normal-path summary details expansion.
+recommendation copy belongs in the owning Findings, Runs, or Assistant chat
+surfaces rather than a normal-path summary details expansion.
That readout should lead with current operator state and score rather than
mixing a reassuring grade label with issue-state copy in the same line.
That same summary shell should also keep the shared Pulse surface neutral:
@@ -6816,8 +6817,8 @@ or polling lifecycle. The Patrol feature is the current reference shape:
feature shell, reads its active workspace view from the route through
`patrolWorkspaceRouting.ts` rather than holding it in component state, `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`
owns the runtime state machine, `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`
-owns the pure investigation-context summary and Patrol-to-Assistant operator
-briefing derivation, including the rule that active findings, pending
+owns the pure Patrol-to-Assistant handoff and operator briefing derivation,
+including the rule that active findings, pending
approvals, and governed action references outrank secondary coverage caveats
when building the Assistant prompt, action label, and safety note,
`frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` owns canonical AI
@@ -6894,17 +6895,11 @@ parallel page-level status strip above the current-work workspace.
That same composition rule applies to the workspace: the default path should
move directly into findings and run history instead of repeating runtime
context through a second pre-tab status strip.
-`Details` follows that same composition rule. Recent changes,
-learned correlations, and policy coverage belong behind an explicitly secondary
-supporting-context affordance that only appears when Patrol has active findings
-or a selected run that needs explanation; healthy fully verified Patrol states
-and degraded summary health by themselves must not advertise that supporting
-evidence as a peer workflow. The default workspace may show the compact
-`Details` control, but the full panel must render only after the operator
-opens it. When that disclosure expands, the workspace must explicitly label the
-selected finding or run as Patrol's record and frame the supporting cards as
-explanatory context rather than as a fresh Patrol result or raw evidence
-console.
+Supporting context follows that same composition rule. Recent changes,
+learned correlations, and policy coverage stay off the Patrol workspace: it has
+no `Details` control or supporting-context panel for them in any state, with or
+without active findings or a selected run, so that evidence never competes
+with current work as a peer workflow or reads as a fresh Patrol result.
Selected-run history should also suppress generic findings filter chrome and
read as a Patrol run record. Missing legacy `finding_ids` remains an internal
fail-closed scoping condition, but the visible caveat should say the finding
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 4756dc70fd..5cb104ab00 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -514,13 +514,11 @@ attention`, `approval needed`, `outcome verified`, `no active work`) instead
through an explicit history review affordance, keep the ledger visually
bounded, and return the user to the findings snapshot when a historical run is
selected. Broad supporting context such as recent changes, correlations, and
- policy coverage may be offered only as a compact `Details` affordance
- when there is an active Patrol finding or an explicitly selected history
- snapshot to explain. The full `Details` panel must render only
- after that affordance is opened; its copy must tell operators it explains
- Patrol's recorded finding or run state and must not present the data as a
- separate raw evidence console. Degraded health or historical recurrence alone
- must not surface a page-level forensic context block.
+ policy coverage stays off the Patrol page under the supporting-context rule
+ above, even when a finding is active or a history snapshot is selected; the
+ page has no `Details` context affordance for it. Degraded health or
+ historical recurrence alone must not surface a page-level forensic context
+ block either.
The default Patrol surface must stay simple: the header, control selector,
and Open work workspace own the ordinary operator state. Patrol must not
render a separate always-visible status/activity/health strip just to prove
@@ -1218,7 +1216,7 @@ fix`, or `Explain` based on current finding state), while secondary
`Health A` with issue-state copy such as `Issues detected` in the collapsed
line. Do not add a normal-path assessment details expansion: assessment
explanation, verification detail, activity mix, and supporting metrics belong in the
- owning Findings, Runs, or `Details` surfaces
+ owning Findings or Runs surfaces
instead of reopening the compact strip into a sparse status panel.
### Canonical operational attention workbench
@@ -1883,21 +1881,16 @@ activity mix in check language instead of asking operators to reconcile a
`Recently verified` headline with a busy Patrol strip elsewhere on the page.
Fix-verification checks belong to that same explanation layer as follow-up
checks, not as evidence of a fresh full-estate sweep.
-The same hierarchy applies to the `Details` supporting context.
-Correlations, recent changes, and policy posture are secondary explanation for
-deeper investigation, so the default workspace may expose only the compact
-context affordance near the findings/history controls. When that disclosure is
-expanded, the page must render the panel as the immediate next workspace content
-and explicitly tell operators that the selected finding or run record remains
-the source of truth, while nearby activity, related patterns, and inspection
-boundaries are context Patrol considered and do not change the finding or count
-as a fresh Patrol run.
-When Patrol is healthy and fully verified, that supporting-context disclosure
-should stay out of the main page flow instead of advertising a second parallel
-Patrol workflow with nothing active to explain.
-That same operational context belongs behind the same secondary disclosure as
-verification, not as a default full-width strip that competes with the findings
-workspace. The workspace and shared
+The same hierarchy keeps correlations, recent changes, and policy posture off
+the Patrol page. They are secondary explanation for deeper investigation, so
+the workspace offers no `Details` supporting-context disclosure for them in any
+state, healthy or not: the selected finding or run record remains the Patrol
+source of truth, and that nearby evidence must not return as a second parallel
+Patrol workflow beside the findings and history controls.
+Patrol's run and trigger context, by contrast, belongs in the secondary
+`Finding options and history` workspace beside the findings and run history,
+not as a default full-width strip that competes with the current issues. The
+workspace and shared
`frontend-modern/src/utils/patrolRunPresentation.ts` helpers may carry latest
run kind/result, scoped-trigger state, and circuit-breaker warnings as factual
support when the user opens the relevant context or when the page must surface
@@ -2116,11 +2109,10 @@ The Patrol seed context and AI runtime prompt path now also share the same
correlation summary formatter from `internal/ai/correlation`, so learned-edge
wording and confidence/count annotations stay canonical across the prompt
surface instead of being rebuilt in each caller.
-The Patrol page also now renders the canonical intelligence summary card
-through the governed AI client and store, so the visible page summary and the
-resource/timeline sections stay aligned on the same shared backend slice.
-That same summary card now keeps recent changes and learned correlations
-primary while leaving the broader learning counters as backend coverage, so
+The Patrol page reads the canonical intelligence summary through the governed
+AI client and store but renders no intelligence summary card: it passes that
+summary's overall health to the Patrol findings panel, while recent changes,
+learned correlations, and the broader learning counters stay off the page, so
the page does not present telemetry-style counts as a headline intelligence
story.
The shared AI summary payload also carries the canonical data-governance
@@ -2132,20 +2124,18 @@ correlation context plus canonical correlation evidence through the
resource-intelligence payload, so the resource-level AI card can surface
relationship reachability and learned edge patterns directly from the AI
contract instead of inventing a second correlation summary.
-The Patrol intelligence page now also consumes the learned correlation list
-from the canonical AI correlations endpoint through the shared
-`frontend-modern/src/stores/aiIntelligence.ts` store, so the global summary
-and the resource drawer both reflect the same learned edge evidence instead
-of each page fetching its own copy. Both surfaces now render that evidence
-through the shared `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx`
-card, so the correlation layout stays governed by one component instead of
-two page-local card implementations. That shared card also owns the
-correlation ordering and truncation rule, so the page and drawer hand it raw
-correlation lists instead of slicing or re-sorting them locally.
-The same page and drawer now also share the canonical
+The Patrol page renders no learned correlations or recent changes. The
+resource drawer renders its resource-scoped correlations from the
+resource-intelligence payload through the shared
+`frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx`
+card and its latest canonical change through the shared
`frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx`
-card for recent changes, so the timeline layout and relative-time wording
-stay governed by one frontend feed instead of separate page-local loops.
+card. Those cards own correlation ordering and truncation and the change
+summary's layout and relative-time wording, so a caller of either card, Patrol
+included, hands it raw lists instead of slicing or re-sorting them first. The
+drawer's full `Change history` timeline is a separate list that sorts and
+renders its own rows through the shared `resourceChangePresentation.ts`
+helpers.
Patrol trial-entry surfaces are retired for normal self-hosted v6 GA.
`ApprovalSection.tsx` and `usePatrolIntelligenceState.ts` may link to explicit
plan, activation, recovery, support, or hosted handoff surfaces where
@@ -2194,26 +2184,25 @@ inline.
The shared
`frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` and
`frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx`
-cards now own the canonical Infrastructure resource-link default, so the
-Patrol page and resource drawer inherit resource-filter href construction
-through the shared summary cards instead of rebuilding local wrappers in each
-surface.
+cards carry no resource-link default since the cross-resource drilldown links
+were retired, so they render resource labels as plain text. A surface that
+needs resource links passes `buildResourceHref` to the shared card instead of
+rebuilding a local card wrapper.
The Patrol intelligence page renders no data-governance posture counts: they
left the page with its supporting-context block, and the shared posture card
that rendered them has been removed. If Patrol shows posture counts again, it
must render them through one shared unified-resource component instead of a
Patrol-local count loop, and the resource drawer keeps only per-resource
policy lines.
-That same Patrol summary surface now keeps health and findings primary while
-making recent changes and learned correlations available only
-through the on-demand `Details` context inspector, so expansion
-lane concepts stay available for deeper investigation without reading as the
+The Patrol page keeps health and findings primary and offers no recent-change
+or learned-correlation inspector: its on-demand `Details` context block left
+with the supporting-context section, so those expansion-lane concepts stay in
+the resource drawer and backend investigation instead of reading as the
headline Patrol product story.
-That secondary investigation-context summary now also routes through the
-dedicated `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`
-owner, so the Patrol hook composes one canonical payload-to-summary derivation
-instead of rebuilding recent-change, correlation, and governed-resource count
-copy inline.
+Patrol also derives no recent-change, correlation, or governed-resource count
+summary. If such a summary returns, the payload-to-summary derivation belongs
+in `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`,
+and the Patrol hook must not rebuild that count copy inline.
The Patrol page's run-history tab label is now also tightened to `Runs`, while
the underlying run-history panel remains canonical for run-record review,
internal `finding_ids` scoping, and tool-call inspection. That copy change is
@@ -2235,19 +2224,21 @@ That same zero-coverage rule also applies to the expanded narrative sentence.
When Patrol checked none of a known scoped set, the run summary must still say
`Checked 0 of N scoped resources` rather than reverting to a generic `Patrol
completed` sentence that hides the failed coverage.
-The Patrol page and resource drawer now also share the canonical
-`frontend-modern/src/utils/resourceChangePresentation.ts` formatter so
+The resource drawer formats recent changes through the canonical
+`frontend-modern/src/utils/resourceChangePresentation.ts` formatter, and any
+Patrol surface that shows recent changes must use the same formatter, so
recent-change kind and headline wording stays aligned wherever the canonical
timeline is surfaced.
-Patrol-owned supporting context may still apply a bounded explanation-layer
-normalization before rendering recent changes or attaching them to Assistant:
-same-state timeline records must describe the changed substate, such as Docker
-image status or command posture, instead of surfacing no-op wording like an
-`online` to `online` transition in the Patrol page or Assistant handoff.
-The Patrol page and resource drawer now keep canonical relationship semantics
-in the backend correlation path, while the visible frontend stays
-timeline-first and does not surface a separate relationship presentation
-helper.
+If Patrol renders recent changes or attaches them to an Assistant handoff, it
+must first apply a bounded explanation-layer normalization so same-state
+timeline records describe the changed substate, such as Docker image status or
+command posture, instead of surfacing no-op wording like an `online` to
+`online` transition.
+Canonical relationship semantics stay in the backend correlation path. The
+Patrol page renders no relationships; the resource drawer presents them in its
+`Relationship map` through the shared `ResourceCorrelationSummary.tsx` card
+and `frontend-modern/src/utils/resourceCorrelationPresentation.ts` helpers
+rather than a drawer-local relationship formatter.
The backend Patrol and AI runtime summaries now also share
`internal/unifiedresources/change_presentation.go` for the canonical
change-kind and provenance mapping, so the same resource-model semantics
@@ -2257,11 +2248,13 @@ by the AI runtime prompt sections and Patrol seed context, so the change
wording itself stays canonical before the surrounding section headers are
applied.
The same helper now also owns the canonical recent-change section wrapper,
-so the Patrol page and AI runtime can share the same heading and resource
+so the AI runtime prompt sections, including the Patrol intelligence context
+and Assistant handoff resource timelines, share the same heading and resource
prefix rules instead of rebuilding that section locally.
The canonical shared AI resource context now also surfaces policy routing and
-redaction hints from unified resources, so the Patrol page and resource drawer
-see the same governance posture that the runtime uses for export boundaries.
+redaction hints from unified resources, so the runtime's export boundaries and
+the resource drawer's governance rows read the same unified-resource policy
+posture; the Patrol page renders no posture.
Patrol finding dismissal reasons and Patrol status labels now also route
through the shared frontend identifier-label helper, so the Patrol surfaces
do not keep their own underscore-stripping behavior separate from the rest
diff --git a/frontend-modern/browser-verification/eaf59cf8f93521c4.json b/frontend-modern/browser-verification/eaf59cf8f93521c4.json
new file mode 100644
index 0000000000..a32311d590
--- /dev/null
+++ b/frontend-modern/browser-verification/eaf59cf8f93521c4.json
@@ -0,0 +1,41 @@
+{
+ "version": 1,
+ "base_sha": "156d2e274d9f14e8283ca3d9e64243fb6882672a",
+ "verified_at": "2026-10-07T14:04:29Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts": "68542124c9cd1742051332aa09fc9795ff93ba705522f59007f42dbbb4815d87"
+ },
+ "routes": [
+ "/patrol",
+ "/patrol/protection",
+ "/patrol/activity"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Tree = origin/main 156d2e274d plus this change; production vite build embedded in a go build binary, private DEMO_MODE mock stack on :7791 (demo/demo, PULSE_TELEMETRY=false), driven by Playwright",
+ "Runtime-neutral proof: before/after production builds of this tree give byte-identical dist output (all 187 files equal by shasum), so the removed exports were already tree-shaken; check-bundle-size.mjs passes",
+ "Patrol Inbox, Protection, Activity, Finding options and history (Open work), finding review panel, run findings snapshot ('What Patrol found during this run.') and selected run in Patrol history: none render 'Recent changes', 'Learned correlations', 'Policy coverage', 'policy-covered', 'Supporting context' or a Details context control, at both viewports",
+ "Assistant drawer after 'Explain with Assistant' shows the Pulse Patrol attention briefing naming the selected decision's resource (buildPatrolAttentionAssistantHandoff from the changed module); the demo instance refuses the chat reply itself ('Demo mode enabled'), which is expected read-only behaviour",
+ "Assistant drawer after the selected run's 'Discuss' shows the 'Patrol run attached' briefing (buildPatrolRunAssistantHandoff from the changed module)",
+ "No page errors; the only console error (desktop) is 'Failed to load intelligence summary: TypeError: Failed to fetch' paired with net::ERR_ABORTED /api/ai/intelligence, i.e. a read cancelled by the script's own page.goto between Patrol routes; CSP inline-style reports and demo-mode 403s are pre-existing"
+ ],
+ "interactions": [
+ "Loaded /patrol, selected the first decision row and clicked 'Explain with Assistant'",
+ "Loaded /patrol/protection and waited for Protected outcomes to finish loading",
+ "Loaded /patrol/activity, expanded 'Finding options and history', opened 'Review issue' for the Docker host finding, switched to History, opened the newest run, returned to History and clicked the run's 'Discuss' button",
+ "Repeated every step at 1440x900 and 390x844"
+ ]
+}
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.branchcov.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.branchcov.test.ts
index f5e815a6df..cc91534557 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.branchcov.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.branchcov.test.ts
@@ -1,6 +1,5 @@
import { describe, expect, it } from 'vitest';
import type { ApprovalRequest, InvestigationRecord } from '@/api/ai';
-import type { ResourceCorrelation } from '@/types/aiIntelligence';
import type { PatrolRunRecord } from '@/api/patrol';
import type { UnifiedFinding } from '@/stores/aiIntelligence';
@@ -14,7 +13,6 @@ import {
buildPatrolAssistantProposedFixBriefingInput,
buildPatrolAssistantProposedFixBriefingInputFromApproval,
buildPatrolConfigurationFailureHandoff,
- buildPatrolInvestigationContextSummary,
buildPatrolInvestigationRecordPresentation,
buildPatrolRunAssistantHandoff,
} from '../patrolInvestigationContextModel';
@@ -25,72 +23,6 @@ import {
// arms) identified via V8 branch coverage. They do not duplicate the happy
// paths already pinned by the dev test.
-describe('buildPatrolInvestigationContextSummary (branch coverage)', () => {
- it('uses the plural recent-change and singular policy-resource wording', () => {
- expect(
- buildPatrolInvestigationContextSummary({
- recentChangesCount: 2,
- correlations: null,
- policyPosture: {
- total_resources: 1,
- sensitivity_counts: {},
- routing_counts: {},
- },
- }),
- ).toEqual({
- recentChangeCount: 2,
- correlationCount: 0,
- governedResourceCount: 1,
- hasContext: true,
- summaryText: '2 recent changes · 1 policy-covered resource',
- });
- });
-
- it('clamps non-finite and negative counts to zero with no context parts', () => {
- expect(
- buildPatrolInvestigationContextSummary({
- recentChangesCount: Number.NEGATIVE_INFINITY,
- correlations: { count: -3, correlations: [] },
- policyPosture: {
- total_resources: Number.NaN,
- sensitivity_counts: {},
- routing_counts: {},
- },
- }),
- ).toEqual({
- recentChangeCount: 0,
- correlationCount: 0,
- governedResourceCount: 0,
- hasContext: false,
- summaryText: '',
- });
- });
-
- it('clamps a non-finite correlation count to the list length fallback', () => {
- expect(
- buildPatrolInvestigationContextSummary({
- correlations: {
- count: Number.POSITIVE_INFINITY,
- correlations: [
- {
- source_id: 's',
- target_id: 't',
- event_pattern: 'p',
- occurrences: 1,
- } as unknown as ResourceCorrelation,
- ],
- },
- }),
- ).toEqual({
- recentChangeCount: 0,
- correlationCount: 1,
- governedResourceCount: 0,
- hasContext: true,
- summaryText: '1 correlation',
- });
- });
-});
-
describe('buildPatrolInvestigationRecordPresentation (branch coverage)', () => {
it('returns the empty presentation for null and undefined records', () => {
const empty = {
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.branchcov0723pm.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.branchcov0723pm.test.ts
index c48041e973..297adf1c3d 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.branchcov0723pm.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.branchcov0723pm.test.ts
@@ -11,13 +11,11 @@ import {
buildPatrolAssistantFindingHandoff,
buildPatrolAssistantFindingHandoffActions,
buildPatrolConfigurationFailureHandoff,
- buildPatrolInvestigationContextSummary,
buildPatrolInvestigationRecordPresentation,
buildPatrolRemediationPlanAssistantBriefing,
buildPatrolRemediationPlanAssistantModelContext,
buildPatrolRunAssistantHandoff,
patrolAssistantFindingHandoffRequiresApprovalMode,
- selectPatrolSupportingRecentChanges,
} from '../patrolInvestigationContextModel';
// Second branch-coverage companion to patrolInvestigationContextModel.test.ts.
@@ -35,122 +33,6 @@ const minimalRecord = {
status: 'completed',
} as unknown as InvestigationRecord;
-describe('buildPatrolInvestigationContextSummary (residual branches)', () => {
- it('returns zero correlations when the response is present but has no count and no array', () => {
- // normalizeCorrelationCount final `return 0` arm: object that is neither a
- // finite numeric count nor an Array `correlations` field.
- const summary = buildPatrolInvestigationContextSummary({
- correlations: { unexpected: 'shape' } as unknown as
- import('@/types/aiIntelligence').CorrelationsResponse | null,
- });
-
- expect(summary).toMatchObject({
- correlationCount: 0,
- hasContext: false,
- summaryText: '',
- });
- });
-});
-
-describe('selectPatrolSupportingRecentChanges (same-state transition branches)', () => {
- it('uses a custom reason and skips non-array changedFields', () => {
- // formatSameStateTransitionReason: changedFieldLabels empty (metadata
- // present but changedFields not an array) -> falls through to the reason
- // arm, and a reason that is not the default yields "${reason} while ${state}".
- const [change] = selectPatrolSupportingRecentChanges([
- {
- id: 'c-reason',
- observedAt: '2026-01-01T00:00:00Z',
- resourceId: 'vm-1',
- kind: 'state_transition',
- from: 'online',
- to: 'online',
- sourceType: 'pulse_diff',
- confidence: 'high',
- reason: 'operator-initiated restart',
- metadata: { note: 'not an array' },
- },
- ]);
-
- expect(change).toMatchObject({
- from: undefined,
- to: undefined,
- reason: 'operator-initiated restart while online',
- });
- });
-
- it('skips blank changed-field entries and falls back to the identifier label for unknown fields', () => {
- const [change] = selectPatrolSupportingRecentChanges([
- {
- id: 'c-fields',
- observedAt: '2026-01-01T00:00:00Z',
- resourceId: 'vm-1',
- kind: 'restart',
- from: 'on',
- to: 'on',
- sourceType: 'pulse_diff',
- confidence: 'high',
- metadata: { changedFields: ['', ' ', 'custom_field', 'tags'] },
- },
- ]);
-
- // Blank entries are skipped; 'custom_field' uses formatIdentifierLabel
- // fallback ("Custom Field"); 'tags' resolves to the known map label.
- expect(change.reason).toBe('Custom Field and tags changed while on');
- });
-
- it('renders the single-field and three-or-more-field compact label lists', () => {
- const [single] = selectPatrolSupportingRecentChanges([
- {
- id: 'c-one',
- observedAt: '2026-01-01T00:00:00Z',
- resourceId: 'vm-1',
- kind: 'state_transition',
- from: 'online',
- to: 'online',
- sourceType: 'pulse_diff',
- confidence: 'high',
- metadata: { changedFields: ['tags'] },
- },
- ]);
- expect(single.reason).toBe('tags changed while online');
-
- const [many] = selectPatrolSupportingRecentChanges([
- {
- id: 'c-many',
- observedAt: '2026-01-01T00:00:00Z',
- resourceId: 'vm-1',
- kind: 'state_transition',
- from: 'online',
- to: 'online',
- sourceType: 'pulse_diff',
- confidence: 'high',
- metadata: { changedFields: ['status', 'incidents', 'parentId'] },
- },
- ]);
- expect(many.reason).toBe('status, incident state, and 1 more changed while online');
- });
-
- it('falls back to the default wording when the reason is exactly the no-op default', () => {
- const [change] = selectPatrolSupportingRecentChanges([
- {
- id: 'c-default',
- observedAt: '2026-01-01T00:00:00Z',
- resourceId: 'vm-1',
- kind: 'state_transition',
- from: 'online',
- to: 'online',
- sourceType: 'pulse_diff',
- confidence: 'high',
- reason: 'Resource state changed',
- },
- ]);
-
- // Case-insensitive match against the default -> generic fallback wording.
- expect(change.reason).toBe('state details changed while online');
- });
-});
-
describe('buildPatrolInvestigationRecordPresentation (residual branches)', () => {
it('labels an unknown tool via the identifier fallback', () => {
const presentation = buildPatrolInvestigationRecordPresentation({
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
index 3b9656c15b..0dd44857b6 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts
@@ -12,120 +12,14 @@ import {
buildPatrolAssistantFindingHandoffActions,
buildPatrolAssistantProposedFixBriefingInput,
buildPatrolConfigurationFailureHandoff,
- buildPatrolInvestigationContextSummary,
buildPatrolRunAssistantHandoff,
buildPatrolInvestigationRecordPresentation,
buildPatrolRemediationPlanAssistantBriefing,
buildPatrolRemediationPlanAssistantModelContext,
patrolAssistantFindingHandoffRequiresApprovalMode,
- selectPatrolSupportingRecentChanges,
} from '../patrolInvestigationContextModel';
describe('patrolInvestigationContextModel', () => {
- it('builds the canonical investigation context summary from recent changes, correlations, and policy posture', () => {
- expect(
- buildPatrolInvestigationContextSummary({
- recentChangesCount: 1,
- correlations: {
- count: 2,
- correlations: [],
- },
- policyPosture: {
- total_resources: 4,
- sensitivity_counts: {},
- routing_counts: {},
- },
- }),
- ).toEqual({
- recentChangeCount: 1,
- correlationCount: 2,
- governedResourceCount: 4,
- hasContext: true,
- summaryText: '1 recent change · 2 correlations · 4 policy-covered resources',
- });
- });
-
- it('falls back to correlation list length and suppresses empty context parts', () => {
- expect(
- buildPatrolInvestigationContextSummary({
- recentChangesCount: 0,
- correlations: {
- correlations: [
- {
- source_id: 'a',
- source_name: 'A',
- source_type: 'host',
- target_id: 'b',
- target_name: 'B',
- target_type: 'vm',
- event_pattern: 'cpu -> restart',
- occurrences: 1,
- avg_delay: 30,
- confidence: 0.7,
- last_seen: '2026-03-01T00:00:00Z',
- description: 'desc',
- },
- ],
- count: Number.NaN,
- },
- policyPosture: {
- total_resources: 0,
- sensitivity_counts: {},
- routing_counts: {},
- },
- }),
- ).toEqual({
- recentChangeCount: 0,
- correlationCount: 1,
- governedResourceCount: 0,
- hasContext: true,
- summaryText: '1 correlation',
- });
- });
-
- it('returns an empty context summary when no secondary investigation signals exist', () => {
- expect(
- buildPatrolInvestigationContextSummary({
- recentChangesCount: undefined,
- correlations: null,
- policyPosture: null,
- }),
- ).toEqual({
- recentChangeCount: 0,
- correlationCount: 0,
- governedResourceCount: 0,
- hasContext: false,
- summaryText: '',
- });
- });
-
- it('normalizes same-state recent changes before Patrol uses them as Assistant context', () => {
- const changes = selectPatrolSupportingRecentChanges([
- {
- id: 'change-1',
- observedAt: '2026-05-06T12:08:00Z',
- resourceId: 'app-container-1',
- kind: 'state_transition',
- from: 'online',
- to: 'online',
- sourceType: 'pulse_diff',
- sourceAdapter: 'docker_adapter',
- confidence: 'high',
- reason: 'resource state changed',
- metadata: {
- changedFields: ['docker.command'],
- },
- },
- ]);
-
- expect(changes).toHaveLength(1);
- expect(changes[0]).toMatchObject({
- from: undefined,
- to: undefined,
- reason: 'Docker command changed while online',
- });
- });
-
it('keeps same-state recent changes out of Patrol Assistant no-op wording', () => {
const handoff = buildPatrolAssessmentAssistantHandoff({
assessment: {
diff --git a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
index 2cf8f21eaa..8a00db33f5 100644
--- a/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
+++ b/frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts
@@ -1,8 +1,4 @@
-import type {
- CorrelationsResponse,
- IntelligencePolicyPostureSummary,
- ResourceCorrelation,
-} from '@/types/aiIntelligence';
+import type { ResourceCorrelation } from '@/types/aiIntelligence';
import type { ApprovalRequest, InvestigationRecord, RemediationPlan } from '@/api/ai';
import type { PatrolRunRecord } from '@/api/patrol';
import type { AttentionItemDetail } from '@/api/patrolAttention';
@@ -57,12 +53,6 @@ function formatBriefingTimestamp(value: string | undefined): string {
return formatRelativeTime(value, { compact: false, emptyText: '' });
}
-export interface PatrolInvestigationContextSummaryInput {
- recentChangesCount?: number | null;
- correlations?: CorrelationsResponse | null;
- policyPosture?: IntelligencePolicyPostureSummary | null;
-}
-
export interface PatrolInvestigationContextSummary {
recentChangeCount: number;
correlationCount: number;
@@ -314,41 +304,6 @@ const SAME_STATE_CHANGED_FIELD_LABELS: Record<string, string> = {
identity: 'identity',
};
-export function buildPatrolInvestigationContextSummary(
- input: PatrolInvestigationContextSummaryInput,
-): PatrolInvestigationContextSummary {
- const recentChangeCount = normalizeNonNegativeCount(input.recentChangesCount);
- const correlationCount = normalizeCorrelationCount(input.correlations);
- const governedResourceCount = normalizeNonNegativeCount(input.policyPosture?.total_resources);
-
- const parts: string[] = [];
- if (recentChangeCount > 0) {
- parts.push(`${recentChangeCount} recent change${recentChangeCount === 1 ? '' : 's'}`);
- }
- if (correlationCount > 0) {
- parts.push(`${correlationCount} correlation${correlationCount === 1 ? '' : 's'}`);
- }
- if (governedResourceCount > 0) {
- parts.push(
- `${governedResourceCount} policy-covered resource${governedResourceCount === 1 ? '' : 's'}`,
- );
- }
-
- return {
- recentChangeCount,
- correlationCount,
- governedResourceCount,
- hasContext: parts.length > 0,
- summaryText: parts.join(' · '),
- };
-}
-
-export function selectPatrolSupportingRecentChanges(
- changes?: ResourceChange[] | null,
-): ResourceChange[] {
- return normalizeAssessmentRecentChanges(changes);
-}
-
export function buildPatrolInvestigationRecordPresentation(
record?: InvestigationRecord | null,
): PatrolInvestigationRecordPresentation {
@@ -2254,17 +2209,6 @@ function normalizeApprovalBriefing(
};
}
-function normalizeCorrelationCount(correlations?: CorrelationsResponse | null): number {
- if (!correlations) return 0;
- if (typeof correlations.count === 'number' && Number.isFinite(correlations.count)) {
- return Math.max(0, Math.trunc(correlations.count));
- }
- if (Array.isArray(correlations.correlations)) {
- return correlations.correlations.length;
- }
- return 0;
-}
-
function normalizeNonNegativeCount(value?: number | null): number {
if (typeof value !== 'number' || !Number.isFinite(value)) {
return 0;
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 0007cbf67c..fcbcaec075 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -3613,15 +3613,14 @@ describe('frontend resource type boundaries', () => {
// Verify the symbol is imported from the model without prescribing a
// specific single- vs multi-line import shape; usePatrolIntelligenceState
// groups several patrolInvestigationContextModel imports together.
- expect(patrolIntelligenceStateSource).toContain(
- 'buildPatrolAssistantFindingHandoffFromUnifiedFinding',
+ expect(patrolIntelligenceStateSource).toMatch(
+ /import\s*\{[^}]*\bbuildPatrolAssistantFindingHandoffFromUnifiedFinding\b[^}]*\}\s*from '\.\/patrolInvestigationContextModel';/,
);
expect(patrolIntelligenceStateSource).toContain('buildPatrolSettingsReadinessFailure');
- expect(patrolIntelligenceStateSource).toContain("from './patrolInvestigationContextModel'");
expect(patrolIntelligenceStateSource).not.toContain('recent_changes?.length');
expect(patrolIntelligenceStateSource).not.toContain('governed resource${');
expect(patrolInvestigationContextModelSource).toContain(
- 'export function buildPatrolInvestigationContextSummary',
+ 'export function buildPatrolAssistantFindingHandoffFromUnifiedFinding',
);
expect(patrolInvestigationContextModelSource).toContain(
'export function buildPatrolInvestigationRecordPresentation',
@@ -3640,7 +3639,9 @@ describe('frontend resource type boundaries', () => {
expect(patrolInvestigationContextModelSource).not.toContain(
'record.proposed_fix.commands.join',
);
- expect(patrolInvestigationContextModelSource).toContain('policy-covered resource');
+ // Patrol renders no supporting-context summary, so the model must not
+ // carry its policy-coverage count copy either.
+ expect(patrolInvestigationContextModelSource).not.toContain('policy-covered resource');
expect(patrolIntelligenceHeaderSource).not.toContain('buildPatrolScheduleOptions');
expect(patrolIntelligenceHeaderSource).not.toContain('getAIQuickstartCreditsPresentation');
expect(patrolIntelligenceHeaderSource).not.toContain('quickstart_credits');