Commit Graph

13084 Commits

Author SHA1 Message Date
rcourtman d1ef487e09 Stop hidden tooltips and breakpoints listening to resize (#2724)
On `/proxmox` with 140 workload rows, 859 window `resize` listeners were
active after load (203 at phone width with 36 rows), so every window
resize ran one callback per listener:

- 699 from `useTooltipState.ts` (`useTooltipLayoutState`), which
registered a listener for every tooltip instance, including the hidden
`TooltipPortal` on each row's metric bars and sparklines.
- 156 from `useBreakpoint.ts`, where every call added its own listener
and width signal.

## Change

- Tooltip layout state listens only while its tooltip is visible and
re-reads the viewport when it opens. `useTooltipPortalState` uses the
same visibility gate as the portal's render (`when &&
supportsHoverTooltips()`), so a portal suppressed on a touch device
holds no listener either.
- `useBreakpoint` keeps one module-level width signal and shared memos,
fed by a single rAF-debounced listener while at least one caller is
mounted. A new caller syncs to the live `innerWidth`, so a caller
created after resizes nobody heard starts correct.

## Evidence

Live pass on a private mock-mode stack (headless Chromium,
add/removeEventListener wrapped to track live listeners by registering
frame):

| | before | after |
|---|---|---|
| 1440×900, 140 rows | 859 active, 859 callbacks per resize | 5 active,
5 callbacks |
| 390×844, 36 rows | 203 active | 5 active |

- An open row tooltip adds exactly one listener, stays open through
window resizes (its viewBox follows 1440×700 and 1380×640), and its
listener is removed on close.
- Crossing the phone breakpoint in both directions still switches the
workload table (`workload-table--desktop` ↔ `--mobile`) and each row's
layout.
- New tests: `useBreakpoint.test.ts` (one listener for 50 callers,
back-to-back resizes leave one pending frame, every caller crosses a
breakpoint, a new caller starts from the live width) and
`TooltipPortal.test.tsx` (hidden and touch-suppressed portals add no
listener, an open portal re-clamps on resize, a portal opened after an
unheard resize uses the live viewport). The listener assertions fail
against main.
- 198 frontend test files / 3620 tests pass across `components/shared`,
`components/Workloads`, the hooks, AppLayout, AIChat, Docker tables and
the boundary tests; prettier, eslint and tsc are clean.

Contract notes: `frontend-primitives.md` (tooltip owner) and
`performance-and-scalability.md` (new current-state section).
`useBreakpoint.ts` has no owning subsystem, so its rule lives in the
performance contract.
2026-10-08 02:23:06 +01:00
rcourtman 6d8dc0aa73 Correct stale platform-page embed contract prose (#2726)
Several v6 subsystem contracts described platform pages embedding
canonical surfaces through controls that no longer exist: a `tableOnly`
/ `embedded tableOnly` mode, a `showFilterToolbar` prop, a
`RecoverySurface`, `forcedPlatformFilter`, an embedded `StorageSurface`
at `/truenas/storage`, and a TrueNAS Protection tab built on a Recovery
surface. The aggregate Recovery surface was deleted on 2026-05-26
(66fb198cc6), and neither `WorkloadsSurface` nor `Storage` has an embed
mode.

What the code does, and what the contracts now say:

- **Workloads embeds** (`performance-and-scalability.md`): only the
Proxmox and vSphere Overview tabs embed `WorkloadsSurface`. Each page
builds its own `useWorkloadsState` with `forcedPlatform` and
`suppressPlatformFilter: true`, renders the one `WorkloadsFilter`
toolbar, and passes that state to the surface with
`suppressFilterToolbar`.
- **Platform-page rule** (`frontend-primitives.md`, with `cloud-paid.md`
now deferring to it instead of keeping a second copy): three tabs embed
a canonical surface (Proxmox and vSphere Overview, and Proxmox Storage
with `forcedSourceFilter`), and those tabs keep their rows on the
embeds. Every other tab renders a platform-owned table on the shared
platform-page primitives. The old "chrome-only, no per-family tables"
wording has not matched the code since the platform-first migration. The
bans on estate summary panels and forked table primitives stay.
- **Storage and recovery** (`storage-recovery.md`,
`unified-resources.md`): `/truenas/storage` renders
`TrueNASStorageTopologyTable`. Proxmox Backups reads `/api/backups/pve`,
`/api/backups/pbs` and the protection postures itself. TrueNAS
Protection feeds `TrueNASProtectionTable` from `useRecoveryPoints` with
the `truenas` platform forced.

Contract-only PRs never get their required checks, so a new case in
`platformOverviewLayout.guardrails.test.ts` pins these claims by parsing
the page surfaces with the TypeScript compiler API. It checks which
embeds each page has and which tab gates them, the platform lock on the
Workloads state and toolbar, `suppressFilterToolbar`, the source lock on
the Storage embed with no `forcedView`, the absence of an embed-mode
prop on either surface, and the wiring from the recovery hook to the
TrueNAS protection table. Twelve negative controls (removing the lock,
un-gating or moving a tab, re-adding the platform chip,
`suppressFilterToolbar={false}`, adding `forcedView` or a `tableOnly`
prop, embedding a `RecoverySurface`, emptying the protection points, and
others) each fail the case at the intended assertion. Two
behaviour-preserving edits still pass: a paren inside a comment and a
`>` inside a quoted attribute. The full guardrail file passes 19/19, and
the project typecheck and eslint are clean.

Out of scope here: the `storage-recovery.md` sections already rewritten
by #2718, and the wider prose about the deleted aggregate Recovery
page's internals (`components/Recovery/`, `useRecoverySurfaceState` as a
state owner, the `buildRecoveryRouteSearch` serializer paragraph). A
separate PR covers those, and the two merge cleanly in either order.
2026-10-08 02:20:07 +01:00
rcourtman b7bdf1b4eb Split a manually linked pair when the API unlinks it (#2725)
## Problem

`POST /api/resources/{id}/unlink` answered 200 "Resources unlinked" but
only recorded a `ResourceExclusion`. The manual link row stayed in
`resource_links`, and `ResourceRegistry.applyManualLinks` never consults
exclusions, so the pair stayed merged in the monitor's registry
rebuilds, the resources API and the websocket broadcast. Repro: link a
standalone agent into a VM, unlink it, then `GET /api/resources/<vm>`:
the agent facet is still there and the agent row is still gone.

Separately, the websocket broadcast coalesced host views with
`CoalescePresentationHostResources`, which applies no exclusions, while
REST's `ListForPresentation` applies the registry's, so a host pair the
operator split could be one broadcast row and two REST rows.

No frontend code calls `/api/resources/{id}/link` or `/unlink`
(`/api/agents/agent/unlink` is a different endpoint).

## Semantics

A resource pair carries one operator decision, and the later one
replaces the earlier: a link joins the pair, an exclusion (unlink,
report-merge) keeps it apart.

- Store writes: `AddExclusion` deletes the pair's link rows and
`AddLink` deletes its exclusion rows, in one transaction, matching both
ID orders; each also deletes a row of its own kind that canonical-ID
succession stored in the other order. The in-memory store does the same
and stamps `CreatedAt` like SQLite.
- Store reads: `GetLinks` / `GetExclusions` keep only each pair's latest
decision (`effectiveManualPairDecisions`), so rows written before this
change or rewritten onto one pair by succession resolve by their later
write; a tie keeps the pair apart.
- Registry: `loadOverrides` resolves its two reads together, so an
unlink committed between them cannot load both decisions into one
generation.
- Identity pins: while a Proxmox node was linked to an agent, the merged
resource's pin could record the node's endpoint hostname with the
agent's machine key. After unlink the node completed that key, minted
the agent's ID and folded into it by ID, a path no exclusion check sees.
A pin no longer completes the identity of a record the operator split
from the pinned resource.
- Broadcast: coalesces through `MonitorAdapter.CoalesceForPresentation`
on the read state that listed the rows when its registry is store-backed
(the store's adapter or a host-continuity overlay), else on the resource
store's adapter (the mock view lists through a store-less registry),
sharing `presentationExclusionFilter` with `ListForPresentation`.

In production REST seeds from the monitor's already-linked listing, so
an unlink shows on REST, `/api/state` and the websocket from the
monitor's next registry rebuild, the same generation in which a new link
reaches the broadcast.

## Known limits (unchanged, documented in the contract)

- Report-merge derives candidate IDs from the merged resource's type, so
it does not name the folded side of a cross-type manual link and cannot
undo one; unlink does.
- An agent's own declared node link (`resolveLinkedResource`) still
ignores exclusions.
- Presentation coalescing compares the IDs of the rows being merged, so
a third same-host fragment that merges first can carry an excluded pair
into one row (REST and broadcast now agree on this).

## Verification

- `TestResourceUnlinkSplitsManuallyLinkedPair` (new
`resources_unlink_test.go`) drives link, unlink and relink through the
API handlers against a `MonitorAdapter` on the same SQLite store,
rebuilt twice per step. It failed on main at "after unlink" exactly as
reported.
- `TestUnlinkSplitsHostPairWhosePinTookTheOtherSidesKey`: node/agent
pairs (IP and FQDN endpoints) through three rebuilds per step; both FQDN
cases fail with the pin guard removed.
- `TestManualPairDecisionReplacesThePreviousOne`,
`TestManualPairDecisionReadsResolveStoredConflictsByRecency`,
`TestRegistryResolvesDecisionsAcrossItsTwoReads`,
`TestMonitorAdapterCoalesceForPresentationHonoursExclusions`,
`TestBroadcastPresentationCoalesceHonoursMergeExclusions`,
`TestBroadcastPresentationCoalescePrefersTheListingReadState`.
- Negative controls (each fails with its fix reverted): store write
rule, newest-link-per-pair, registry combined resolution, pin guard,
broadcast exclusion coalesce, broadcast read-state preference,
store-less adapter fallback.
- Full `./internal/unifiedresources/...`,
`./internal/api/resourceapi/...` and `./internal/monitoring/...` pass.
- Live replay on private mock stacks built from main and from this
branch (`POST .../link`, `.../unlink`, `.../link` on a mock VM and a
standalone agent, then `GET /api/resources/{id}` for both). Main: after
unlink the VM still carries the agent facet and the agent row is still
404, unchanged 25 s later. This branch: after unlink the VM has no agent
facet and the agent row is back at once; relink folds it again.

Report-merge and agent-declared node links are left for separate
follow-ups.
2026-10-08 02:07:02 +01:00
rcourtman ce338b1496 Remove the unreachable Workloads group drawer and group pin (#2723)
## Why

`useWorkloadsState` defaulted `groupNodeDrawerMode` to `'inline'`, and
only that mode wired group-header hover preview, click-to-pin group
scope and an inline `NodeDrawer` under the group row. The only page that
used the default, the standalone `/workloads` page, was retired in May.
Both production mounts have passed `'disabled'` since host drawers moved
to each page's own hosts table: Proxmox in 84f627e22a (2026-05-18, "Move
Proxmox host drawers to the host table") and vSphere in d96d5612fd
(2026-05-23). The disabling was deliberate on both pages, so this
removes the dead path instead of re-enabling it. The demand ledger has
no entry asking for workload group hover or pin.

The only way left to reach the group pin was a hand-typed
`?summaryGroup=` URL. No link builder passes it, and row expansion
stopped writing it in 86ac84f68e.

## What changes

- `WorkloadPanel`: drops the inline `NodeDrawer` mount, the group hover
and pin handlers, `aria-expanded`, `data-summary-group-series-count`,
`data-summary-row-active` on group rows, and the group-member state
passed to `GuestRow`. Group rows stay identity-only dividers and keep
`data-summary-group-id`, so clicking one still leaves an open guest
drawer alone (`summaryTableFocus` ignores that selector).
- `useWorkloadSelectionState`: drops the hovered and focused group
scope, `summaryGroup` hydration and the related effects. It no longer
passes group options to the shared bridge; Storage still uses them.
- `useWorkloadsState`: drops the option, `getNodeTemperatureThresholds`
(it only fed the removed drawer), and the `summaryGroupScopes` memo,
which rebuilt a scope for every group on every filtered-guest change.
- Removes `buildWorkloadSummaryGroupScope(Map)`,
`workloadsHasVisibleWorkloadGroupScope`, the `GuestRow` group-member
attribute and the workloads `summaryGroup` route param.
- Proxmox and vSphere stop passing the option. Their filter bars'
pinned-selection state now reads only the selected guest.
- `NodeDrawer` stays live in `ProxmoxNodesTable`. The temperature
guardrail now pins that live mount instead of the dead one.
- Contracts: rule 8 and the Workloads, Proxmox and vSphere clauses now
describe static dividers. Stale sentences about grouped node rows
opening the node drawer, group-row emphasis, and Workloads selection
writing back to the route are corrected.

## Verification

- Before/after browser pass on pulse-dev: embedded builds on mock demo
stacks, Proxmox and vSphere overviews, at 1440x900 and 390x844.
  - Hover, click and tap on group dividers do nothing on both builds.
- Guest drawer, Escape, guest-row hover emphasis, `?resource=` links and
the Proxmox nodes-table `NodeDrawer` behave the same on both builds.
- Clicking a divider with a guest drawer open keeps the drawer: 10/10 on
each build.
- The hand-typed `?summaryGroup=` URL pinned 18 Proxmox rows on main and
pins none now.
- Receipt: `frontend-modern/browser-verification/db4ee39cb5db006c.json`.
- Frontend typecheck passes. The targeted suites (Workloads, proxmox,
vmware, platformPage, shared, routing, utils, hooks, Storage) pass on
pulse-dev except one Proxmox backups windowing test that failed once at
load ~40 and then passed 2/2 alone.
- A full-suite run on the earlier base passed except files that also
fail on unmodified main or only under load. `useReportingPanelState`
fails on main there too.
- Commit hook battery and governance audits pass.
- Two rounds of second-opinion review. Round 1 caught a stale test pin
and stale perf-contract prose; round 2 caught one inaccurate
scroll-restore sentence. All are fixed here.

Follow-ups raised separately: the built-in `WorkloadsSurface` filter
toolbar is also unreachable, since both mounts pass
`suppressFilterToolbar`. The quarantined E2E spec 48 still targets the
retired `/workloads` page.
2026-10-08 01:58:31 +01:00
rcourtman 64458fc13f Retire the summary hover E2E spec pinned to removed surfaces (#2722)
Deletes the quarantined
`tests/integration/tests/48-summary-hover-selection.spec.ts` and its
`QUARANTINED_SPECS` entry.

None of its nine tests could pass against the current app. Each one
opens `/workloads` or `/storage`, which now show Page Not Found, or
`/infrastructure`, which redirects to the first platform page. Each then
waits for a `workloads-summary`, `infrastructure-summary` or
`storage-summary` card that no longer renders.

The storage pool-group pin test was the only candidate for a port to
`/proxmox/storage?group=node`. Checked against the live page, a
group-header click there collapses the group as it pins it. In that run
the table went from 17 to 14 rows and showed 0 pinned member rows. The
test expects the row count unchanged and every member pinned. It also
asserts summary chart series counts, and those charts no longer exist.
The pin behaviour that still works (hover preview, `summaryGroup`,
pinned emphasis after expanding, Clear selection) is already covered in
`Storage.test.tsx`.

Tier ledger check (`check-e2e-tiering.mjs`, run on pulse-dev):
- origin/main: passes, 102 spec files, 3 quarantined
- this branch: passes, 101 spec files, 2 quarantined, with stable and
probation test counts unchanged (366 / 553)
- spec deleted but ledger entry kept: fails with `QUARANTINED_SPECS has
unknown specs: 48-summary-hover-selection.spec.ts`
2026-10-08 01:29:20 +01:00
rcourtman 39b6007f5d Pin each manual-link side from its own identity (#2719)
Stacked on #2715 (its commit is this branch's parent; whichever lands
first, the other still merges).

## Problem

A manual link merges two resources for display, but
`PersistIdentityPins` pinned the merged identity. A link primary was
pinned with the folded resource's machine key, and the store's
one-owner-per-key rule deleted the folded resource's own pin.

For a Proxmox node with a qualified endpoint
(`https://pve1.example.test:8006`) linked to a host agent, the node's
pin records the endpoint, so the next rebuild completed the agent's
machine key from it, minted the agent's machine-derived ID and merged
the two by ID before the link applied. With the node as primary,
succession then rewrote the link into a self-link on the agent's ID; in
either direction, removing the link left the pair merged. Reproduced
through `MonitorAdapter.PopulateSnapshotAndSupplemental` with a
`MemoryStore` on #2715's head.

## Change

- `applyManualLinks` captures each side's own pin before the merge
(`recordLinkOwnPin`, first capture per rebuild wins), and
`PersistIdentityPins` writes those instead of the merged projection,
keeping a pinnable folded side pinned under its own canonical ID.
- Link sides write through a new
`ResourceStore.ReplaceResourceIdentityPins` (both stores). Like an
upsert the row keeps fields the side's own pin leaves empty, but it
drops a strong key another resource holds this rebuild, which is how a
key an earlier release borrowed from the merged identity leaves the row.
- A folded side drops a key a live resource or an earlier folded side
already holds instead of trading it every rebuild, and writes no pin
when that would cost it its machine evidence (a cluster-only row would
be open to cluster-slot succession).
- Proxmox auto-links (LinkedAgentID / identity matcher) merge before any
manual link applies, so their boot-window pins are unchanged
(`TestIssue1753*`, `TestMonitorAdapterRebuildPersistsIdentityPins`
pass).

Known limits, written into the contract: a node row an earlier release
already filled with the agent's key still merges the pair by ID while
the node can complete from it; two live resources sharing a strong key
still alternate, as on main; evidence a later record pass of the same
rebuild merges into an already-joined row reaches neither side's pin.

## Verification

- New tests in `registry_merge_policy_test.go` (standalone and clustered
node, both link directions, three rebuilds with no steady-state pin
writes, then unlink separates the pair; shared-key, kept-field,
hostname-guard, machine-loss and borrowed-key cases) and `store_test.go`
(replace vs upsert on memory and SQLite).
- Each new test fails against #2715's runtime files via `go test
-overlay`; each guard rule fails its own test when removed.
- `internal/unifiedresources` full package, `internal/monitoring`
link/identity tests, `internal/api/resourceapi`, `go build ./...` and
`go vet` pass.
- Contract: `unified-resources.md` clause 25 and "Operator links reach
record-ingested resources".
2026-10-08 00:45:22 +01:00
rcourtman bb35a5c006 Correct stale Storage embed and History range contract prose (#2718)
Three contract passages described toolbar controls that no longer exist.

**storage-recovery.md (StorageSurface embed).** The contract said
platform pages opt into the Storage toolbar through a
`showFilterToolbar` prop on `StorageProps`, keep `tableOnly` to hide a
storage summary section, and get a chart-collapse control. It also
mentioned `RecoverySurface`, `forcedPlatformFilter`, and an embedded
`StorageSurface` at `/truenas/storage`. On main:
- `Storage.tsx` always renders `StoragePageControls`; only kiosk mode
hides it.
- There is no summary section and no chart-collapse control.
- The Proxmox Storage tab is the only embed. It passes
`forcedSourceFilter`, `resourceSource`, `suppressNodeFilter`,
`filterAriaLabel` and search copy.
- `/truenas/storage` renders `TrueNASStorageTopologyTable`.

The rewrite describes what `Storage.tsx`, `StoragePageControls.tsx` and
`useStoragePageFilters.ts` actually do:
- The forced source is read as the route source and never written back
to the URL.
- The Source chip is auto-suppressed and does not surface the clear
action.
- `suppressNodeFilter` drops the Node chip and resets a selected node to
all nodes.

**performance-and-scalability.md and frontend-primitives.md (Workloads
History range).** Both said the sparkline range shows only while Trends
is active and carries a `Trend range` label. `WorkloadsFilter` actually
shows it in Trends, and in Bars at desktop widths while Row hover is
`History`. Its label is `History`.

**Test.** A new rendered test in `Storage.test.tsx` pins the embed
behaviour the rewrite claims. Five negative controls each fail it:
- dropping the forced-source suppression
- dropping the node reset
- unlocking the route source
- gating the toolbar off
- keeping the Node filter

The `History` label was already pinned by `WorkloadsFilter.test.tsx` and
`WorkloadsSurface.performance.contract.test.tsx`. Another stale test
title, "table-only embedding", is renamed.

Sibling stale passages are left for a follow-up: `embedded tableOnly` in
frontend-primitives.md and cloud-paid.md, the WorkloadsSurface
`showFilterToolbar` text in performance-and-scalability.md, and the
TrueNAS StorageSurface line in unified-resources.md.
2026-10-08 00:44:18 +01:00
rcourtman 4cf1c318fb Correct stale platform-page embed contract prose
Several v6 contracts still described platform pages embedding canonical
surfaces through controls that no longer exist: a `tableOnly` /
`embedded tableOnly` mode, a `showFilterToolbar` prop, a `RecoverySurface`,
an embedded `StorageSurface` at /truenas/storage, and a TrueNAS Protection
tab built on a Recovery surface. The aggregate Recovery surface was deleted
on 2026-05-26 and neither WorkloadsSurface nor Storage has an embed mode.

The platform-page rule in frontend-primitives.md (and its cloud-paid
counterpart) now says what the pages do: the Proxmox and vSphere Overview
tabs embed WorkloadsSurface with the page owning the workloads state and
the one WorkloadsFilter toolbar, the Proxmox Storage tab embeds
StorageSurface with forcedSourceFilter, and every other tab, including
/truenas/storage, Proxmox Backups and TrueNAS Protection, renders a
platform-owned table on the shared platform-page primitives. The old rule
said pages only embed canonical surfaces and must not add per-family
tables; that has not been true since the platform-first migration, so the
rule now names the three embeds, keeps those tabs' rows on them, and keeps
the bans on estate summary panels and forked table primitives. cloud-paid
defers to that rule instead of carrying a second copy.

The new guardrail case pins those embeds per page, the absence of an
embed-mode prop on both surfaces, the platform lock on the Workloads
embeds, and the recovery tabs' platform-owned tables, so the contract and
the code cannot drift apart silently again.
2026-10-08 00:07:54 +01:00
rcourtman 58ee64fc1c Split a manually linked pair when the API unlinks it
POST /api/resources/{id}/unlink recorded only an exclusion. The link row
stayed, and applyManualLinks never consults exclusions, so the monitor's
rebuilds, the resources API and the websocket kept the pair folded while
the API answered "Resources unlinked".

A pair now carries one operator decision. AddExclusion deletes the pair's
links and AddLink its exclusions, in one transaction and in either ID
order. Reads keep each pair's latest decision, so rows written before
this change, or rewritten onto one pair by canonical-ID succession,
resolve by their later write, and a registry resolves its two reads
together so an unlink landing between them cannot load both.

While a Proxmox node was linked to an agent, the merged resource's
identity pin could take the agent's machine key. After unlink the node
completed that key, minted the agent's ID and folded into it by ID, where
no exclusion check runs. A pin no longer completes a record the operator
split from the pinned resource.

The broadcast coalesced host views without exclusions while REST's
ListForPresentation honoured them, so a split host pair was one websocket
row and two REST rows. The broadcast now coalesces through the read state
that listed the rows, with the same exclusion filter.
2026-10-08 00:07:49 +01:00
rcourtman 9daa8154c8 Merge remote-tracking branch 'origin/main' into perf/shared-resize-listeners 2026-10-08 00:00:38 +01:00
rcourtman 03e4920460 Stop hidden tooltips and breakpoints listening to resize
On /proxmox with 140 workload rows, 859 window resize listeners were
active after load (203 at phone width with 36 rows), so every window
resize ran one callback per listener and each set signals. 699 came
from tooltip layout state registering a listener for every instance,
including the hidden TooltipPortal on each metric bar and sparkline,
and 156 from every useBreakpoint() call adding its own listener.

Tooltip layout state now listens only while its tooltip is visible
(a portal suppressed on a touch device counts as hidden) and re-reads
the viewport when it opens. useBreakpoint keeps one module-level width
signal fed by a single rAF-debounced listener while any caller is
mounted, and a new caller syncs to the live innerWidth.

The page now holds 5 listeners at both widths. An open tooltip adds
one and removes it on close, still follows window resizes, and
crossing the phone breakpoint still switches the workload table and
row layout.
2026-10-07 23:58:00 +01:00
rcourtman 03767f1e95 Remove the unreachable Workloads group drawer and group pin
useWorkloadsState defaulted groupNodeDrawerMode to 'inline', but only
the standalone /workloads page used that default, and it was retired
in May. Both production mounts, the Proxmox and vSphere overviews,
have passed 'disabled' since host drawers moved to each page's own
hosts table (84f627e22a, d96d5612fd). So the inline NodeDrawer under a
group row, the group-header hover preview and click-to-pin never ran.

The only way left to reach the group pin was a hand-typed
?summaryGroup= URL: no link builder passes it, and row expansion
stopped writing it in May (86ac84f68e). On the Proxmox overview it
pinned the group's rows; on vSphere it pinned nothing.

Drop the option, the inline NodeDrawer mount and the group hover/pin
handlers from WorkloadPanel; the group scope state, route hydration
and effects from useWorkloadSelectionState; the per-group summary
scope map that useWorkloadsState rebuilt on every filtered-guest
change; the GuestRow group-member attribute; and the workloads
summaryGroup route param. Group rows stay identity-only dividers and
keep data-summary-group-id, so clicking one still leaves an open guest
drawer alone. NodeDrawer stays live in the Proxmox nodes table, and
the temperature guardrail now pins that live mount.

Contract prose now describes static dividers in rule 8 and the
Workloads, Proxmox and vSphere clauses, and corrects stale sentences
about grouped node rows opening the node drawer and about Workloads
selection writing back to the route.
2026-10-07 23:50:50 +01:00
rcourtman 1a094646d7 Let only POST narrate single-resource reports with Pulse Assistant (#2716)
## What

Single-resource report generation (`/api/admin/reports/generate`) now
takes `POST` with a JSON body as its canonical transport, and only
`POST` may narrate a PDF with Pulse Assistant.

- **POST**: the same fields as before (`resourceType`, `resourceId`,
`format`, `metricType`, `start`, `end`, `title`) in a JSON body, decoded
with the `generate-multi` rules (1MB cap, unknown fields and trailing
payload rejected). When Pulse Assistant is configured, a PDF's executive
summary is narrated by the AI provider as before.
- **GET**: still accepts the same fields as query parameters and returns
the same report, but always uses the deterministic summary. The PDF
shows a short note in place of the "Configure Pulse Assistant" tip,
which would be wrong for a tenant that already has the Assistant
configured.
- **GET never resolves the AI service at all.** It reads Patrol findings
only from a tenant AI service that is already running, through a new
`AISettingsHandler.ExistingAIService` lookup. Constructing a tenant
service through `GetAIService` can list provider models or start
background discovery, so a report GET must not trigger it. The router's
reporting wiring moves into `Router.wireReportingAIResolvers` so a test
can drive it.
- **Other methods**: `405` with `Allow: GET, POST`.
- The shared report body decoder now also returns `body_too_large`,
rather than `invalid_body`, when the cap is hit while reading past a
valid value.
- The reporting catalog advertises
`performanceReport.singleResourceMethod: "POST"`, and the settings UI
follows it. A catalog without the field, and the legacy fallback
catalog, keep the GET query transport that older backends accept. Fleet
reports were already `POST`.
- `docs/API.md` and `docs/MSP.md` (and their shipped copies) document
both methods.

## Why

Before this change, a GET for a PDF resolved the tenant's AI narrator.
That made a paid provider call and recorded a usage event in the AI cost
ledger. GET passes the demo-mode guard and the CSRF check, and a
SameSite=Lax session cookie is sent on cross-site top-level GET
navigations. So following a link could spend a signed-in admin's AI
budget.

GET stays available rather than returning `405` because the API
reference and the MSP guide documented it for scripted exports. Breaking
those scripts would add no protection: CSV is never narrated, and GET no
longer reaches the provider.

## Verification

- `TestContract_SingleReportAINarrationRequiresPOST` drives a real
report engine with a counting narrator. GET, HEAD, PUT and DELETE make
zero narrator calls and POST makes one. The GET narrative is heuristic
and carries the note. As a negative control, the same test fails against
the handler on `main` via `go test -overlay` ("GET report called the AI
narrator 1 times, want 0").
- `TestContract_SingleReportGETDoesNotConstructTenantAIService` drives
the router's real resolvers with an uncached tenant: GET constructs no
tenant AI service, while POST resolves one. A negative control that
swaps `ExistingAIService` back to `GetAIService` fails it ("GET report
constructed 1 tenant AI services, want 0").
`TestAISettingsHandler_ExistingAIServiceNeverConstructs` covers the
lookup itself.
- Handler tests cover the POST body rules (empty, unknown field,
trailing value, form-encoded body, fields only in the query, oversized
padding) and the `Allow` header. The catalog contract snapshot includes
the new field.
- Frontend tests cover POST bodies, the GET transport for catalogs that
name GET, parser defaults and validation, and the legacy fallback.
`docsLinks.test.ts` ties the docs to the handler.
- Browser pass on a private stack: real login, dev Pro licence, and
Pulse Assistant pointed at a local stub OpenAI-compatible provider that
logs every call. Checked at 1280×800 and 390×844:
- Generating a single-resource PDF from Settings → Data & Reports sends
one `POST` with a JSON body, downloads the PDF and calls the provider
once. The downloaded PDF carries the AI narrative.
- CSV makes no provider call. The fleet report still posts to
`generate-multi`.
- A top-level browser navigation to the GET URL with the session cookie
downloads the deterministic PDF, with the new note, and makes no
provider call.
- HEAD, PUT, DELETE and PATCH return `405`, and a session POST without
the CSRF header returns `403`.
  - The AI usage summary lists `report_narrative` only for the UI POSTs.
- Full `./internal/api/...` and `./pkg/reporting` run on the dev VM:
everything passed apart from two tests that fail there for environment
reasons in code this change does not touch
(`TestServerInfoEndpointReportsDevelopment` needs `.git`; a `configapi`
shell-hangup bootstrap test).

The same class of issue on the Assistant session routes
(`/api/ai/sessions/{id}/summarize` and friends) is handled separately in
#2670.
2026-10-07 23:48:46 +01:00
rcourtman 4292c180b2 Retire the summary hover E2E spec pinned to removed surfaces
The quarantined 48-summary-hover-selection spec never ran, and none of
its nine tests could pass against the current app. Each one opens
/workloads or /storage, which no route matches since the platform-first
IA, or /infrastructure, which is now only an entry route that redirects
to the first platform page, and then waits for the workloads,
infrastructure or storage summary cards that were deleted with the
standalone surfaces.

The storage pool-group pin test was the only candidate for a port to
/proxmox/storage, but it asserts behaviour that page does not have. A
group-header click there collapses the group as it pins it, so the
member rows the test expects to stay visible and pinned are hidden, and
there are no summary charts left for the pin to rescope. The live pin
(hover preview, the summaryGroup URL param, pinned member emphasis
after expanding, Clear selection) is already covered in Storage.test.tsx.

Deleting the file takes its QUARANTINED_SPECS entry with it, because
the tier check rejects ledger entries for specs that do not exist.
2026-10-07 23:47:38 +01:00
rcourtman fd36869223 Judge source merges by the ingest's stale thresholds (#2717)
Stacked on #2715 (its commit is the parent of this one); either can land
first.

## Problem

`mergeInto` passed nil thresholds to `mergeMetrics`, so every source
merge into an existing row (snapshot and record ingest alike) judged
metric freshness by the registry defaults, while the stale pass and
manual links used the monitor's configured thresholds. Two visible
results:

- A Proxmox node polled every two minutes (four-minute threshold) merged
with its auto-linked agent showed the silent agent's CPU and memory,
while the stale pass called the node's poll current.
- A supplemental refresh (`MonitorAdapter.PopulateSupplementalRecords`,
and the read-state overlay) of a linked vSphere VM kept the in-guest
agent's memory over vSphere's current reading, where a full rebuild from
the same records shows vSphere's.

## Change

- Snapshot and record ingest hold the caller's thresholds on the
registry while they run (the same per-pass pattern as the guest loop's
agent index), and `mergeInto` passes them to `mergeMetrics`. The
snapshot helpers that reach `mergeInto` keep their signatures.
- The stale pass and the metric merge share one threshold rule,
`sourceStaleThreshold`, so the merge also honours a sighting's expected
update interval (slow Proxmox disk inventory), as the stale pass already
did.
- Outside mock mode the monitor configures only Proxmox, PBS and PMG, so
those are the production sources this changes; mock mode also configures
TrueNAS, vSphere and availability.

## Proof

- `TestMonitorAdapterSourceMergesUseConfiguredStaleThresholds`: rebuild,
supplemental refresh and overlay of a linked vSphere VM, plus a node
with an auto-linked agent, through
`NewMonitorAdapterWithStaleThresholds`.
- `TestSourceMergesJudgeFreshnessByTheIngestStaleThresholds`: snapshot
node+agent merge with and without thresholds.
- `TestMetricMergeFreshnessMatchesTheStalePass`: the merge and the stale
pass agree for default, configured and expected-interval sightings.
- Negative control with #2715's `registry.go`: the supplemental,
overlay, node+agent, snapshot and expected-interval cases fail; the
rebuild case and the defaults case pass on both.
- `go test ./internal/unifiedresources/... ./internal/monitoring/...
./internal/api/resourceapi/... ./internal/mock/...` on pulse-dev.
2026-10-07 23:40:40 +01:00
rcourtman 7f45148d15 Drop the unused Patrol readiness-failure object behind the toggle toast (#2687)
Stacked on #2686 (which stacks on #2682 and #2674); this branch carries
their commits until they land. Only the top two commits are new.

## What

`buildPatrolSettingsReadinessFailure` built a full
`PatrolConfigurationFailureInput` for the Patrol page's inline "needs
attention" state. That state lost its render in 27ba85ddc6 (2026-06-23),
when the Configure Patrol popover was removed. Since then its only
production caller, the Patrol on/off toggle, has read just `.message`,
and that was always the fixed copy "Patrol setting was saved, but Patrol
is not ready to run."

- `getPatrolSavedReadinessWarning` returns that message when the saved
response reports `patrol_readiness` `not_ready`, and the toggle shows it
as a warning toast, as before.
- `buildReadinessDetails` and the `PatrolConfigurationFailureInput` type
are removed. Its last other consumer,
`getPatrolConfigurationFailureInlineDetails`, goes in #2686.
- The Assistant drawer still restores saved
`patrol_configuration_failure` sessions. Nothing on that path changed.

## Runtime delta

- Production builds of the parent and this branch differ in one chunk,
`AIIntelligence.js` (the Patrol page), which is 935 bytes smaller. After
normalising chunk hashes, SRI strings and minified identifiers, the only
change is the removed builder and details helper, replaced by one status
check. The toast string is byte-identical.
- The minifier had already folded `message || readiness.summary ||
default` to the caller's constant, so the readiness-summary fallback was
unreachable.
- The toggle no longer reads seven Patrol signals to build the object it
discarded.
- `check-bundle-size.mjs` passes.

## Verification

The same Playwright script ran against embedded builds of the parent and
this branch, at 1440 and 390 px, on a demo mock stack. Responses were
stubbed with `page.route`. All 31 observed fields were identical between
the two builds. In every case only a toast appears, with no inline
alert, no "needs attention" text and no Assistant action:

- Patrol on/off, switched off and back on, with a not-ready response:
the warning toast fires in both directions.
- A rejected Patrol mode save shows an error toast with the server
reason, and the mode returns to Watch only. An accepted save switches to
Ask first with no toast.
- Settings > Pulse Intelligence > Patrol and Provider & Models saves
with a not-ready response show a warning toast naming the summary,
provider and model.
- When Patrol status reports not ready, the page's own readiness banner
names the summary, provider and model, and the header shows Fix setup.

Tests: `src/features`, `src/utils` and `src/__tests__` pass, except the
known Mac-only `agentInstallCommand.test.ts`. `tsc --noEmit` passes.
contract, registry and status audits pass.

## Tests and pins

- The hook tests now cover the warning helper.
- The #1789 test pinned `blockedCause: patrolStatus()?.blocked_cause`.
That matched only the removed dead field, not the `blockedCause` memo
the test was written for, so it now pins the memo.
- `frontendResourceTypeBoundaries` pins the new helper name.
- A negative control (mutating both pinned lines) fails all four
affected tests.

## Contracts

`patrol-intelligence`, `frontend-primitives` and `api-contracts` still
described the retired Patrol schedule and model popover, its inline
dialog failure state, and a saved-configuration-issue surface with cause
metadata. They now say:

- where Patrol settings live (Settings > Pulse Intelligence > Patrol,
and Settings > Provider & Models);
- that every save outcome is a toast;
- that the Patrol page's readiness banner carries the not-ready
diagnosis.

The popover rules apply only if a popover returns. The popover-era
alert-trigger clauses are handled separately in
docs/patrol-settings-contract-location.

A second, docs-only commit fixes the patrol-intelligence clause that
still placed the Patrol mode selector in a "configuration dialog". The
selector now renders only in the header's `Mode and automation`
disclosure, and that clause sits directly under #2682's hunk, so it
lands here rather than in docs/patrol-settings-contract-location to
avoid a conflict.
2026-10-07 23:27:33 +01:00
rcourtman 796a70999b Stop tenant incident stores racing on shared ID counters (#2711)
Each tenant monitor owns its own `IncidentStore`, but incident and
incident-event IDs came from package-level `int64` counters bumped with
`++` under nothing but the calling store's mutex. Two tenants recording
alerts at once raced on them. `go test -race` failed
`TestLeavingMockModeClearsEveryRunningTenantMonitor` on #2698
([run](https://github.com/rcourtman/Pulse/actions/runs/37652317098/job/112919080928))
at `incidents.go:1753`. The remediation record counter in
`remediation.go` had the same shape, and `startPatrolForContext` creates
one remediation log per org.

**Fix**
- All six `internal/ai/memory` ID generators (incident, incident event,
remediation record, memory, incident memory, pattern memory) now mint
through one atomic helper, `nextSequencedID` in `ids.go`.
- The numeric suffix no longer wraps at 1000. Even with atomic counters,
a generator that minted more than a thousand IDs in one wall-clock
second repeated an ID. That matters because `RecordNote` finds an
incident by ID and the incident query deduplicates merged events by ID.
The `<prefix><YYYYMMDDhhmmss>-<n>` layout is unchanged. Only `n` can now
exceed three digits.
- `intToString` lost its last runtime callers and is removed.

**Proof**
- `internal/ai/memory/ids_test.go` mints 2,400 IDs from every generator
on 16 goroutines and records alerts into two tenant stores concurrently.
- Against the `origin/main` runtime files (via `-overlay`), `-race`
reports DATA RACE at `incidents.go:1753/1760` and `remediation.go:355`,
and every generator fails the uniqueness/shape check: four produce
duplicate IDs, and `mem`/`pat-mem` produce a wrapped `-0` suffix.
- With the fix, `go test -race ./internal/ai/memory/` passes, and `go
test -race -count=5 -run
TestLeavingMockModeClearsEveryRunningTenantMonitor
./internal/monitoring/` passes.

**Residual:** across restarts, only the timestamp separates IDs. If the
local clock repeats a second (DST fall-back or a backward step), a
restarted sequence could still meet an earlier suffix. Persisted IDs and
the stored format are unchanged. The `ai-runtime` contract records this.
2026-10-07 23:26:15 +01:00
rcourtman ad96886eab Remove unused CorrelationsResponse type (#2710)
CorrelationsResponse described the `/api/ai/intelligence/correlations`
payload. #2674 removed its uses in the Patrol investigation context
model and that model's tests, and #2677 removed the last ones
(`AIAPI.getCorrelations` and the aiIntelligence store's correlation
loader). This deletes the now-unreferenced interface from
`frontend-modern/src/types/aiIntelligence.ts`.

`ResourceCorrelation` stays: `ResourceIntelligence.correlations`, the
resource drawer's relationship map (`ResourceCorrelationSummary.tsx`)
and `resourceCorrelationPresentation.ts` still use it.

Proof:
- `git grep CorrelationsResponse` over the whole repository at the base
commit finds only the definition.
- `npx tsc --noEmit` in frontend-modern (tsconfig includes all of `src`,
tests too) passes.
- `vitest run src/types src/api src/stores src/features/patrol
src/utils`: 7295 passed. The only failures are 6 tests in
`agentInstallCommand.test.ts` that need a TTY (`termios.error:
Inappropriate ioctl for device`); they fail identically on the unchanged
base tree.
- `npm run build` before and after emitted the same 187 dist files with
identical SHA-256 sums, so the shipped bundle is byte-identical.
- Browser receipt
`frontend-modern/browser-verification/71a0ce6b24830582.json`: embedded
build in a demo-mode mock stack, `/patrol` and the `/kubernetes`
deployment drawer at 1280x800 and 390x844, no console or page errors.

No contract prose mentions the type, so the commit carries a
`Contract-Neutral:` trailer instead of a patrol-intelligence contract
note.
2026-10-07 23:16:20 +01:00
rcourtman 89a05ed735 Pin each manual-link side from its own identity
A manual link merges two resources for display, and the durable
identity pin was written from that merged identity. A link primary was
pinned with the folded resource's machine key, and the store's
one-owner-per-key rule then deleted the folded resource's own pin.

A Proxmox node's pin records its qualified endpoint as the hostname, so
on the next rebuild the node completed the linked agent's machine key
from that pin, minted the agent's machine-derived ID and merged with
the agent by ID before the link applied. With the node as primary,
succession then rewrote the link into a self-link on the agent's ID; in
either direction, removing the link left the pair merged.

The registry now captures each link side's own pin when the link first
joins it in a rebuild, and PersistIdentityPins writes those instead of
the merged projection, keeping a pinnable folded side under its own
canonical ID. Proxmox auto-links merge by identity before any manual
link applies, so their boot-window pins are unchanged.

A link side rewrites its whole row through a new
ReplaceResourceIdentityPins. Like an upsert it keeps stored fields its
own pin leaves empty, but it drops a strong key another resource holds,
since an earlier release borrowed that key from the merged identity and
the store's one-owner rule would otherwise delete one row or the other.
A folded side drops a strong key a live resource or an earlier folded
side already holds, so the two never trade it on every rebuild, and
writes no pin when that would leave it without its machine evidence.

A node row an earlier release filled with the agent's machine key is
handed back only when the node cannot complete from it. With a
qualified endpoint or a cluster name, completion still supplies the
borrowed key before the link applies, so such a pair stays merged.
2026-10-07 23:14:06 +01:00
rcourtman c5416b6800 Alert on the Unraid temperature an agent disk shows (#2701)
Stacked on #2698 (which sits on #2694, #2685 and #2679); this PR's own
change is the top commit, "Alert on the Unraid temperature an agent disk
shows", plus a merge of main for an alerts.md anchor both touched.

## Why

A host agent's physical disk can show a temperature that only the host's
Unraid inventory reports:

- a SMART row whose smartctl probe returned no temperature takes its
Unraid row's reading (`HostSMARTDiskTemperature`), and
- a disk only the inventory lists, such as a `--disk-exclude` match, is
built from its Unraid row alone (`HostUnraidDiskTemperature`).

Physical Disks (Temp cell and the `Running Hot` verdict, "at or above
its alert threshold") and Patrol judge that reading against the alert
disk temperature policy, but `CheckHost` only read the SMART row's own
field. A disk could read as at its alert threshold while no alert fired.

Unraid's own warning/critical disk temperature notifications do not make
this redundant: Pulse already alerts on the smartctl readings and array
state of the same hosts, which Unraid also notifies on.

## What changes

- `unifiedresources.HostDiskTemperatureReadings(host)` lists the reading
each of a host's disks shows, built with the registry's own adapters:
one per SMART row the registry ingests, then one per Unraid row whose
disk key no SMART row carries (the same rule as the history writer in
#2698).
- `CheckHost` judges those readings:
- SMART rows keep their `agent:<host>/disk_temp:<device>` resource IDs.
An inventory-only disk uses its block device token, which is the ID a
plain Linux SMART row for that device uses, so a later SMART reading
continues the same alert.
- Per-type thresholds and host overrides use the disk type the disk
shows.
- Only a reading collected now fires or resolves, so a spun-down disk
holds its alert.
- When conflicting serials put two disks on one device, its alert judges
the reading that stands highest against its own type's threshold.
- An inventory-only disk matching the agent's `--disk-exclude` raises
nothing, and an alert it raised before the exclusion resolves on the
next report. This matches the documented exclusion from monitoring and
how linked Proxmox hosts already treat excluded disks.
  - Absence cleanup still runs only on a non-empty SMART list.

## Verification

- New alert tests in `internal/alerts/host_unraid_lifecycle_test.go`
cover: the fallback, an inventory-only disk, an empty SMART list, two
disks on one device (also of different types), a controller member under
another device label, standby, exclusion, disk-type and host-override
thresholds, holds, handover to a SMART reading, departure, and the
exclusion clear.
  - Each fails on the previous `host.go`.
- Removing any guard (exclusion skip, exclusion clear, disk type,
collected-now, threshold ranking) fails its own test.
- `TestHostDiskTemperatureReadingsMatchTheDisksTheRegistryShows`
compares every reading with the disk the live registry ingests,
including conflicting serials, a virtual device and a MegaRAID member
Unraid lists under its block device.
- `go test ./internal/alerts/... ./internal/unifiedresources/...` passes
on the merged tree, as do the Unraid/SMART/temperature tests in
`internal/monitoring`.
2026-10-07 23:11:02 +01:00
rcourtman a14584d9f1 Drop the summary focus bridge members nothing reads (#2709)
The jump-to-row affordance lost its only consumer when the summary
components were deleted, yet the bridge kept computing it on every
Workloads and Storage page: a capture-phase window scroll listener and
a resize listener re-measured the hovered or focused row on each frame
and hover change, walking its ancestors with getComputedStyle. On the
12-node mock storage table that was 128 calls across eight row hovers
and 320 across ten scroll steps, now none.

Storage's reveal callback kept branches that switched between the
pools and disks views for that jump. Focus only ever names a row in
the active view, so drop them and the disk-id memo that served them.

The chart-hover input went the same way. No summary chart renders, so
setChartHoverSync was never called and the resolver's chart branch was
always fed null. Remove the signal, its type and the resolver option,
and say in the contract how a returning chart re-enters the shared
scope instead.

Focus reveal, pinned-group reveal, Escape and row emphasis behave as
before at desktop and phone widths; the browser receipt records the
before/after pass.
2026-10-07 23:06:34 +01:00
rcourtman e7cabc72f1 Hide pprof routes on demo-mode instances (#2708)
The `/debug/pprof` handlers are gated on `RequireAdmin` plus a
`settings:read` scope that session logins skip. A `DEMO_MODE` instance
that signs visitors in as the configured admin therefore served every
visitor goroutine and heap dumps, the process command line, and CPU
profiles and execution traces that load the whole process. Demo mode
already hides diagnostics, logs, admin users and manual discovery
through the admin-operations policy; pprof was missing from it.

## Change

- `internal/api/demo_mode_operations.go`: through the admin-operations
policy, the demo guard answers `/debug/pprof` and every path below it
with `404` for every method, ahead of route authentication, so a write
probe such as the `POST` symbol lookup gets the same `404` instead of
the generic demo `403`. Instances outside demo mode keep the routes, and
`PULSE_PPROF_DISABLED` still removes them everywhere.
- Contract notes in api-contracts (owner), agent-lifecycle and
storage-recovery.

## Proof

- `TestContract_DemoModeHidesPprofFromDemoAdminSession` signs in as the
demo admin through the full router. The same session gets `200` from
`/debug/pprof/cmdline` below the demo guard, and `404` for eight pprof
paths × `GET`/`HEAD`/`OPTIONS`/`POST` through the served handler.
Against the previous policy (`go test -overlay`) `GET` and `HEAD`
returned pprof output (`200`, or the root's `301` into the index),
`OPTIONS` got the router's preflight `200` and `POST` the generic demo
`403`.
- `TestPublicDemoAdminOperationsPolicyHidesEveryDebugRoute` parses the
router files and fails if a literal route under `/debug/`, with or
without a method prefix, escapes the policy for any of seven methods, so
a new debug handler there cannot ship reachable on a demo by default. A
temporary `GET /debug/vars` registration made it fail as expected.
- Path-handling probe (not committed): 210 raw requests (35 request
targets × six methods), covering trailing and double slashes, dot
segments, `%2F`/`%2e` encodings, absolute-form targets and `CONNECT`,
run against a copy of the router's mux dispatch. None reached a pprof
handler; paths the mux would clean onto pprof only receive a redirect,
and the policy catches the follow-up request.
2026-10-07 22:57:17 +01:00
rcourtman 6263c580f7 Judge a linked agent's guest disks by that agent everywhere (#2712)
Follow-up to #2669, which made the guest drawer's filesystem rows follow
a linked Pulse agent's freshness. The workload table's disk cell and the
drawer History still judged the same guest by the Proxmox read reason,
so one guest disagreed with itself across the three.

## What changes

- **One rule for three readers.** `getWorkloadGuestDiskRead`
(`workloadGuestPresentation.ts`) now drives the table disk cell, the
drawer's filesystem rows and History. When the linked agent's
filesystems fill in for a VM that has no Proxmox guest filesystems, the
reading is current while the agent reports, last known once it is stale,
and unavailable once the guest is stopped. Proxmox's own guest
filesystems keep their read reason.
- **Where the aggregate disk metric comes from.** On a manually linked
VM, Proxmox records no guest disk usage without guest filesystems, so
the registry's link merge keeps the agent's disk metric. A registry test
pins that.
- **Poller carry-forward.** `previousVMFromView` built the previous VM
from the merged metric, so the next poll carried the agent's disk
forward as a Proxmox `prev-agent-not-running` read. Proxmox priority
then froze it over the agent's live value. Only Proxmox's own disk
reading is carried now (`VMView.DiskFromLinkedAgent`).
- **`agent.stale` is always on the wire.** The browser merges agent
facets field by field, so an omitted false kept a resumed agent "stopped
reporting" until a reload. This affected Machines rows and node drawers
too.
- **Withdrawn filesystems.** The websocket merge kept filesystems that a
native Proxmox VM facet or a native agent facet (which always carries
`stale`) no longer reported, including in the `platformData.agent`
mirror that host threshold rows read.

## Verification

- New tests, each failing on main: `GuestRow.test.tsx`,
`GuestDrawer.test.tsx`, `workloadGuestPresentation.test.ts`,
`resourceStateAdapters.test.ts`,
`TestPreviousVMFromViewKeepsLinkedAgentDiskOutOfProxmoxCarry`,
`TestAgentDataAlwaysSendsStale`,
`TestVMViewDiskFromLinkedAgentFollowsSelectedMetricSource`, and
`TestResourceRegistry_ManualGuestAgentLinkDiskMetricFollowsProxmoxGuestFilesystems`.
The registry test is a characterization test; it fails when the agent
outranks Proxmox on guest disk.
- Private mock stack at 1440 and 390, with agents linked into VMs
through `POST /api/resources/{vm}/link`:
- Live agent, no QEMU guest agent: before, "- Unavailable · Guest agent
not running", with History deferred; after, the agent's bars, nothing
deferred.
- Silent agent: before, "- Unavailable"; after, bars plus "Last known"
(phone: "Prior"), with History deferred on the agent message.
  - Stopped guest: Unavailable.
  - A guest with Proxmox filesystems: unchanged.
- Machines row for a standalone agent released from a silent hold,
watched without a reload: on main it kept "(stale)"; now it clears.
- Bundle: WorkloadsSurface 61.93 kB gzip against a 70.23 kB cap.

## Known residuals

- Mock mode's websocket state does not apply manual links to resources
ingested as records (`ingestRecords` never runs `applyManualLinks`), so
the browser pass ran the Proxmox page on REST data. In production this
likely affects links to vSphere or TrueNAS resources; it is tracked
separately.
- A stale Proxmox source can lose the aggregate to a live agent while
its own filesystem rows and `prev-` reason remain. That guest stays on
the Proxmox rule and reads its live aggregate as last known, which is
the same as main and errs toward caution. A guest with no platform read
reason can likewise keep a retained aggregate after the agent withdraws
its filesystems, also as on main. Both need aggregate provenance on the
wire.
2026-10-07 22:55:02 +01:00
rcourtman 15322e1573 Drop contract prose for the deleted problem-resource surfaces (#2706)
Contract prose still described surfaces that no longer exist:

- `frontend-primitives.md` told new route-level copy to extend
`problemResourcePresentation` (deleted in ae65c5e9a2), tied that helper
to `ProblemResourcesTable.tsx` (deleted with the dashboard overview in
c743a231b8), and kept a readability rule for that table and the
dashboard Pulse Brief. No live surface implements the rule; Patrol's
grouping and affected-resource counts are governed in
`patrol-intelligence.md`. The ownership paragraph and the rule are
dropped, and problem-resource joins the list of deleted dashboard
helpers that must not return.
- `unified-resources.md` said the change and correlation summary cards
default Infrastructure resource-filter links for the Patrol page and the
problem-resource dashboard panels. Since the 2026-05-16 drilldown
retirement the cards have no link default and render only in the
resource drawer, which passes no link builder.
- `api-contracts.md` named the dashboard Pulse Brief as a sender of
`autonomous_mode:false` and described the field as a client override.
Since 4edf5f8265, `ChatRequest` has no such field: the server runs every
`/api/ai/chat` exchange in approval-required mode (pinned by
`TestHandleChat_CannotElevateAutonomousModePerRequest`), and the field
is dropped at decode.

The new `subsystem_lookup_test.py` case pins the deleted helper as
unowned, next to the other retired dashboard paths.

Verification: `contract_audit.py`, `registry_audit.py` and
`status_audit.py` pass with `--check`; the retired-path lookup tests
pass (9/9); the full pre-commit battery passed. No frontend or backend
runtime files change.
2026-10-07 22:44:27 +01:00
rcourtman 23bf99e1ba Keep alert settings a config save leaves out (#2689)
## Problem

Saving anything on Alerts > Thresholds turned flapping detection and
alert TTL cleanup off. The page's `PUT /api/alerts/config` body never
carries `flappingEnabled`, `maxAlertAgeDays`, `maxAcknowledgedAgeDays`,
`autoAcknowledgeAfterHours` or `customRules` (the page has no control
for any of them). `UpdateAlertConfig` decoded the body into a zero
`AlertConfig`, so every save wrote `false`/`0` for those fields, reset
the flapping tuning to defaults, dropped custom rules, and persisted
that. The `flapping`, `aggregation` and `ioNormalization` objects the
page sends are not `AlertConfig` fields and never enabled anything.

## Fix

- `PUT /api/alerts/config` now replaces only the top-level keys the body
carries. A key left out keeps its stored value. A sent key replaces its
setting whole, so `"overrides": {}` still clears overrides, and the
usual normalization still runs. A body that is not a JSON object
(including `null`) is a 400 and changes nothing.
- `alertconfig.ApplyAlertConfigUpdate` decodes the body on its own, so
sent keys get exact `encoding/json` semantics, including duplicates and
case-folded keys. It copies every unsent top-level field from a JSON
clone of the stored config.
- `Manager.ApplyConfigUpdate` reads, merges and applies under the
manager lock, so concurrent partial saves cannot revert each other. It
returns an owned snapshot, which the handler persists, so
`SaveAlertConfig`'s in-place normalization no longer writes into the
live config's maps. The handler runs one save at a time, so successful
saves reach `alerts.json` in the order they were applied.
- Stored configs are not rewritten; a value an earlier save zeroed stays
as it is.

## Verification

- Unit: `internal/alerts/config/update_test.go`; manager save path and
concurrent partial updates in
`internal/alerts/config_validation_test.go`; handler against a real
manager in `internal/api/alerting/alerts_test.go`. Each new regression
fails against main's code (overlay negative controls). The concurrency
test fails at round 0 against a non-atomic variant.
- `go test ./internal/alerts/... ./internal/api/alerting/` and the
`internal/api` alert endpoint, tenant and scope tests pass; the alert
tests pass under `-race`.
- Private stack (mock mode, Vite on main's frontend):
- On main, a node CPU change saved from the Thresholds page took
flapping and all three TTLs to false/0, in memory and in `alerts.json`.
- With this change, the same UI save kept them (true/7/1/24) and stored
the new threshold.
- The API repro (GET, drop the four keys, PUT) keeps them; explicit
`false`/`0` still applies; `null` and `[]` return 400.
- Five rounds of concurrent partial PUTs kept both changes in memory and
on disk.

## Follow-ups

- The thresholds page still sends the dead
`flapping`/`aggregation`/`ioNormalization` objects and hard-coded
`minimumDelta`/`suppressionWindow`/`hysteresisMargin`. A frontend
cleanup will follow once the open PRs touching
`alertsConfigurationModel.ts` land.
- `SaveAlertConfig` still normalizes caller-owned maps in place for
other callers (`ActivateAlerts`, startup paths), and the GET handler
encodes a shallow copy. That pre-existing race is tracked separately.
2026-10-07 22:23:41 +01:00
rcourtman 36d3f8c557 Judge pulse-relaxed guests by one threshold on poll and save (#2705)
Stacked on #2700 (which carries #2696 and #2692). Merge order is
enforced by the stack: this change must not reach main before #2700's
per-filesystem reevaluation (see "Why stacked" below).

## Problem

`pulse-relaxed` lifts a guest's CPU, memory and disk triggers to a
95/92/95 floor. Only `CheckGuest` applied it. Config-save reevaluation
rebuilt the guest from alert metadata without its tags
(`guestSnapshotFromAlert`), so a save judged a relaxed guest's alert by
its unrelaxed thresholds:

- A relaxed guest with an unset memory threshold alerts at 92 while
polling. On save that reads as no threshold, so the save resolved the
alert and sent a recovery notification, and the next poll raised it
again.
- The floor also lifted an Off threshold (trigger 0, or -1 from the
editors) like any low trigger, so tagging a guest relaxed turned an Off
alert on, with no recovery band (`{95, 0}`). A save then re-judged it
Off and resolved it, and the next poll raised it again.

## Change

- The relaxed step moves into `effectiveAlertPolicyNoLock`'s guest
branch, so `CheckGuest`, config-save reevaluation (including #2700's
`resolveGuestAlertThresholdsNoLock`) and posture checks share one
resolver.
- `guestSnapshotFromAlert` reads the recorded `tags` back, as `[]string`
live or `[]interface{}` after a restart, through a new
`metadataStringsValue` reader. `storagePolicyAliases` now uses the same
reader.
- An Off threshold (trigger <= 0) stays Off under `pulse-relaxed`; an
unset one still gets the floor, as the existing tests pin. The tag is
documented (issue #863) as relaxing thresholds, so it must never make a
guest more sensitive than its config.
- `metricOptionsWithTags` drops the `tags` key from an open alert once
its resource has no tags. Reevaluation now reads that key, so a removed
`pulse-relaxed` left behind would judge the alert by the relaxed trigger
while polling uses the guest's own, and the alert would flap.
Notification tag routing reads the same key, so it also stops routing on
removed tags.

## Why stacked

A filesystem's own override replaces the relaxed guest disk threshold in
`CheckGuest`. On main, reevaluation misses filesystem overrides (fixed
by #2700). With this change alone, a save would judge a relaxed guest's
filesystem alert by the 95 floor instead of, say, an 85 override, and
flap it. `TestConfigSaveKeepsRelaxedGuestFilesystemOverride` fails on
main plus this change and passes on this stack.

## Proof

New tests in `internal/alerts/alerts_test.go` and
`internal/alerts/unified_eval_test.go`. With `go test -overlay` mapping
the six runtime files back to #2700's head, these fail:

- `TestConfigSaveJudgesRelaxedGuestAlertByRelaxedThresholds` (the save
resolved the alert)
- `TestPulseRelaxedKeepsOffGuestThresholdOff` (a disk alert was raised
with disk Off)
- `TestApplyRelaxedGuestThresholds/off_thresholds_stay_off` (Off became
`{95, 0}` / `{92, 0}`)
- `TestCheckGuestDropsRemovedTagsFromOpenAlerts` (stale tags; with only
the metadata assertion relaxed, the save resolves the alert)

`go test ./internal/alerts/... ./internal/notifications/` and the
monitoring alert tests pass.
2026-10-07 21:59:48 +01:00
rcourtman b7049ff778 Raise Proxmox disk temperature alerts under the per-type policy (#2680)
**Stacked on #2675** (TrueNAS disk temperature alerts by disk type).
Merge that first; this branch contains its commit.

## Problem

A Proxmox physical disk that only the node's own sensors report never
raised a temperature alert:

- `CheckDiskHealth` judges health and wearout only;
- unified evaluation types TrueNAS physical disks, not PVE ones.

So Physical Disks could read a disk **Running Hot** under the per-type
thresholds while alerts stayed silent. Whether a disk alerted depended
on whether a Pulse agent ran on the node: agent-covered disks alert
through `CheckHost` at the same thresholds. #1347 shows users look for
disk temperature thresholds in the Proxmox tabs.

## Change

- **`CheckProxmoxDiskTemperature`**
(`internal/alerts/proxmox_disk_temperature.go`) raises a
`diskTemperature` metric alert under the disk's existing PVE alert
reference. It is judged by the disk temperature policy: the disk type's
`DiskTempByType` entry under the agent Disk Temp default, which switches
it off for every type. The alert carries the disk's serial, WWN and
`diskType`, like the health and wearout alerts.
- **One alert per disk.** `mergeHostAgentSMARTIntoDisks` marks a disk
that a still-reporting linked agent lists in its SMART report
(`AgentSMARTReported`, internal, never serialized). That disk is the
agent's: `CheckHost` alerts on it, and an open PVE alert closes with
`moved_to_agent`. A lapsed agent owns nothing, so the node's own current
readings keep alerting while its agent is silent.
- **Holds and clears.** Only a reading collected this poll is judged
(`diskinventory.TemperatureCollected`), so a retained value holds the
alert. An excluded device, or a switched-off policy, closes it.
- **Stability.** A new `proxmox-disk` alert delay defaults to 5s, so
warnings wait the same 300s noisy-gauge window as agent and TrueNAS disk
temperatures. Critical readings bypass it.
- **Config save.** `reevaluateActiveAlertsLocked` re-judges the alert
per disk type. Without this it would fall through to guest thresholds,
which have no disk temperature, and resolve on every save. An alert
without a recorded type uses the lowest per-type trigger.
- **History.** `ProxmoxPhysicalDiskAlertIdentifiers` lists the new
`<ref>::metric-threshold:diskTemperature` identifier, so resource
history owns its rows by recorded hardware identity, as #2646 does for
health and wearout.
- **Copy.** The Agents "Disk temperature by type" card says it covers
agent, TrueNAS and Proxmox disks.

## Evidence

Private mock stack (8 PVE nodes) with a local-only overlay pinning PVE
disk readings:

| Disk | Physical Disks | Alert |
|---|---|---|
| pve1 NVMe 63°C | Healthy | none |
| pve2 SATA 56°C | Running Hot | warning, trigger 55, after the 300s
window |
| pve3 NVMe 72°C | Running Hot | warning, trigger 70, after the 300s
window |
| pve3 SAS 63°C | Healthy | none |
| pve3 SATA 66°C | Running Hot | critical at once |

The alert card reads: "Samsung 870 EVO 1TB (/dev/nvme2) · Temperature ·
Temperature 66°C, above the 55°C alert level · Clears once it drops to
50°C or lower and stays there for 5 minutes."

## Tests

- `internal/alerts/alerts_test.go`:
  - the policy (per type, raised trigger);
- ownership with `moved_to_agent`, the hold without a reading,
exclusion, the off switch;
  - the stability window;
  - re-judging on save, including the lowest-trigger hold;
  - history identifiers.
- `internal/monitoring/physical_disk_roundtrip_test.go`: the marker for
reporting agents only (not a lapsed one), the SMART fallback path, and
that `checkPhysicalDiskAlerts` passes collected readings, ownership and
exclusion.
- `internal/unifiedresources/store_test.go`: a temperature alert row is
owned by its disk and still found by a read by its reference.
- `internal/models/deepcopy_test.go`: the marker survives cloning and
stays out of JSON.
- `ThresholdsTable.test.tsx`: the card copy.
- Ten wiring points were mutation-checked (marker, lease condition,
collected reading, ownership, exclusion, re-judge branch, lowest
trigger, resolution, history identifier); each removal fails a test.

## Second opinion

- Fixed: an offline agent's retained SMART rows kept ownership, so
neither side alerted while the agent was silent. Ownership now needs a
reporting lease.
- Kept, documented in `alerts.md`: on the first poll after an agent is
newly linked to a disk with an open PVE alert, both alerts can be open
until the next disk poll. This is the same window as the node-to-agent
usage alert handover.

## Not in this PR

- Like the health and wearout alerts, a disk that leaves the inventory
keeps its temperature alert until the 24-hour stale sweep.
- Per-host Disk Temp overrides do not reach PVE-only disks, which have
no agent host.
2026-10-07 21:59:39 +01:00
rcourtman b814ccdd81 Count down to future Patrol times instead of reading just now (#2702)
`formatRelativeTime` is past-only: a time ahead of now reads "just now"
(compact) or "0s ago". Three Patrol lines handed it future times, so
each read wrong for its whole duration:

- Attention detail, suppressed issue: "Returns to active attention just
now." (also for an issue marked reviewed, which expiry hands back to
Reviewed, not active attention)
- Findings, will-fix-later: "Reminding just now"
- Findings, snoozed: "snoozed until just now"

Supersedes #2613, rebuilt on main now that #2598 has landed (#2613 was
stacked on two early #2598 commits whose contract wording main has since
replaced).

## Change

- `formatTimeUntil` in `utils/format.ts`, beside `formatRelativeTime`:
counts down ("in 3h", "in 1d"), rounds to the nearest unit (a 24-hour
suppression set a moment ago reads "in 1d", not "in 23h"), and returns
`dueText` (default "now") once the time arrives. `formatRelativeTime`
stays past-only and its doc points future times at the new helper.
- The three lines use it with the shared relative-time clock
(`useRelativeTimeNow`), since none of those times change while the panel
stays open, and keep the exact time on hover.
- Suppression line: "Returns to active attention in 1d." for an open
issue, "Suppression ends in 1d. It stays reviewed." for one marked
reviewed, "Suppression has ended." once due. It takes its words from
`getAttentionSuppressionEndPresentation` (added on main by 844e1dbb97
for the early-end button and duration field), so the countdown, the
button and the duration label always share one reviewed/unreviewed
split. An unparseable expiry renders no line.
- Findings: "Reminding in 7d", then "Reminder overdue". The label, the
Overdue commitments chip and its filter all read one overdue id list
sampled on the shared clock, so they agree even for a row that mounts
between ticks (it reads "Reminder due" until the next tick), and a tick
that moves no deadline past now does not rebuild open rows. The reminder
hover no longer promises the finding returns only "if it is still
tripping"; the hourly reminder sweep brings it back regardless.
- Snooze: "snoozed, returns in 49m", then "snooze ended" until the next
findings read drops the snoozed status (the findings API sends no
status; the frontend store derives `snoozed` from `snoozed_until` on
each read).
- Audit of every `formatRelativeTime` /
`formatPlatformTableRelativeTimeValue` caller: no other future
timestamps. The autopilot and alert snooze expiries already show
absolute times.

The existing countdowns were not a fit: `CountdownTimer` runs its own
one-second interval with no day unit (a 7-day suppression would read
"167h 59m"), and the replication Next sync helper is private to that
table.

Contract notes sit mid-file: the frontend-primitives note follows main's
wall-clock sentence and precedes the read-time age exception (now opened
as "The relative-age rule has one deliberate exception"), away from the
paragraph #2600 adds after that exception.

## Verification

- Unit and component: `format.test.ts`, `FindingsPanel.test.ts`,
`FindingsPanel.links.test.tsx`, `PatrolAttentionWorkbench.test.tsx`. The
countdown tests fail against main's components; the new between-ticks
test fails against the first draft of this rebuild (the row said
"Reminder overdue" with no chip). Patrol, AI, alerts, utils and pages
suites pass apart from `agentInstallCommand.test.ts`, which needs Linux
`stat`; `tsc --noEmit` is clean.
- Live, on a private mock stack built from this tree at 1440 and 390,
with the websocket held (server frames dropped, heartbeat answered),
every GET replayed from cache and the page clock stepped one tick at a
time: an unreviewed and a reviewed suppressed issue counted down 1d →
20h → 29m → "Suppression has ended." with the matching end button; the
reminder went "Reminding in 7d" → "Reminder overdue" with the Overdue
chip on the same tick and findings reads still pending; set 5 seconds
past the deadline with no tick it read "Reminder due" with no chip, and
both moved together on the next tick; the snooze went "in 49m" → "in 9m"
→ "snooze ended", and the next findings read moved it to Active. With
main's components swapped back under the same Vite, the lines read "just
now" and stayed frozen. Receipt:
`frontend-modern/browser-verification/82459c28d2633b61.json`.
- Two second-model review rounds; the first found the between-ticks
disagreement and four wording nits, the second confirmed the fix on
every reminder path and found two nits, both applied.
2026-10-07 21:52:48 +01:00
rcourtman 0b6473affc Fill the table's visible width with phone drawers (#2703)
Phone and tablet table drawers capped their sticky content at
`calc(100vw - 3.5rem)`, a guess at the surrounding page chrome. On pages
with less chrome than that, every drawer stopped short of the table and
left an empty strip on the right: 27px at 390px, measured on the
Availability checks, Proxmox node and guest, Docker host and container,
Kubernetes node and Machines drawers. At tablet widths a table wider
than its shell got a drawer wider than the visible area (712px in
695px).

The table scroll shell already declares `container-type: inline-size`
(the responsive column priorities use it), so `InlineDetailTableRow` now
caps the default content shell at `100cqi`, the shell's own visible
width. Measured live: content equals the visible table width at 320,
390, 768 and 1000px, with no right gap; desktop keeps the static
uncapped layout. The availability drawer's hostname now fits instead of
truncating. Callers passing their own `contentClass` are unaffected.

Not changed here: `.table-fixed td { overflow: hidden }` makes the
sticky offset inert, so a sideways-scrolled table still moves its drawer
(same before and after). Long unwrapped identity chips that were already
clipped are clipped less now; wrapping them is a separate follow-up.

Proof: `InlineDetailTableRow.test.tsx` and the shared-primitive
guardrail pin the new cap and reject the old one; the guardrail already
pins the scroll shell's `container-type`. Browser receipt covers five
routes at 320 to 1440px, before and after.
2026-10-07 21:42:50 +01:00
rcourtman 3fb267333d Require POST for Assistant session mutation routes (#2670)
The session router dispatches `/api/ai/sessions/{id}/abort`,
`summarize`, `fork`, `undo` and `redo` by path alone, and none of those
handlers checked the HTTP method, so a GET or HEAD cancelled a running
turn, compacted or rewound a transcript, or persisted a fork.

- **Demo mode:** `DemoModeMiddleware` admits every GET/HEAD as a read,
so a public-demo session could mutate Assistant sessions despite the
read-only guard.
- **CSRF:** `CheckCSRF` skips GET/HEAD, and session cookies default to
SameSite=Lax, which browsers send on cross-site top-level GET
navigations. A link carrying a session ID could therefore trigger these
mutations for a signed-in user.

## Change

- `requireAssistantSessionMutationMethod` in
`internal/api/ai_handler.go`: abort, summarize, fork, undo, redo and
steer admit only POST and answer anything else with `405` + `Allow:
POST` before resolving the Assistant service. Steer already refused
non-POST but sent no `Allow` header; it now uses the same guard.
- The guard sits in the handlers, matching how chat, steer and the
approval approve/deny handlers already own their method contracts.
- `messages` (GET) and the unsupported `diff`/`revert`/`unrevert` routes
are unchanged. Session rename/delete and the collection route already
dispatch on the method.
- Callers: `frontend-modern/src/api/aiChat.ts` uses POST for all six;
pulse-mobile's abort call and its OTA compatibility probe use POST.

## Proof

- `TestAssistantSessionMutationsRequirePost`: GET/HEAD/PUT/DELETE get
405 + `Allow: POST` for every mutation, with no mutation call and no
`IsRunning` check reaching the service. POST still dispatches.
- `TestAssistantSessionReadSubresourcesKeepTheirMethods`: GET `messages`
returns 200 and GET `diff` returns 501, with no mutation either way.
- `TestDemoModeRouterRejectsAssistantSessionMutationsOverSafeMethods`:
drives `NewRouter(...).Handler()` with `DemoMode` on. GET/HEAD to every
mutation pass the demo guard and get 405, POST stays 403, nothing
mutates, and GET `messages` still reads.
- Negative controls via `go test -overlay`: on main's `ai_handler.go`,
every non-POST case fails and the demo test reports `GET abort status =
200`. With abort's guard moved after the `IsRunning` check, the ordering
assertion fails.
2026-10-07 21:35:21 +01:00
rcourtman 3a482c610c Judge source merges by the ingest's stale thresholds
mergeInto always passed nil thresholds to mergeMetrics, so every source
merge into an existing row judged metric freshness by the registry
defaults while the stale pass, the manual links and the monitor's
configuration used the caller's thresholds. A Proxmox node polled every
two minutes (four-minute threshold) merged with its auto-linked agent
showed the silent agent's readings while the stale pass called the
node's poll current, and a supplemental refresh of a linked vSphere VM
kept the in-guest agent's memory over vSphere's current reading.

Snapshot and record ingest now hold the caller's thresholds on the
registry while they run, the way the guest loop holds its agent index,
and mergeInto reads them. The ~50 snapshot helpers that reach
mergeInto through ingest() keep their signatures. The stale pass and
the metric merge now share one threshold rule, sourceStaleThreshold,
so the merge also honours a sighting's expected update interval (slow
Proxmox disk inventory) as the stale pass already did, and a source
without a default falls back to 120s in both (the merge used 60s).
Every defined source has a default, so that fallback reaches none.

Outside mock mode the monitor configures only Proxmox, PBS and PMG,
so those are the production sources this changes; mock mode also
configures TrueNAS, vSphere and availability.
2026-10-07 21:31:13 +01:00
rcourtman ccc25d269b Correct stale Storage embed and History range contract prose
The storage-recovery contract described an embedded StorageSurface that
opts into its toolbar through a showFilterToolbar prop, keeps tableOnly
to hide a storage summary section, and offers a chart-collapse control,
alongside a RecoverySurface and a forcedPlatformFilter. None of that
exists. Storage.tsx always renders StoragePageControls (only kiosk mode
hides it), the Proxmox Storage tab is the only embed, and
/truenas/storage renders TrueNASStorageTopologyTable rather than
StorageSurface.

The Workloads contracts said the sparkline range appears only while
Trends is active and carries a "Trend range" label. WorkloadsFilter
shows it in Trends and, in Bars, at desktop widths while Row hover is
History, and labels it "History".

A rendered Storage test now pins the embed behaviour the rewrite
describes. The toolbar renders with no opt-in prop. The forced source
outranks a URL source and is never written back. A URL node resets to
all nodes. Neither lock surfaces as a chip, an Add filter option or a
clear action. The History label was already pinned by
WorkloadsFilter.test.tsx and the Workloads performance contract test.
2026-10-07 21:30:25 +01:00
rcourtman 1ac600ec2b Judge filesystem alerts by their own threshold on config save (#2700)
Stacked on #2696, which is stacked on #2692. The unique commit is the
last one, 539eadfab2.

A config save re-judges every active alert
(`reevaluateActiveAlertsLocked`). Filesystem usage alerts were re-judged
against thresholds their evaluator never uses:

- **Agent filesystems** (`agent:<host>/disk:<label>`) were judged by the
host disk threshold. `CheckHost` judges them by the filesystem's own
override, then the `DiskFillByType` threshold for an inferred hardware
type, then the host threshold.
- **Guest filesystems** (`<guestID>-disk-<key>`) were resolved by the
filesystem's resource ID. That ID matches no `guest-disk:` override and
names no guest, so the guest's own override was missed too.

Example: a filesystem override with trigger 70 raises an alert at 80
under a default of 90. Saving any unrelated alert setting resolved the
alert and sent a recovery notification, and the next poll raised it
again as a new alert.

`CheckHost` and `CheckGuest` now resolve a filesystem's threshold
through `hostDiskUsageThresholdNoLock` /
`guestDiskUsageThresholdNoLock`, and reevaluation calls the same
helpers:
- `resolveHostAlertThresholdsNoLock` applies the host helper for agent
filesystem alerts.
- The new `resolveGuestAlertThresholdsNoLock` resolves a guest
filesystem alert's guest by the ID `parseGuestAlertIdentity` reads from
its resource ID.

Both helpers return override and per-type thresholds as owned copies, so
#2696's rule that evaluation never normalizes the live config still
holds.

`TestConfigSaveJudgesFilesystemAlertsByTheirOwnThreshold` (in
`threshold_resolution_shared_test.go`) covers four cases:
- an agent filesystem override
- an NVMe fill threshold
- a guest filesystem override
- a guest-wide override on a filesystem alert

With `host.go`, `guest.go` and `config_runtime.go` overlaid by their
origin/main or #2696 copies, all four fail at the unchanged save. `go
test ./internal/alerts/...` passes, and the new test plus #2696's
`TestAlertEvaluationLeavesTheLiveConfigToTheLock` pass under `-race`.

Known limits, unchanged by this PR:
- Custom rules that filter on live metrics still see no readings during
reevaluation.
- `pulse-relaxed` is not applied during reevaluation.
- The mock generator's dash-separated guest IDs don't parse as guest
identities.
2026-10-07 21:10:14 +01:00
rcourtman 9bd1b6e582 Let only POST narrate single-resource reports with Pulse Assistant
GET /api/admin/reports/generate resolved the tenant's AI narrator, so a
PDF requested with GET made a paid provider call and appended a usage
event to the AI cost ledger. GET passes the demo-mode guard and the
CSRF check, and a SameSite=Lax session cookie rides a cross-site
top-level GET navigation, so a link could spend a signed-in admin's AI
budget.

POST with a JSON body, decoded with the generate-multi rules, is now
the canonical single-resource transport and the only one that may use
the AI narrator. The settings UI sends it, following a new
performanceReport.singleResourceMethod catalog field; a catalog without
the field, and the legacy fallback catalog, keep the GET transport that
older backends accept. GET stays available with the same query
parameters but narrates deterministically, printing a note in place of
the "Configure Pulse Assistant" tip, and other methods get 405 with
Allow: GET, POST. GET also stops resolving the AI service at all: it
reads Patrol findings through a new ExistingAIService lookup, because
GetAIService constructs a tenant service on first use and that can list
provider models or start background discovery. The router's reporting
wiring moves into wireReportingAIResolvers so a test can drive it.

Keeping GET rather than answering 405 avoids breaking documented API
scripts (MSP.md pointed providers at it) for no security gain: CSV is
never narrated and GET no longer reaches the provider.
2026-10-07 21:00:34 +01:00
rcourtman b0590c0ccf Join operator links on resources that arrive as records
The monitor rebuilds its registry from the state snapshot and then
ingests supplemental records (vSphere, TrueNAS). Snapshot and resource
ingest applied the operator's manual links, but record ingest did not,
so a link whose side exists only as a record (an agent inside a vSphere
or TrueNAS VM, an agent on a TrueNAS host) never joined in the registry
behind the websocket broadcast and /api/state. The resources API seeds
through resource ingest and showed the same pair merged, and the
published inventory also flipped to merged whenever continuity
hydration cloned the registry for an unrelated absent machine.

Record ingest now applies the links, with the adapter's stale
thresholds on the rebuild, live supplemental and overlay paths.
Continuity records stay out of it: a saved enrollment only fills an
absent machine and must not lend its linked guest an offline verdict.
A link merge keeps the TrueNAS and vSphere payloads the primary lacks.

Joining links in the rebuild exposed how identity treats a folded
resource. Its ID was no longer live, so once an agent-type primary was
pinned with the folded agent's machine key, pin succession re-keyed the
link onto the primary itself and the next rebuild split the pair. That
already broke snapshot links with a Proxmox node as primary. The
registry now remembers each folded resource, and pin-driven and
record-declared successions treat it as observed.

Mock mode still builds its view from fixtures without the link store,
so the mock broadcast is unchanged here.
2026-10-07 20:54:29 +01:00
rcourtman 77d2119792 Remove unread Patrol summaryStats and its audit rule (#2690)
Stacked on #2686, which sits on #2682 and #2674; its own change is the
top commit, 6d8dce2cae. It merges cleanly with main and with every other
open PR touching these files.

`usePatrolIntelligenceState()` still returned `summaryStats`, a closure
counting critical, warning and active Patrol findings plus fixed
outcomes. Its only reader was `PatrolIntelligenceSummary.tsx`, deleted
in 27ba85ddc6. A type-checker scan of the whole program (src and tests)
finds no reference to the member outside the hook's return object, and
nothing spreads, iterates or index-reads the returned state.

- Removes the closure and its return entry.
- Removes the `canonical-patrol/no-local-summary-card-presentation`
audit rule. It matched only the deleted card's tint ternaries on
`summaryStats()`, and it pointed authors at `patrolSummaryPresentation`,
which no longer holds summary-card presentation. The three
`not.toContain("summaryStats()...")` guards that pinned the same strings
go too.
- Takes `patrolSummaryPresentation.ts` off the audit allowlist. Its
remaining presenters trip no rule, and a planted violation is now
reported.
- Contract notes in patrol-intelligence, api-contracts and
frontend-primitives. The section-owner sentence that named the deleted
summary surface now names the live tab panels and scopes the
no-own-reads rule to the hook-backed surfaces.

Runtime neutrality: of 187 dist files, 94 are byte-identical and 92
differ only in chunk-hash names and SRI strings. In the AIIntelligence
chunk, after normalising hashes and short identifiers, the only residual
is the removed closure and its return entry. The bundle-size check
passes. The browser receipt covers the Patrol Inbox, Activity and
Protection tabs at 1440 and 390 px.

The `Contract-Neutral` trailer covers only the platform-support-manifest
proof that the audit script's path policy names. This change leaves that
projection check untouched.
2026-10-07 20:42:56 +01:00
rcourtman 1231392e8d Judge a linked agent's guest disks by that agent everywhere
PR 2669 made the guest drawer's filesystem rows follow a linked Pulse
agent's freshness when its filesystems fill in for a VM that has no
Proxmox guest filesystems. The workload table's disk cell and the
drawer History still judged the same reading only by the Proxmox read
reason. So one guest read as current in the drawer and as "Unavailable:
Guest agent not running" in the table and History, and a silent
agent's reading could not show as last known there.

getWorkloadGuestDiskRead now owns one rule for the table cell, the
drawer rows and History: current while the agent reports, last known
once it is stale, unavailable once the guest is stopped. Proxmox's own
guest filesystems keep their read reason.

The rule also covers the aggregate disk metric, because Proxmox records
no guest disk usage without guest filesystems, so the manual link merge
keeps the agent's metric. Three paths broke that:

- The poller built its previous VM from the merged metric, so the next
  poll carried the agent's disk forward as a Proxmox prev- read, and
  Proxmox priority then froze it over the agent's live value. Only
  Proxmox's own disk reading is carried now.
- agent.stale was omitempty, and the browser merges agent facets field
  by field, so a resumed agent stayed "stopped reporting" until a
  reload. It is always sent now.
- The same merge kept filesystems a native Proxmox VM facet or a native
  agent facet had withdrawn, so the rows did not switch source.
2026-10-07 20:28:34 +01:00
rcourtman 239cd06933 Merge origin/main into fix/unraid-disk-temperature-alerts 2026-10-07 20:22:14 +01:00
rcourtman 88d44099aa Stop tenant incident stores racing on shared ID counters
Each tenant monitor owns its own IncidentStore, but incident and
incident-event IDs came from package-level int64 counters bumped with ++
under nothing but the calling store's mutex. Two tenants recording
alerts at once raced on them: go test -race failed
TestLeavingMockModeClearsEveryRunningTenantMonitor on PR 2698 at
incidents.go:1753. The remediation record counter had the same shape,
and remediation logs are created per org.

All six internal/ai/memory ID generators now mint through one atomic
helper. The numeric suffix also stops wrapping at 1000: even with atomic
counters, one generator minting more than a thousand IDs in a
wall-clock second repeated an ID, and incident notes find their incident
by ID. The prefix and timestamp layout is unchanged, and intToString
lost its last callers.

ids_test.go mints 2,400 IDs from every generator on 16 goroutines and
records alerts into two tenant stores concurrently. Against the old
files it reports DATA RACE at incidents.go:1753/1760 and
remediation.go:355, and every generator mints duplicate or wrapped IDs.
2026-10-07 20:12:04 +01:00
rcourtman aafa4793c3 Drop the summary focus bridge members nothing reads
The jump-to-row affordance lost its only consumer when the summary
components were deleted, yet the bridge kept computing it on every
Workloads and Storage page: a capture-phase window scroll listener and
a resize listener re-measured the hovered or focused row on each frame
and hover change, walking its ancestors with getComputedStyle. On the
12-node mock storage table that was 128 calls across eight row hovers
and 320 across ten scroll steps, now none.

Storage's reveal callback kept branches that switched between the
pools and disks views for that jump. Focus only ever names a row in
the active view, so drop them and the disk-id memo that served them.

The chart-hover input went the same way. No summary chart renders, so
setChartHoverSync was never called and the resolver's chart branch was
always fed null. Remove the signal, its type and the resolver option,
and say in the contract how a returning chart re-enters the shared
scope instead.

Focus reveal, pinned-group reveal, Escape and row emphasis behave as
before at desktop and phone widths; the browser receipt records the
before/after pass.
2026-10-07 20:08:13 +01:00
rcourtman 3bef5c3028 Remove unused CorrelationsResponse type
CorrelationsResponse described the /api/ai/intelligence/correlations
payload. #2674 removed its uses in the Patrol investigation context
model and that model's tests, and #2677 removed the last ones,
AIAPI.getCorrelations and the aiIntelligence store's correlation
loader, because no page renders the global learned-correlation list.
Nothing in the repository references the interface any more, tests
included.

ResourceCorrelation stays: ResourceIntelligence.correlations, the
resource drawer's relationship map (ResourceCorrelationSummary.tsx) and
resourceCorrelationPresentation.ts all still use it.

TypeScript erases the interface, so the production build is
byte-identical: npm run build before and after this change emitted the
same 187 dist files with identical SHA-256 sums.

Contract-Neutral: Deletes an unreferenced TypeScript interface; the compiler erases it, the production bundle is byte-identical, and no wire, store or page contract changes.
2026-10-07 20:07:27 +01:00
rcourtman 0180b33431 Hide pprof routes on demo-mode instances
The /debug/pprof handlers are gated on RequireAdmin plus a settings:read
scope that session logins skip. The public demo signs every visitor in
as the configured admin, so any visitor could fetch goroutine and heap
dumps and the process command line, or start CPU profiles and execution
traces that load the whole process. DEMO_MODE already hides diagnostics,
logs, admin users and manual discovery through the admin-operations
policy; pprof was missing from it.

The policy now has the demo guard answer /debug/pprof and every path
below it with 404 for every method, ahead of route authentication.
Instances outside demo mode keep the routes, and PULSE_PPROF_DISABLED
still removes them everywhere.

TestContract_DemoModeHidesPprofFromDemoAdminSession signs in as the
demo admin through the full router, shows the same session still reads
/debug/pprof/cmdline below the demo guard, and gets 404 for eight pprof
paths through the served handler. On the previous policy GET and HEAD
returned pprof output (200, or the root's 301 into the index) and POST
got the generic demo 403. A policy test also fails if a literal route
the router files register under /debug/, with or without a method
prefix, escapes the policy for any common method.
2026-10-07 20:04:07 +01:00
rcourtman 48c2d6cdce Stop Patrol fetching the correlation list nobody reads (#2677)
The Patrol page fetched `GET /api/ai/intelligence/correlations` on every
mount, every 60 s poll, every return to the tab and on Retry, and the
store's dashboard bundle fetched it again for FindingsPanel's refresh.
Nothing has read the list since the Patrol supporting-context block was
removed in 27ba85ddc6; the resource drawer reads per-resource
correlations from the resource-intelligence payload.

## Change

- `stores/aiIntelligence.ts`: remove the correlation signal,
`correlations` getter, `correlationsSignal`, `loadCorrelations()`, its
org-switch reset, and its entry in `loadDashboardData()`.
- `features/patrol/usePatrolIntelligenceState.ts`: drop the read from
the Retry path's background supporting reads.
- `api/ai.ts`: remove `AIAPI.getCorrelations` (no other caller). The
backend route stays as an API surface behind `ai:execute`.
- Tests: the store bundle test now pins every AIAPI read the bundle
makes; the manual-run test stalls the post-start refresh through a
remaining read so it still proves "Starting" clears without waiting
(negative controls: awaiting the refresh, or removing it, both fail the
test). Dead correlation route stubs removed from six E2E specs.
- Contract prose in api-contracts, patrol-intelligence,
unified-resources, ai-runtime and frontend-primitives no longer says the
Patrol page or store loads or renders correlations or recent changes.
The remaining stale Patrol correlation paragraphs (patrol-intelligence
~L2135/~L2197, ai-runtime ~L6854) are rewritten by #2674; the two PRs
split hunks by agreement and merge cleanly together.

`CorrelationsResponse` stays for now:
`patrolInvestigationContextModel.ts` still imports it until #2674 lands.
It goes in a follow-up once both are on main.

## Evidence

- Demo-mode stack, headless Chromium at 1440x900 and 390x844:
correlation requests go from 1 to 0 per Patrol load, browser reload, 60
s poll and tab hide/show. Every other `/api/ai/*` read per phase is
identical; no console errors. Re-run on the final base.
- Production build: the route string is gone from the bundle;
`check-bundle-size.mjs` passes with no chunk renamed (JS gzip -0.18 kB
on the same base).
- `tsc --noEmit` passes; vitest for src/stores, src/api,
src/features/patrol, src/components/AI and the Patrol page test passes;
contract, registry and status audits pass.
2026-10-07 19:49:15 +01:00
rcourtman 71a723abb1 Read controller-member disk history at its written key (#2694)
## Problem

A physical disk behind a RAID controller (target such as `megaraid,3`)
with no usable serial or WWN had its SMART history written under one key
and read under another, so its temperature and SMART charts stayed
empty.

- Host agent: writes under `HostSMARTDiskMetricID`, e.g.
`host-pve:sdd@ctrl0/megaraid,3`.
- Proxmox: writes under `PhysicalDiskMetricID`, which returns
`ProxmoxPhysicalDiskSourceID`, e.g.
`pve-node1--dev-sdx:sdx@/megaraid,0`.
- Reader: `BuildMetricsTarget` passed those source IDs, which already
name the member, to `PhysicalDiskMetaMetricID`. That function appended
the topology again:
`host-pve:sdd@ctrl0/megaraid,3:sdd@ctrl0/megaraid,3`. The same happened
in a registry rehydrated from persisted resources.

## Fix

`PhysicalDiskMetaMetricID` now follows the Proxmox writer. A fallback
that already ends in the member's topology is returned unchanged. The
topology is appended only to a fallback without it:
- a Proxmox source ID from before members were scoped, which
`PhysicalDiskMetricID` scopes the same way;
- the canonical resource ID that `PhysicalDiskView.MetricResourceID`
falls back to.

TrueNAS disks carry no controller target and are unaffected.

## Existing history

- **SMART:** no SMART writer used the doubled key, so samples already
stored become readable without a migration.
- **Disk I/O:** a linked node's agent with no SMART reading for a
member, such as a standby row, files the device's I/O under the Proxmox
disk's metrics target. That target was the doubled key. The I/O now
lands beside the member's SMART history. Samples already stored under
the doubled key are left to age out: nothing reads them, and they are
the block path's counter filed under its one merged member.
- Mock seeding keys these disks by `disk.ID`, the single-scoped key, so
it already matched.

## Proof

- `TestIdentitylessControllerMembersReadTheirWritersHistory`
(`internal/monitoring/issue1595_collection_trust_test.go`) drives the
real writers: `writeHostSMARTMetrics`, `writeHostPhysicalDiskIOMetrics`
and the Proxmox `writeSMARTMetrics`. It then queries the store at
`MetricsTarget` for five members in a live registry and in one
rehydrated through a JSON round trip. The members are two agent members
sharing a path, a lone agent member with I/O, a Proxmox member, and a
standby member merged into its linked node's Proxmox row. Before the fix
all ten targets read the doubled key.
- `TestPhysicalDiskMetaMetricIDScopesAControllerMemberOnce`
(`internal/unifiedresources/canonical_ids_types_test.go`) pins each
fallback shape against its writer: agent, smartctl-labelled agent,
Proxmox, legacy Proxmox, canonical resource ID, and a disk that is no
controller member. Before the fix, three cases failed with the doubled
key.

## Stacking

This branch sits on #2685, which sits on #2679, because both edit
`physical_disk_ids.go` and the proof file. It supersedes #2661, which
carried the same reader fix but conflicted with this stack and with
main.
2026-10-07 19:31:12 +01:00
rcourtman 843daf7ae3 Remove dead Patrol assessment and save-failure handoffs (#2682)
Stacked on #2674 (branch `refactor/drop-patrol-context-summary`); this
branch contains that commit.

## What

Removes the two Patrol-to-Assistant handoff builders in
`frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`
that no production code calls:

- `buildPatrolAssessmentAssistantHandoff`: its caller, the summary
card's Discuss handler, went in eac7dfe9ef (2026-05-15).
- `buildPatrolConfigurationFailureHandoff`: its last caller went in
27ba85ddc6 (2026-06-23).

With them go `PatrolInvestigationContextSummary`, their input and output
types, and the private helpers only they used. The model drops from
2,326 to 1,257 lines.

## Why it is safe

- A TypeScript compiler export graph rooted at `src/index.tsx` shows no
reachable importer of either builder, and `git grep` finds only their
own tests.
- Production builds of the parent tree and this tree are byte-identical
across all 187 dist files (`shasum`). `check-bundle-size.mjs` passes.
- The Assistant drawer still restores saved `patrol_assessment` and
`patrol_configuration_failure` sessions. That code
(`components/AI/Chat/index.tsx`, `workflowStarters.ts`,
`internal/ai/chat/session.go`) is unchanged.

## Tests

- The removed builders' cases are gone.
- Two cases covered branches the live finding handoff still uses, so
they now go through the live builders: a typed pending action stays
approval-bound without a legacy approval id, and the resource node
qualifier plus long-line truncation.
- v8 coverage of the surviving model code matches the baseline from
before the removal. The one exception is a defensive guard the live
caller cannot reach.

## Contracts and docs

Eight contracts changed: `patrol-intelligence`, `ai-runtime`,
`api-contracts`, `frontend-primitives`, `security-privacy`,
`storage-recovery`, `agent-lifecycle` and `unified-resources`.

- No contract describes either handoff as a live producer any more.
Statements about restoring saved sessions of those kinds stay.
- Some clauses described a rendered Patrol summary card, assessment
strip or readout, score chip, header trust line, or inline save-failure
surface. They are now conditional or say what renders instead.
- The run-history handoff clauses now say the browser sends the briefing
and safe run metadata, and `internal/ai/patrol_assistant_handoff.go`
rebuilds the model context from the run ID.
- `docs/AI.md` and its public mirror pointed users at a legacy
operational score in a collapsed supporting-context section. Neither
exists any more. The section now points at **Activity > Finding options
and history > History**.
- `ai_runtime_docs_policy_test.py` is the registered proof for
`docs/AI.md`. It now pins that location and rejects the retired claim.
It also had a stale pin that has failed on main since 2789a15fe5; that
pin now matches the current Patrol mode API wording.

Prose about the remaining test-only summary presenters in
`utils/patrolSummaryPresentation.ts` is left for a separate follow-up
that removes those presenters.

## Browser verification

Receipt `frontend-modern/browser-verification/6e6cbc66d62863d1.json`.
Checked on an embedded production build on a private demo mock stack, at
1440x900 and 390x844:

- Inbox "Explain with Assistant" opens the drawer with the Pulse Patrol
attention briefing.
- The run-history "Discuss" button opens the drawer with the "Patrol run
attached" briefing.
2026-10-07 18:52:17 +01:00
rcourtman 2eef42c512 Keep Off alert defaults off after saving (#2684)
## Summary

Switching a metric Off in a **Global Defaults** row (Alerts >
Thresholds) did not stick. After Save and a reload the metric was back
On at its factory threshold and kept alerting. This affected every
section whose factory threshold is positive: Machines CPU, memory, disk
and disk temperature, Proxmox node temperature, PBS, Docker, Kubernetes,
TrueNAS, vSphere and storage.

The editors stage `-1` for Off, and the save payload passed it through
as `{trigger: -1}`. Backend config normalization reads a negative
default trigger as unset and restores the factory value. Guest and node
CPU, memory and disk escaped only because nothing normalizes them.

- `buildAlertsConfigurationPayload` now writes every Off default as
`{trigger: 0, clear: 0}`, the value the engine and normalization both
read as off. Per-resource overrides are serialized separately and keep
`-1`, which the override path stores as written. A `-1` already stored
on a guest or node default becomes `0` on the next save.
- The Global Defaults **Custom** badge now treats `-1` and `0` as the
same Off value. Without that, a fresh install showed Custom on
Kubernetes, TrueNAS Systems and vSphere, and VMs & Containers turned
Custom after any save, though nothing had changed. An unset factory
value stays distinct from Off: an unset TrueNAS disk temperature follows
Disk temperature by type.
- A row's custom-threshold marker still compares raw values. It drives
the row's revert control and override removal, so a stored `-1` override
must stay visible against an Off default. A test pins that.
- The alerts contract no longer claims Off is written as `-1`
everywhere.

## Verification

- New payload test: every section's Off default is written as `{0, 0}`
and reads back Off. It fails on `main` with `guestDefaults.cpu: expected
{ trigger: -1 }`.
- New backend test: a `{0, 0}` default stays off through `UpdateConfig`
in every section, and a host at 99% raises no CPU, memory or disk alert
when the agent defaults are off. Both fail when the defaults are written
as `-1`.
- Live on a private mock stack. On `main`, Proxmox CPU and Temp switched
Off saved as `{-1}` and `{80, 75}`, and after reload Temp read On. With
the fix:
- Machines CPU at 1% raised 8 alerts. Switching it Off stored `{0, 0}`
and resolved all 8.
  - Proxmox Temp Off resolved the node temperature alert.
  - Nothing re-fired over two minutes.
- Values stayed Off after a backend restart and a reload. Machines,
Proxmox, Kubernetes, TrueNAS and vSphere were each checked at desktop or
phone width.
- Custom badge on a fresh install: no Proxmox, Kubernetes, TrueNAS or
vSphere group reads Custom, and after an unrelated save only the group
actually changed does.
2026-10-07 18:47:09 +01:00
rcourtman 60527fa8ab Drop contract prose for the deleted problem-resource surfaces
frontend-primitives.md still told new route-level copy to extend
problemResourcePresentation, deleted in ae65c5e9a2, and kept a paragraph
tying that helper to ProblemResourcesTable.tsx, deleted with the dashboard
overview in c743a231b8. It also kept a readability rule for that table and
the dashboard Pulse Brief. Neither surface exists and no live surface
implements the rule; Patrol's grouping and affected-resource counts are
governed in patrol-intelligence.md. Drop the ownership paragraph and the
rule, and list problem-resource among the deleted dashboard helpers that
must not return.

unified-resources.md still said the change and correlation summary cards
default Infrastructure resource-filter links for the Patrol page and the
problem-resource dashboard panels. Since the 2026-05-16 drilldown
retirement the cards have no link default and render only in the resource
drawer, which passes no link builder, so labels show as plain text.
api-contracts.md named the dashboard Pulse Brief as a sender of
autonomous_mode:false and described that field as a client override. Since
4edf5f8265 ChatRequest has no autonomous_mode field: the server runs every
/api/ai/chat exchange in approval-required mode, as
TestHandleChat_CannotElevateAutonomousModePerRequest pins, and the field
that scoped handoffs still send is dropped at decode. Say so, and stop
calling Patrol finding handoffs stricter than ordinary chat.

The new lookup test pins the deleted helper as unowned, next to the other
retired dashboard paths, so the dropped ownership claim cannot come back
through the registry unnoticed.
2026-10-07 18:22:57 +01:00
rcourtman e3a93efcee Judge pulse-relaxed guests by one threshold on poll and save
CheckGuest lifted a pulse-relaxed guest's CPU, memory and disk triggers
to the 95/92/95 floor itself, but config-save reevaluation rebuilt the
guest from alert metadata without its tags and judged the alert by the
unrelaxed thresholds. A relaxed guest whose memory threshold was unset
got the floor of 92 while polling, read as no threshold on save, and
the save resolved the alert with a recovery notification; the next poll
raised it again.

The floor also lifted an Off threshold (trigger 0, or -1 from the
editors) like any low trigger, so tagging a guest relaxed turned on an
alert its config switched off, with no recovery band at all ({95, 0}).
The tag is documented as relaxing thresholds; it must never make a
guest more sensitive than its config.

- Apply the relaxed step in effectiveAlertPolicyNoLock's guest branch,
  so CheckGuest, reevaluation and any later resolver share it.
- Read the recorded tags back in guestSnapshotFromAlert ([]string live,
  []interface{} after a restart) through a shared metadata reader that
  storagePolicyAliases now uses too.
- Leave an Off threshold off; an unset one still gets the floor.
- Drop the tags key from an open alert once its resource has no tags.
  Reevaluation now reads it, and a removed pulse-relaxed left behind
  would judge the alert by the relaxed trigger while polling uses the
  guest's own.

This stacks on the per-filesystem reevaluation fix. Without it, a save
judges a filesystem alert by the guest's relaxed floor instead of the
filesystem's own lower override, and flaps it;
TestConfigSaveKeepsRelaxedGuestFilesystemOverride guards that.

The other new tests fail against the base branch's runtime files via
-overlay.
2026-10-07 18:05:59 +01:00
rcourtman dace9295c6 Remove exports orphaned by the summary component deletions (#2671)
Stacked on #2662 (its commits are ancestors of this branch, so this PR
shows them until #2662 merges).

The May cleanup deleted InfrastructureSummary, StorageSummary, the
shared summary table and the SummaryMetricCard, InteractiveSparkline,
DensityMap and SummaryPanel primitives, but left the helpers only they
called. This removes them:

- `getMetricsChartKeyCandidatesFromResource` (utils/agentResources.ts)
- `getNormalizedIdentityLookupVariants` and
`getAgentLikeIdentityAliases` (utils/resourceIdentity.ts)
- `getPBSStatusIndicator` (utils/status.ts)
- `useSummaryContextualFocusState`
(components/shared/contextualFocus.ts), plus
`filterSummarySeriesByGroupScope`, `resolveSummaryCardInteractionState`
and `SummaryCardInteractionState` that only it used
- the deprecated `ChartsAPI.getInfrastructureCharts` delegate; its
branch tests now exercise `getInfrastructureSummaryCharts`

Proof of deadness: a TypeScript import/export graph from `src/index.tsx`
finds no production importer of any removed symbol, and a repo-wide grep
finds no remaining reference. The production build differs from its
parent only in the shared chunk that carries ChartsAPI, which loses the
delegate's static method (99 bytes); after normalising chunk hashes, SRI
hashes and minified identifiers every other file is identical. Tests:
`src/utils`, `src/components/shared`, `src/api`, `src/features`,
`src/hooks`, `src/__tests__`, Workloads, Storage and Infrastructure
suites pass (only the known Mac-only `agentInstallCommand` failures).

Contracts: frontend-primitives, storage-recovery and
performance-and-scalability still described the deleted summary cards,
sparkline, density map, summary panel, sticky summary section and Jump
to row button as live owners, and credited contextualFocus.ts with the
removed hook's series filtering. Those clauses now name the live owners
(summaryCardInteraction.ts behind summaryTableFocus.ts, the storage
summary cache behind the pool Growth column, TooltipPortal for the mini
sparkline and backup activity chart tooltips), become conditional on a
summary strip returning, or go. api-contracts and unified-resources
record the removed chart client and chart-key helper.

Browser pass (embedded production build, demo mock stack, 1440x900 and
390x844): Proxmox node-to-guests reveal, guest row hover emphasis and
inline detail reveal, storage Growth column, pool row hover and inline
detail, pool-group hover preview, pin and Escape clear. Receipt:
`frontend-modern/browser-verification/232e5c23490f8cd4.json`.
2026-10-07 18:02:21 +01:00
rcourtman 864a088db6 Fill the table's visible width with phone drawers
Inline table drawers below the lg breakpoint capped their sticky content
at calc(100vw - 3.5rem), a guess at the page chrome. Pages with less chrome
than that left an empty strip beside every drawer (27px at 390px on the
Availability checks, Proxmox, Docker, Kubernetes and Machines tables), and
a table wider than its shell at tablet widths got a drawer wider than the
visible area.

The table scroll shell is already a size container, so the content now caps
at 100cqi: exactly the table's visible width at every width, measured live
at 320, 390, 768 and 1000px. Desktop keeps the static uncapped layout.
2026-10-07 17:52:10 +01:00