diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md index 74abaf3c67..b89f6a8ace 100644 --- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md +++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md @@ -275,6 +275,18 @@ Without comparable identity (a SAS, SCSI or USB replacement with no WWN on one side) the row still matches. Report admission and the SMART wire contract are unchanged; the regression is `TestHostAgentSMARTRowForSwappedOutDiskDoesNotLendItsIdentity`. +A PVE disk that a still-reporting linked Agent's SMART row matches is marked +`AgentSMARTReported` (internal poll evidence on `models.PhysicalDisk`, never +serialized); disks the poller builds from that report when the Proxmox disk +query fails go through the same merge, and an Agent whose lease lapsed owns +none. The Agent then owns the disk's temperature alert +through `CheckHost`, and the PVE disk temperature check closes its own as +moved to the Agent, so one disk never alerts twice. Report admission, the SMART +wire contract and Agent authority are unchanged; +`TestMergeHostAgentSMARTIntoDisksMarksDisksTheAgentReports` in +`internal/monitoring/physical_disk_roundtrip_test.go` and +`TestPhysicalDiskAgentSMARTReportedStaysInternal` in +`internal/models/deepcopy_test.go` pin the marker. Assistant historical metric wiring uses the current monitor's retained store and registry metrics coordinates. Historical reads do not alter enrollment, @@ -4797,6 +4809,12 @@ agent-lifecycle operations. If those routes are called directly, the API must fail them as unsupported rather than presenting file diffs or reverts as agent command rollback, enrollment repair, update rollback, or fleet-control authority. +Assistant session mutations (`/abort`, `/summarize`, `/fork`, `/undo`, +`/redo`, `/steer` under `/api/ai/sessions/{id}`) accept only `POST`; any other +method that reaches those handlers gets `405` before touching session state. +That method guard +is AI-runtime transport hardening in `internal/api/ai_handler.go`; it adds no +agent command, enrollment, update, or fleet-control path. That same shared dependency now also assumes hosted cloud handoff authorizes tenant org access before browser lifecycle continues. Lifecycle-adjacent opens into hosted workspaces may depend on `internal/api/cloud_handoff_handlers.go`, diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md index 5390096261..9559c01b62 100644 --- a/docs/release-control/v6/internal/subsystems/ai-runtime.md +++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md @@ -3570,6 +3570,12 @@ query...`, and `Reading storage...` before streamed tool arguments are answer (nothing streaming, no error block, no pending approval or question, and a user prompt available to re-send) because the undo boundary only operates on the last durable turn. + Session mutations stay POST-only at the handler: abort, summarize, fork, + undo, redo, and steer refuse every other method with `405` and + `Allow: POST` before resolving the Assistant service. A `GET` or `HEAD` + that the demo-mode read-only guard or the CSRF check admits as a read + therefore cannot cancel a running turn, compact or rewind a transcript, + or persist a fork. The empty Assistant drawer may surface recent non-empty sessions as direct resume actions using the backend session list already owned by the drawer; it must not create a parallel recent-chat store or product-authored prompt diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md index 625b94fdce..a65cb67883 100644 --- a/docs/release-control/v6/internal/subsystems/alerts.md +++ b/docs/release-control/v6/internal/subsystems/alerts.md @@ -1529,7 +1529,8 @@ That same guest-threshold owner also governs guest-derived lifecycle and posture alerts. Snapshot age, backup age, powered-off state, and configuration-change reevaluation must all construct a canonical lightweight guest snapshot and route threshold resolution through the shared -guest-defaults → filter-driven custom rules → guest-override chain. +guest-defaults → filter-driven custom rules → guest-override → `pulse-relaxed` +chain. That canonical guest context must preserve the live guest name and tags for snapshot and backup posture evaluation. Ignored prefixes, `pulse-no-alerts`, configured ignored tags, and required-tag filtering must resolve through the @@ -1539,6 +1540,27 @@ operator's suppression policy. Passing `nil` guest context or resolving only overrides/defaults is forbidden because it silently bypasses custom guest rules and makes guest lifecycle alerting diverge from running-guest metric truth. +The `pulse-relaxed` step lives in `effectiveAlertPolicyNoLock`, not in +`CheckGuest`, so polling and config-save reevaluation judge a relaxed guest's +alert by one threshold. Reevaluation rebuilds the guest from alert metadata, +so `guestSnapshotFromAlert` reads back the `tags` the evaluator recorded +(`[]string` live, `[]interface{}` after a restart). Without them a save judged +the alert by unrelaxed thresholds, resolved one raised under an unset +threshold's relaxed floor with a recovery notification, and the next poll +raised it again. Those tags must stay current: `metricOptionsWithTags` drops +the key from an open alert once its resource has no tags, or a removed +`pulse-relaxed` would keep judging the alert by the relaxed trigger. The tag +lifts CPU, memory and disk triggers to a 95/92/95 floor and gives an unset +threshold that floor, but an Off threshold (trigger <= 0) stays Off: relaxing +a guest must never raise an alert its config turned off. A filesystem's own +override still replaces the relaxed guest disk threshold for that filesystem, +on save as while polling. Proof: +`TestConfigSaveJudgesRelaxedGuestAlertByRelaxedThresholds`, +`TestConfigSaveKeepsRelaxedGuestFilesystemOverride`, +`TestPulseRelaxedKeepsOffGuestThresholdOff` and the Off case of +`TestApplyRelaxedGuestThresholds` in `internal/alerts/alerts_test.go`, and +`TestCheckGuestDropsRemovedTagsFromOpenAlerts` in +`internal/alerts/unified_eval_test.go`. That same guest-alert owner also has to retire per-disk guest alerts when the guest stops, disk alerting is disabled, or the reported disk set changes. Canonical guest disk identity is only valid while the guest still exposes that @@ -1907,14 +1929,84 @@ A disk is hot from its trigger. Alerts and Patrol findings stay open until the reading falls to the clear value, or under the trigger when there is no band below it. The Physical Disks verdict and the TrueNAS Health cell judge only the current reading against the trigger. PDF reports colour disk temperatures by -the same thresholds. Judges that still differ: TrueNAS disk temperature alerts -use `TrueNASDiskDefaults.Temperature` (a flat 55/50), and the TrueNAS disk -drawer tones the reading from a fixed 55C. +the same thresholds. `TestDiskTemperatureThresholdMatchesCheckHostPolicy` in `internal/alerts/threshold_resolution_shared_test.go` pins per-type resolution, a raised NVMe trigger that `CheckHost` also honours, the copy, the disabled default and the nil manager. +TrueNAS disk temperature alerts follow the policy too: +`trueNASDiskTemperatureDefaultNoLock` +(`internal/alerts/truenas_disk_temperature.go`) is the type-default tier of +`effectiveAlertPolicyNoLock` for `truenas-disk`, so an unset +`TrueNASDiskDefaults.Temperature` resolves per disk type (the +`alertPolicyQuery.DiskType` the unified input carries from +`PhysicalDisk.DiskType`). A TrueNAS-wide value the user saved under TrueNAS +Disks replaces it for every TrueNAS disk, as a host Disk Temp override does for +an agent's disks, 0 meaning off, and a per-disk override beats both. The alert +records `diskType` so a config save re-judges it per type; one without it is +held to the lowest per-type trigger. A retained reading +(`diskinventory.TemperatureCollected` false) is no evidence and raises nothing. +The factory value is unset. `normalizeTrueNASDiskTemperature` drops a stored +55/50 only from a config without `TrueNASDiskTemperatureByType`, because the +thresholds page wrote that flat factory value back on every save; the page +writes the marker, so a 55 typed later is kept. Every config `GetConfig` +returns carries the marker, so a client that reads and writes back keeps it. +Without the marker (an old saved file, or a page loaded before the upgrade) +55/50 is read as that unchosen factory value; a client building a config from +scratch with an explicit TrueNAS-wide 55 has to send the marker. The TrueNAS +Disks Global Defaults cell reads `By type` while unset +(`globalDefaultFallbacks` on `ResourceTable`, +`resolveAlertResourceGlobalDefaultCell`), or Off when the agent Disk Temp +default switches the policy off, and switching it on then stages an explicit +TrueNAS-wide 55 because unset would stay off. Each disk row inherits its type's +trigger from the unsaved editor state (`resolveTrueNASDiskTemperatureDefault`). +The TrueNAS disk drawer tones a current reading from the same per-type trigger +(`getDiskTemperatureThresholds` passed into `buildTrueNASDetailSections`), so it +no longer judges heat from a fixed 55C. Judges that still differ: the TrueNAS +storage table and drawer do not apply a TrueNAS-wide value or per-disk +override. +`TestTrueNASDiskTemperatureAlertsFollowDiskTemperaturePolicy` and +`TestTrueNASDiskTemperatureAlertIgnoresRetainedReading` in +`internal/alerts/unified_eval_test.go` pin the tiers and retained readings; +`TestTrueNASDiskTemperatureAlertsReevaluatePerDiskType` and +`TestTrueNASDiskTemperatureAlertWithoutDiskTypeHeldAtLowestTrigger` in +`internal/alerts/alerts_test.go` pin re-judging on a config save; +`TestNormalizeTrueNASDiskTemperatureKeepsOnlyChosenValues` pins the +saved-config migration. + +Proxmox physical disks alert on temperature under the same policy. +`CheckProxmoxDiskTemperature` (`internal/alerts/proxmox_disk_temperature.go`) +raises a `diskTemperature` metric alert under the disk's PVE alert reference +(`ProxmoxPhysicalDiskAlertResourceID`, resource type `proxmox-disk`), judged by +`proxmoxDiskTemperatureThresholdNoLock`: the disk type's `DiskTempByType` entry +under the agent Disk Temp default, which switches it off for every type. It +carries the disk's serial, WWN and `diskType` like the health and wearout +alerts, so `ProxmoxPhysicalDiskAlertIdentifiers` lists its +`::metric-threshold:diskTemperature` identifier for history +ownership, and `reevaluateActiveAlertsLocked` re-judges it per disk type (the +lowest per-type trigger when the type was never recorded) instead of falling +through to guest thresholds that have no disk temperature. A disk a +still-reporting linked agent lists in its SMART report is the agent's: its +alert closes with the `moved_to_agent` resolution and `CheckHost` raises the +agent's own. The handover happens on the next disk poll, so for that one +interval an agent newly linked to a disk with an open PVE alert can hold its +own alert beside it. A lapsed agent owns nothing, so the node's own readings +keep alerting while its agent is silent. An +excluded disk, or a policy switched off, closes the alert; a poll without a +current reading holds it. Like the health and wearout alerts, a disk that +leaves the inventory keeps its alert until the 24-hour stale sweep. The +`proxmox-disk` alert delay defaults to the factory 5 seconds, so a warning +waits out the same 300-second noisy-gauge stability window agent and TrueNAS +disk temperature warnings do, and a critical reading bypasses it. +`TestProxmoxDiskTemperatureAlertsFollowDiskTemperaturePolicy`, +`TestProxmoxDiskTemperatureAlertOwnershipAndHolds`, +`TestProxmoxDiskTemperatureWarningWaitsOutStabilityWindow`, +`TestProxmoxDiskTemperatureAlertsReevaluatePerDiskType` and +`TestCheckDiskHealthAlertsCarryHistoryOwnershipIdentity` in +`internal/alerts/alerts_test.go` pin the policy, ownership, holds, re-judging +and identifiers. + ### Agent disk temperature alerts clear when their disk leaves the report `CheckHost` also clears a disk temperature alert, and drops its pending diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md index 73facfbf1f..202bf5147b 100644 --- a/docs/release-control/v6/internal/subsystems/api-contracts.md +++ b/docs/release-control/v6/internal/subsystems/api-contracts.md @@ -2161,6 +2161,20 @@ payload shape change when the portal presents compact client rows. index; clients must treat the endpoint's `accepted:true` as inbox receipt, not delivery. Browser clients must use the shared `AIChatAPI.steerSession(sessionId, { prompt, clientMessageId })` helper. + Every Assistant session mutation sub-resource under + `/api/ai/sessions/{id}` (`/abort`, `/summarize`, `/fork`, `/undo`, + `/redo`, `/steer`) accepts only `POST`. Any other method that reaches the + handler returns `405` with `Allow: POST` through + `requireAssistantSessionMutationMethod` in `internal/api/ai_handler.go`, + before the session service is resolved (earlier layers still answer + first: `Router.ServeHTTP` returns `200` for `OPTIONS` preflight, and + auth, scope, CSRF, and demo-mode guards keep their own refusals). The + session router dispatches these sub-resources by path alone, and the + demo-mode read-only guard and the CSRF check both treat `GET` and `HEAD` + as reads, so the method contract belongs to the mutating handler rather + than to its callers. `GET /api/ai/sessions/{id}/messages` stays the read + path, and the unsupported `/diff`, `/revert`, and `/unrevert` handlers + keep answering `501` for every method that reaches them. OpenCode-style file diff/revert session routes are deliberately not part of Pulse's supported Assistant session contract: Pulse sessions do not own local code-file edits, and infrastructure mutations must be reviewed @@ -4933,6 +4947,10 @@ transition and evidence times) from the frontend-primitives shared relative-time clock. That is presentation over the same `GET /api/ai/patrol/status`, run history and `GET /api/ai/patrol/attention/{id}` payloads: no field, request or polling cadence changes. +The attention detail's suppression `expiresAt` and a finding's `remind_at` and +`snoozed_until` from `GET /api/ai/patrol/findings` are future times, so the +page presents them as countdowns from the same clock ("in 1d") instead of +ages. That is presentation only: no field, request or polling cadence changes. ### Resource-list facets preserve scoped navigation evidence diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md index 193d3ea8db..ccf0f8ddeb 100644 --- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md +++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md @@ -2206,6 +2206,18 @@ the same record; the table renders defaults once, in both desktop table and narrow card layouts, and per-section metric columns must resolve to metric keys the shared column normalizer produces so the defaults editor reads and writes the same record keys the section persists. +A global default that another setting decides while it is unset passes a +`globalDefaultFallbacks` entry for that metric (label, title, whether the other +setting is itself off, and the value switching on stages when it is). The +TrueNAS Disks temperature uses it to read `By type`, following Disk +temperature by type, with `features/alerts/thresholds/trueNASDiskTemperature.ts` +giving each disk row its type's trigger from the unsaved editor state. +`resolveAlertResourceGlobalDefaultCell` decides the cell for both layouts: +unset follows the fallback, switching on from Off returns to unset unless the +fallback is off, and an unset default with no fallback stays Off as the engine +reads it. `ResourceTable.tsx` hands its props to the shared table state through +getters, so the Custom badge and reset control follow defaults that load after +the table mounts. Platform sub-routes that add native provider inventory must stay on the shared platform page and table primitives. The vSphere Networks surface routes through `/vmware/networks`, the shared platform tab model, the command palette @@ -5345,7 +5357,19 @@ too. Every read of the clock returns the wall clock; the 30-second tick only tells readers to re-read, so a cell that mounts between ticks never measures from a stale time and a timestamp from the last few seconds never reads as a future time. -The rule has one deliberate exception. The age of a latest reading (last used, +Future times have their own formatter. `formatRelativeTime` is past-only: it +reads a time ahead of `now` as "just now" (compact) or "0s ago", which is right +for clock skew on something already observed and wrong for an expiry, a +reminder or a schedule. +Those go through `formatTimeUntil` (`frontend-modern/src/utils/format.ts`), +which counts down ("in 3h", "in 1d"), rounds to the nearest unit so a duration +just chosen reads as chosen, and returns `dueText` (default "now") once the +time arrives. A countdown target does not change while its surface stays open, +so the countdown passes `now` from the shared clock, as the Patrol suppression +expiry and the Patrol findings reminder and snooze lines do. The replication +Next sync column and the Patrol header's next-check `CountdownTimer` keep their +own minute- and second-precision countdowns. +The relative-age rule has one deliberate exception. The age of a latest reading (last used, last seen, last success, last checked) on data the surface reads once and does not re-read stays the age at read time, because a moving age over a snapshot that never refreshes claims the reading stopped when it may not have. Such a @@ -5860,7 +5884,15 @@ the surface-alt detail row shell locally. The content shell must clip horizontal paint below the large breakpoint without becoming a scroll container, reset the parent table's `whitespace-nowrap` inheritance, and allow its descendants to shrink, then restore visible overflow for the static -desktop layout. Long operator-state copy must wrap inside the shared row border +desktop layout. Below that breakpoint the default content shell is capped at +the table scroll shell's content-box inline size (`max-w-[100cqi]`; the shell +is a size container), never a viewport estimate of the page chrome, so a phone +drawer does not leave an empty strip beside its content (the retired +`100vw-3.5rem` cap left 27px at 390px) and is never wider than the table's +visible area. Callers that pass their own `contentClass` own their width. +Fixed-layout cells clip overflow, so the sticky offset is inert and horizontal +scrolling still moves the drawer with its cell. +Long operator-state copy must wrap inside the shared row border instead of painting beneath adjacent controls or disappearing at the clip edge. When focused detail content is removed, `InlineDetailTableRow` restores focus to its current `aria-controls` disclosure with `preventScroll`; live refresh, diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md index f9b7ee2a19..36e0f5442f 100644 --- a/docs/release-control/v6/internal/subsystems/monitoring.md +++ b/docs/release-control/v6/internal/subsystems/monitoring.md @@ -2124,6 +2124,29 @@ boundary around it: matches node names only, so it relies on fixture node names being unique across instances, which they are. +`checkPhysicalDiskAlerts` also hands each disk's temperature to +`CheckProxmoxDiskTemperature`, so a Proxmox disk that only the node's sensors +report alerts under the disk temperature policy, as its Running Hot verdict +already says it should. It passes the reading only when this poll collected it +(`collectedPhysicalDiskTemperature`, `diskinventory.TemperatureCollected`), so +a retained last-known value holds the alert rather than judging it, and it +passes `AgentSMARTReported`, which `mergeHostAgentSMARTIntoDisks` sets on a +disk a still-reporting linked agent lists in its SMART report (disks built +from that report when the Proxmox query fails go through the same merge). A +disk the agent lists is the agent's: `CheckHost` raises its temperature +alert, and the PVE disk check closes its own as moved to the agent, so no +disk alerts twice. Once the agent's lease lapses (`ExpireHostTelemetry` marks +the host offline) its retained rows still enrich the disk, but ownership +returns to the PVE check, which judges the node's own current readings; an +agent newly linked to a disk with an open PVE alert takes it over on the next +disk poll. An excluded device closes its temperature +alert with the health and wearout ones. Fixture disks carry no agent SMART +merge, so on a mock estate every hot disk on an online node alerts. +`TestMergeHostAgentSMARTIntoDisksMarksDisksTheAgentReports` and +`TestCheckPhysicalDiskAlertsRaisesProxmoxDiskTemperatureAlerts` in +`internal/monitoring/physical_disk_roundtrip_test.go` pin the marker, +the collected reading, agent ownership and exclusion. + Switching mock mode fences the alert evaluations that read mode-dependent data (`mockModeFence`, `internal/monitoring/mock_mode_fence.go`). `GetState`, the fixture graph, the unified read view, the recovery rollups and the connection diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md index 6eeca64baa..f34480773c 100644 --- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md +++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md @@ -2715,6 +2715,36 @@ clock while it stays open. Its `Last seen` and flapping window are latest readings of a record that may have moved since, so they stay the ages at read time, and the queue rows, summary, recent work, run history and digest re-derive on their own 30- or 60-second re-reads. +Future times in Patrol count down instead of reading as ages, because the +past-only `formatRelativeTime` reads each of them as "just now" for their whole +duration. The attention detail's suppression line counts down to the expiry +with the exact time on hover and names the state expiry restores in the +early-end control's words, from the same +`getAttentionSuppressionEndPresentation` split on +`operationalRecord.acknowledgement`: an open issue reads `Returns to active +attention in 1d.`, one marked reviewed reads `Suppression ends in 1d. It stays +reviewed.` (expiry restores Acknowledged, which is not active attention), and a +passed expiry reads `Suppression has ended.` +(`getAttentionSuppressionExpiryLabel`). The findings list reads `Reminding in +6d` for a will_fix_later reminder and `snoozed, returns in 3h` for a snooze, +both through `formatTimeUntil` on the shared clock with the exact time on +hover. A reminder reads `Reminder overdue` once the panel's overdue id list +holds it. That list is sampled on the shared clock and is what the Overdue +commitments chip and filter count, so the label, chip and filter agree: a row +mounted or re-read between the deadline and the tick that adds it reads +`Reminder due`, and a row already on screen keeps its last countdown until that +tick. The list only notifies when its ids change, so a clock tick that moves no +deadline past now does not rebuild the open Overdue rows. The hourly reminder +sweep then brings the finding back whether or not it still trips. An ended +snooze reads `snooze ended` until the next findings re-read drops the snoozed +status: `GET /api/ai/patrol/findings` sends no status, so the frontend +`aiIntelligence` store (`normalizeFindingStatus`) derives `snoozed` on each +read only while `snoozed_until` is ahead, and the finding then shows as Active +unless it has since resolved or been dismissed. +`getFindingReminderPresentation` and `getFindingSnoozePresentation` in +`aiFindingPresentation.ts` own the findings copy. +`PatrolAttentionWorkbench.test.tsx`, `FindingsPanel.links.test.tsx` and +`FindingsPanel.test.ts` pin it. ### This week card answers what Patrol did for the customer diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md index 975dc87adb..54455bf257 100644 --- a/docs/release-control/v6/internal/subsystems/storage-recovery.md +++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md @@ -1429,6 +1429,12 @@ state only. A restored prompt or restored message count may help an operator continue a protected-item investigation, but it must not become backup coverage evidence, recovery freshness, restore entitlement, storage-owner identity, approval policy, or a provider-local recovery command handoff. +The POST-only guard on Assistant session mutations (`/abort`, +`/summarize`, `/fork`, `/undo`, `/redo`, `/steer`; `405` with `Allow: POST` +for any other method that reaches the handler) is transport hardening in +`internal/api/ai_handler.go`. +It opens no storage, backup, or recovery read or write path, and a rejected +request never reaches session state. Approved Assistant tool execution through `internal/api/router_routes_ai_relay.go` is also adjacent API/AI action plumbing for storage/recovery consumers. `AssistantToolExecutor` / `ApprovedAssistantToolExecutor` may execute an already diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md index 9026f52923..3d2c033a46 100644 --- a/docs/release-control/v6/internal/subsystems/unified-resources.md +++ b/docs/release-control/v6/internal/subsystems/unified-resources.md @@ -6112,7 +6112,12 @@ the reference and is never retried. An owned row records its alert's reference as `alert_resource_id`. A read by the reference returns the rows journaled under it plus the rows owned away from it, matched through the indexed alert identifier (`ProxmoxPhysicalDiskAlertIdentifiers`) and that -recorded reference, and every count uses the same predicate. The Alerts +recorded reference, and every count uses the same predicate. Those +identifiers cover the health and wearout specs and the disk temperature +metric spec (`::metric-threshold:diskTemperature`), since PVE disks +also raise temperature alerts under the same reference +(`TestProxmoxDiskTemperatureAlertRowsFollowRecordedHardwareIdentity` in +`internal/unifiedresources/store_test.go`). The Alerts history Resource action therefore still lists every occurrence raised under the path, across the disks that held it, and alert-centric reads keep their occurrences (see the AI runtime contract's incident-history queries). Rows @@ -6268,6 +6273,13 @@ presentation. `frontend-modern/src/components/Infrastructure/` placement, signal, and snapshot context through the canonical resource drawer and debug/source sections rather than introducing a VMware-only detail route, drawer tab, or provider-local investigation shell. +The TrueNAS physical-disk drawer judges a current temperature reading by the +disk temperature policy, like the TrueNAS storage table: +`useResourceDetailDrawerDerivedState.ts` passes the alerts store's +`getDiskTemperatureThresholds` into `buildTrueNASDetailSections`, and the +Temperature row takes a warning tone only when `isPhysicalDiskRunningHot` +says the reading reached its disk type's alert trigger. A retained reading +keeps its muted last-known row, and without a resolver heat is not judged. That same infrastructure consumer boundary also owns source selection continuity. Settings infrastructure panels and platform/runtime pages must keep canonical sources such as `truenas` and `availability` present in their diff --git a/frontend-modern/browser-verification/26f085dd13bc21bf.json b/frontend-modern/browser-verification/26f085dd13bc21bf.json new file mode 100644 index 0000000000..fa004d8f83 --- /dev/null +++ b/frontend-modern/browser-verification/26f085dd13bc21bf.json @@ -0,0 +1,69 @@ +{ + "version": 1, + "base_sha": "bdf0f76b7bf61d550b1cb8574497eef75b354acb", + "verified_at": "2026-10-07T14:11:27Z", + "result": "passed", + "changed_paths": [ + "frontend-modern/src/components/Alerts/AlertResourceTableDesktop.tsx", + "frontend-modern/src/components/Alerts/AlertResourceTableMobile.tsx", + "frontend-modern/src/components/Alerts/ResourceTable.tsx", + "frontend-modern/src/components/Alerts/ThresholdsTableAgentsResourcesSection.tsx", + "frontend-modern/src/components/Alerts/ThresholdsTableTrueNASTab.tsx", + "frontend-modern/src/components/Alerts/alertResourceTableModel.ts", + "frontend-modern/src/components/Infrastructure/resourceDetailDrawerTrueNASModel.ts", + "frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts", + "frontend-modern/src/features/alerts/alertsConfigurationModel.ts", + "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsPlatformData.ts", + "frontend-modern/src/features/alerts/thresholds/trueNASDiskTemperature.ts", + "frontend-modern/src/types/alerts.ts", + "frontend-modern/src/utils/alertThresholdDefaults.ts" + ], + "content_sha256": { + "frontend-modern/src/components/Alerts/AlertResourceTableDesktop.tsx": "4d09dd97adc2868889e256455c207b6b9089ea311713878f0d6ff00efb6b7123", + "frontend-modern/src/components/Alerts/AlertResourceTableMobile.tsx": "ceaf136da9361a5b1756350626a833da4dfebcb4f211c7269d7d89d37fb7e085", + "frontend-modern/src/components/Alerts/ResourceTable.tsx": "7e80a6c789b3069fcadcb86e0a6689e5319e7b0ac5d5bfa1a596520daec2d7e1", + "frontend-modern/src/components/Alerts/ThresholdsTableAgentsResourcesSection.tsx": "fc4e9f4d05c0bf5799acbbe64c37b901e104869ff120819342432563789ad0e9", + "frontend-modern/src/components/Alerts/ThresholdsTableTrueNASTab.tsx": "a22b86c28b65ec18ba81171fb1206a24107a0d97db19d7dd488bdfd0a689a956", + "frontend-modern/src/components/Alerts/alertResourceTableModel.ts": "5881aeaf7ee575589997bf67fb713a01784ce7ca16ecb5a5eaea77f36010837a", + "frontend-modern/src/components/Infrastructure/resourceDetailDrawerTrueNASModel.ts": "b60ba59688d6ea0cabfb2b413b8adcaa85c8d41524c1d1f0df9bdb9e6d85733c", + "frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts": "63b07de3f354f8328298348a8892ad73fde2f11ec6768e9c0f6fc37eb4c43516", + "frontend-modern/src/features/alerts/alertsConfigurationModel.ts": "0e116e65c992a72e21d700835b0cb0db7173be9ec9c4980382958506d4e75976", + "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsPlatformData.ts": "8525b0b012198ff87e29063908a9907b7fa1080cd84187202b1cd3cf198a3b46", + "frontend-modern/src/features/alerts/thresholds/trueNASDiskTemperature.ts": "80433d42dd4658a1449c0f0c378d7fa52cd6dfab117d626195099768e750352f", + "frontend-modern/src/types/alerts.ts": "d072175ab98e3785eae643d655be4c2d54cac0eddc8b55803a2841a312062e5a", + "frontend-modern/src/utils/alertThresholdDefaults.ts": "077e291d5c224063a373a5e9f5555d9b470f585801b0cfdd9dc1acacf233af28" + }, + "routes": [ + "/alerts/thresholds/truenas", + "/truenas/storage" + ], + "viewports": [ + { + "width": 1366, + "height": 900 + }, + { + "width": 375, + "height": 812 + } + ], + "states": [ + "Private mock stack (8 nodes, mock TrueNAS truenas-main) with a local-only generator overlay pinning TrueNAS disk temperatures: nvme0n1 60C, nvme1n1 72C, sda 57C (SATA), sdc 63C (SAS); after = this branch, before = main logic in the same tree", + "Thresholds > TrueNAS > Disks with no saved TrueNAS-wide value: header reads 'Defaults: NVMe 70\u00b0C \u00b7 SAS 65\u00b0C \u00b7 SATA 55\u00b0C', note 'Unless set here, each disk alerts at Disk temperature by type, set under Agents.', Global Defaults Temp cell empty with placeholder 'By type' (fits after widening to w-20) and On, disk rows nvme0n1/nvme1n1 70\u00b0C, sda/sdb 55\u00b0C, sdc-sdf 65\u00b0C", + "Same section at 375px: Global Defaults card shows TEMP \u00b0C 'By type' with On, disk cards show their type triggers, no horizontal overflow", + "Agent Disk Temp default switched off through the API: header 'Defaults: all metric alerts off', Global Defaults cell Off with title 'Off because the agent Disk Temp default under Agents is off...', disk rows Off", + "Saved TrueNAS-wide 62: header 'Defaults: Temp 62\u00b0C', every disk row 62\u00b0C, Custom badge and reset control after reload; saved 55 survives save and reload as 55 (stored with truenasDiskTemperatureByType)", + "Alerts with factory per-type thresholds: after stack raises nvme1n1 72 (trigger 70) and sda 57 (trigger 55) with diskType metadata, none for nvme0n1 60 or sdc 63; before (main) raised all four at a flat 55", + "TrueNAS storage table agrees: Attention 'Disk temperature is 72\u00b0C, at or above its 70\u00b0C alert threshold.' on nvme1n1 and '57\u00b0C ... 55\u00b0C' on sda, none on nvme0n1", + "TrueNAS disk drawer (Platform details > Show TrueNAS > Health): nvme0n1 Temperature 60\u00b0C in default text colour (main toned it amber from the fixed 55C); sda 57\u00b0C amber rgb(252,211,77) at 1366 and at 375 with no overflow" + ], + "interactions": [ + "Typed 62 into the TrueNAS Disks Global Defaults Temp cell, saved, reloaded: API truenasDiskDefaults {trigger 62, clear 57}, cell shows 62 with Custom", + "Triple-clicked and typed 55, saved, reloaded: API keeps {55, 50}, cell shows 55 with Custom and the reset control", + "Clicked Reset to factory defaults: cell returns to 'By type'; saved: API truenasDiskDefaults {}", + "On the 375px card, clicked On to switch the default Off, saved: API stores {trigger 0, clear 0} and the after stack's TrueNAS disk alerts resolve; clicked again: returns to 'By type', saved: {}", + "With the agent Disk Temp default off, clicked the Off badge: stages an explicit 55 (Custom, rows 55\u00b0C); discarded", + "Loaded an old saved config (flat 55/50, no marker) with the new binary: GET returns truenasDiskDefaults {} and truenasDiskTemperatureByType true", + "Expanded nvme0n1 and sda rows on /truenas/storage, opened Platform details and Show TrueNAS, read the Temperature row value and computed colour at 1366 and 375" + ] +} diff --git a/frontend-modern/browser-verification/52bccba8cf17119d.json b/frontend-modern/browser-verification/52bccba8cf17119d.json new file mode 100644 index 0000000000..d8eeeef9fe --- /dev/null +++ b/frontend-modern/browser-verification/52bccba8cf17119d.json @@ -0,0 +1,52 @@ +{ + "version": 1, + "base_sha": "7eb32f318100fef045d63414fd63304c62acfdef", + "verified_at": "2026-10-07T16:55:00Z", + "result": "passed", + "changed_paths": [ + "frontend-modern/src/components/shared/InlineDetailTableRow.tsx" + ], + "content_sha256": { + "frontend-modern/src/components/shared/InlineDetailTableRow.tsx": "e5b27178cb3268132595943058849b3f619da22fcbd7916dfc301d4e852ef244" + }, + "routes": [ + "/standalone/availability", + "/standalone/machines", + "/proxmox", + "/docker", + "/kubernetes" + ], + "viewports": [ + { + "width": 1440, + "height": 900 + }, + { + "width": 1000, + "height": 800 + }, + { + "width": 768, + "height": 1024 + }, + { + "width": 390, + "height": 844 + }, + { + "width": 320, + "height": 700 + } + ], + "states": [ + "Private stacks served by Vite from this tree (Playwright 1.56.1 headless Chromium): a non-mock stack with one HTTP availability check, then a mock estate (3 Proxmox nodes, 2 Docker hosts, 1 Kubernetes cluster, 2 generic hosts).", + "Before (origin/main class max-w-[calc(100vw-3.5rem)]): at 390px every opened drawer (availability check, Proxmox node, Proxmox guest, Docker host, Docker container, Kubernetes node, Machines agent) was 334px inside a 361px visible table, leaving a 27px empty strip; at 768px a table forced wider than its shell got a 712px drawer in a 695px visible area.", + "After (max-w-[100cqi]): drawer content equals the scroll shell's visible width at 320 (291px), 390 (361px), 768 (695px) and 1000 (916px) with no right gap, including the forced-wider table; 1440px keeps the static lg layout (max-width none, 1320px). The availability drawer's hostname now shows in full instead of truncating.", + "Long unwrapped identity chips (e.g. proxmox-lxc-docker:Production West:pve1:107) were already clipped at the content edge before (Kubernetes 20px, Docker 8px and 83px) and are clipped less after (7px, 70px); chip wrapping is a separate follow-up.", + "Sticky positioning is inert in both versions because .table-fixed td sets overflow hidden; not changed here. This is not an installed-build, physical-phone or release acceptance." + ], + "interactions": [ + "Opened each drawer by its disclosure button (row tap at phone width where the button is hidden), measured the scroll shell, detail cell, content shell and every descendant's right edge, and captured screenshots at 390px before and after.", + "Forced a 900px table inside its shell at 390px and 768px and scrolled it 300px sideways to compare drawer width against the visible area for both classes." + ] +} diff --git a/frontend-modern/browser-verification/82459c28d2633b61.json b/frontend-modern/browser-verification/82459c28d2633b61.json new file mode 100644 index 0000000000..729aa732ab --- /dev/null +++ b/frontend-modern/browser-verification/82459c28d2633b61.json @@ -0,0 +1,51 @@ +{ + "version": 1, + "base_sha": "7eb32f318100fef045d63414fd63304c62acfdef", + "verified_at": "2026-10-07T16:47:38Z", + "result": "passed", + "changed_paths": [ + "frontend-modern/src/components/AI/FindingsPanel.tsx", + "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx", + "frontend-modern/src/utils/aiFindingPresentation.ts", + "frontend-modern/src/utils/format.ts" + ], + "content_sha256": { + "frontend-modern/src/components/AI/FindingsPanel.tsx": "6b50ebbf3bbe24e31eebdb3c8be8ac6ca9c08405352facbfcd294a1361d8a2f5", + "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx": "9055b69986cd4d320fd2194dba2819c0643e63326724952fd1021325530e9f5b", + "frontend-modern/src/utils/aiFindingPresentation.ts": "29e212a8d0aed4c1eb17697bbed86519ed82f64bc2940239db4a79470a23a090", + "frontend-modern/src/utils/format.ts": "abaec8a1f40c159e9a58702b726ccaea196bf6b72825c97addbee00af3bd7809" + }, + "routes": [ + "/patrol", + "/patrol/activity" + ], + "viewports": [ + { + "width": 1440, + "height": 900 + }, + { + "width": 390, + "height": 844 + } + ], + "states": [ + "Private mock stack (backend :7793 built from this tree on origin/main 7eb32f3181, Vite :5303 serving it) with Playwright page.clock installed before load and the data held: the /ws proxy dropped every server frame and answered the client heartbeat with a data-free pong, every GET /api/ read was replayed from its cached body (Patrol findings reads left pending), and the clock was moved with setSystemTime plus a 31-second runFor so only the shared 30-second tick fired; one websocket connection and no attention detail re-read for the whole hold", + "Unreviewed suppressed issue (ops-prometheus Docker service health, suppressed through the real form for the default 24 hours; the form's duration read 'Return it to active attention after'): Lifecycle reads 'Returns to active attention in 1d.' with hover 'Suppressed until 8 Oct 17:36' and button 'Return to active attention', then 'in 20h.' at +4h, 'in 29m.' at +23h20m (28m at 390) and 'Suppression has ended.' at +25h, at 1440 and 390", + "Reviewed then suppressed issue (esxi-07.lab.local VMware host health, Mark reviewed then suppressed for 24 hours from its detail; the form's duration read 'End suppression after'): Lifecycle reads 'Suppression ends in 1d. It stays reviewed.' with button 'End suppression', then 'in 20h' at +4h, 'in 29m' at +23h20m (28m at 390) and 'Suppression has ended.' at +25h, at 1440 and 390", + "Patrol activity, Finding options and history, Resolved: mail-gateway-us dismissed through Finding options, Dismiss: Later reads '(will fix later) \u00b7 Reminding in 7d' with hover 'Reminder due 14 Oct 17:36. Pulse brings this finding back on its first reminder check after that.'; at +7d1m it reads 'Reminder overdue' and the 'Overdue commitments (1)' chip appears on that tick with findings reads still pending, and the chip filters to that finding, at 1440 and 390", + "Between ticks: page clock set 5 seconds past that reminder's deadline with no timer fired, then switching from Active to Resolved mounts the row reading 'Reminder due' with no Overdue chip; one 31-second runFor later the row reads 'Reminder overdue' and the 'Overdue commitments (1)' chip appears together, at 1440 and 390", + "Same list, dr-vault snoozed for 1 hour through POST /api/ai/patrol/snooze (Patrol rows hide the snooze buttons): reads 'snoozed, returns in 49m' with hover 'Snoozed until 7 Oct 18:36', 'in 9m' at +40m (8m at 390) and 'snooze ended' at +70m; after releasing the hold the next findings read lists dr-vault under Active, at 1440 and 390", + "No 'just now' on any future time at either viewport (the only 'just now' left is the attention detail's read-time Last seen age)", + "Same-session controls under the running Vite: with FindingsPanel.tsx and aiFindingPresentation.ts swapped to the first draft of this change, the between-ticks row read 'Reminder overdue' with no Overdue chip; with FindingsPanel.tsx, PatrolAttentionWorkbench.tsx, aiFindingPresentation.ts and format.ts swapped back to origin/main, the reviewed issue read 'Returns to active attention just now.' before and after +4h, the reminder 'Reminding just now' before and after +7d with no Overdue chip, and the snooze 'snoozed until just now'" + ], + "interactions": [ + "Opened a decision by its Patrol attention link, filled the suppression reason and submitted Suppress temporarily with the default 24 hours", + "Opened a second decision by its attention link, clicked Mark reviewed, reopened it and suppressed it for 24 hours", + "Opened Finding options and history, opened Finding options on a finding, chose Dismiss: Later and Confirm Dismiss", + "Opened Reviewed and suppressed, opened each suppressed issue from the list, read the Lifecycle line, its hover title and the early-end button", + "Switched the findings filter between Active and Resolved, read reminder and snooze hover titles, stepped the page clock and clicked the Overdue commitments chip", + "Released the hold and switched to Active to see the ended snooze re-derived", + "Repeated every pass at 1440x900 and 390x844, then reran with the first draft and with origin/main's components as controls" + ] +} diff --git a/frontend-modern/browser-verification/d2df05cc61b44990.json b/frontend-modern/browser-verification/d2df05cc61b44990.json new file mode 100644 index 0000000000..6514b6055e --- /dev/null +++ b/frontend-modern/browser-verification/d2df05cc61b44990.json @@ -0,0 +1,39 @@ +{ + "version": 1, + "base_sha": "8e1a564d7e229bda51c021c7e6bde920e0ca0596", + "verified_at": "2026-10-07T14:35:42Z", + "result": "passed", + "changed_paths": [ + "frontend-modern/src/components/Alerts/ThresholdsTableAgentsResourcesSection.tsx" + ], + "content_sha256": { + "frontend-modern/src/components/Alerts/ThresholdsTableAgentsResourcesSection.tsx": "3052a190a76e885e98ed6601b3e83c8959e1c656d12270b87e074fffa95860ac" + }, + "routes": [ + "/alerts/thresholds/systems", + "/alerts/overview", + "/proxmox/storage?tab=disks" + ], + "viewports": [ + { + "width": 1366, + "height": 900 + }, + { + "width": 375, + "height": 812 + } + ], + "states": [ + "Private mock stack (8 PVE nodes) on this branch with a local-only generator overlay pinning PVE disks: pve1 NVMe 63C, pve2 SATA 56C, pve3 NVMe 72C, pve3 SAS 63C, pve3 SATA 66C", + "Alerts > Thresholds > Systems (Agents section): 'Disk temperature by type' card reads 'Alert trigger in \u00b0C for each disk type, for agent, TrueNAS and Proxmox disks. ... a TrueNAS Disks value replaces them for TrueNAS disks.' at 1366, and at 375 the card spans 34-341px with no horizontal overflow", + "Alerts overview: 'Samsung 870 EVO 1TB (/dev/nvme2) (Temperature) CRITICAL on West Production C \u2014 Temperature 66\u00b0C, above the 55\u00b0C alert level; Clears once it drops to 50\u00b0C or lower and stays there for 5 minutes', Alert level 55\u00b0C, Clear level 50\u00b0C", + "Warning-level PVE disk temperature alerts (SATA 56C trigger 55, NVMe 72C trigger 70) appear after the 300s stability window (first breach 15:26:32, firing by 15:31:46); the critical 66C fires at once; none for NVMe 63C or SAS 63C", + "Physical Disks filtered to West Production: exactly the three alerting disks read Running Hot (Crucial MX500 56\u00b0C, WD Black SN850X 72\u00b0C, Samsung 870 EVO 66\u00b0C); the 870 EVO drawer reads 'Running Hot \u2014 Disk temperature is 66\u00b0C, at or above its 55\u00b0C alert threshold.'" + ], + "interactions": [ + "Opened Alerts overview and read the PVE disk temperature alert card", + "Filtered Physical Disks by 'West Production C', expanded the Samsung 870 EVO row", + "Opened Thresholds > Systems, read the Disk temperature by type card at 1366 and at 375" + ] +} diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx index a94dabcf8b..84466a0376 100644 --- a/frontend-modern/src/components/AI/FindingsPanel.tsx +++ b/frontend-modern/src/components/AI/FindingsPanel.tsx @@ -39,6 +39,7 @@ import { AIAPI, type RemediationPlan } from '@/api/ai'; import { createSuppressionRuleFromFinding, reinvestigateFinding } from '@/api/patrol'; import type { PatrolRunRecord, PatrolRuntimeState, PatrolAutonomyLevel } from '@/api/patrol'; import { formatRelativeTime } from '@/utils/format'; +import { useRelativeTimeNow } from '@/utils/relativeTimeClock'; import { getFindingAlertIdentifier, hasTriggeringAlert, @@ -84,6 +85,8 @@ import { getFindingSubjectPresentation, getFindingTitlePresentation, getFindingRecencyPresentation, + getFindingReminderPresentation, + getFindingSnoozePresentation, getFindingEvidencePresentation, hasFindingInvestigationDetails, hasFindingInvestigationHandoffPointer, @@ -194,6 +197,10 @@ function getFindingSuppressionRuleScope(finding: UnifiedFinding) { export const FindingsPanel: Component = (props) => { const location = useLocation(); const [filter, setFilter] = createSignal(props.filterOverride ?? 'active'); + // A reminder or snooze end never changes while its row stays on screen, so + // the countdown to it, and whether a reminder is overdue, read the shared + // clock. + const now = useRelativeTimeNow(); const [sortBy, setSortBy] = createSignal<'severity' | 'time'>('severity'); const [expandedId, setExpandedId] = createSignal(null); let panelRoot: HTMLDivElement | undefined; @@ -338,6 +345,32 @@ export const FindingsPanel: Component = (props) => { } }); + // Will_fix_later commitments whose RemindAt deadline has passed. The Go + // store's proactive sweep (SweepWillFixLaterReminders) wakes these on a 1h + // timer; until then the Overdue commitments chip and filter surface them on + // demand. The list is sampled on the shared clock and notifies only when its + // ids change, so a tick that moves no deadline past now does not rebuild the + // filtered rows. Each row's "Reminder overdue" label reads the same list, so + // a row that mounts between ticks agrees with the chip and filter. + const overdueFindingIds = createMemo( + () => { + const nowMs = now(); + return sourceFindings() + .filter((f) => { + if (f.dismissedReason !== 'will_fix_later' || !f.remindAt) return false; + const due = Date.parse(f.remindAt); + return Number.isFinite(due) && due <= nowMs; + }) + .map((f) => f.id); + }, + [], + { + equals: (prev, next) => + prev.length === next.length && prev.every((id, index) => id === next[index]), + }, + ); + const overdueFindingIdSet = createMemo(() => new Set(overdueFindingIds())); + // Filter and sort findings const filteredFindings = createMemo(() => { if (hasUnknownRunSnapshot()) { @@ -365,22 +398,8 @@ export const FindingsPanel: Component = (props) => { const approvalFindingIds = new Set(sourceFindingsWithPendingApprovals().map((f) => f.id)); findings = findings.filter((f) => approvalFindingIds.has(f.id)); } else if (filter() === 'overdue') { - // Overdue surfaces will_fix_later commitments whose RemindAt - // deadline has already passed. The Go store's proactive sweep - // (SweepWillFixLaterReminders) wakes these on a 1h timer, but - // this filter lets the operator see them on demand — including - // any that the sweep has not yet promoted on this cycle. - const nowMs = Date.now(); - findings = findings.filter((f) => { - if (f.dismissedReason !== 'will_fix_later') { - return false; - } - if (!f.remindAt) { - return false; - } - const due = Date.parse(f.remindAt); - return Number.isFinite(due) && due <= nowMs; - }); + const overdueIds = overdueFindingIdSet(); + findings = findings.filter((f) => overdueIds.has(f.id)); } // Filter by specific finding IDs if provided @@ -468,17 +487,8 @@ export const FindingsPanel: Component = (props) => { ? scopedPendingApprovalCount() : sourceFindingsWithPendingApprovals().length, })); - // Count of will_fix_later commitments whose RemindAt deadline has - // already passed. Drives the Overdue commitments chip below. - const overdueCount = createMemo(() => { - const nowMs = Date.now(); - return sourceFindings().filter((f) => { - if (f.dismissedReason !== 'will_fix_later') return false; - if (!f.remindAt) return false; - const due = Date.parse(f.remindAt); - return Number.isFinite(due) && due <= nowMs; - }).length; - }); + // Drives the Overdue commitments chip below. + const overdueCount = createMemo(() => overdueFindingIds().length); // Active findings that restate an active alert (backend-stamped mirror). // They are demoted into a collapsed group below the list rather than shown // as separate items: the alert already owns that condition on the Patrol @@ -1279,18 +1289,27 @@ export const FindingsPanel: Component = (props) => { {formatOperatorStateDismissCauseLabel(getOperatorStateDismissCause(finding))} - - - {' · '}Reminding {formatTime(finding.remindAt!)} - + + {(reminder) => ( + + {' · '} + {reminder().label} + + )} - - - {' · '}snoozed until {formatTime(finding.snoozedUntil!)} - + + {(snooze) => ( + + {' · '} + {snooze().label} + + )} diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx index 08e50ab8fc..737b3cf7d2 100644 --- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx +++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx @@ -1,8 +1,9 @@ import { fireEvent, render, screen, waitFor } from '@solidjs/testing-library'; -import type { JSX } from 'solid-js'; +import { createSignal, type JSX } from 'solid-js'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { FindingsPanel } from '../FindingsPanel'; +import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock'; const mockState = vi.hoisted(() => { const loadFindings = vi.fn(); @@ -784,3 +785,163 @@ describe('FindingsPanel investigate action gating', () => { expect(busyButton).toBeDisabled(); }); }); + +describe('FindingsPanel future times', () => { + const hour = 60 * 60 * 1000; + + beforeEach(() => { + mockState.findings = [...mockState.initialFindings]; + mockState.loadPatrolFindings.mockClear(); + mockState.findingsLoading = false; + mockState.findingsError = null; + mockState.patrolFindingsLoading = false; + mockState.patrolFindingsError = null; + mockState.patrolPendingApprovals = []; + }); + + it('counts reminders and snoozes down on the shared clock instead of reading just now', () => { + vi.useFakeTimers({ + toFake: ['Date', 'setInterval', 'clearInterval'], + now: Date.parse('2026-03-30T12:00:00Z'), + }); + mockState.patrolFindings = [ + { + ...mockState.initialPatrolFindings[0], + id: 'finding-later', + title: 'Backup job keeps slipping', + status: 'dismissed', + dismissedReason: 'will_fix_later', + remindAt: '2026-04-06T12:00:00Z', + }, + { + ...mockState.initialPatrolFindings[0], + id: 'finding-snoozed', + title: 'Swap pressure on vm-100', + status: 'snoozed', + snoozedUntil: '2026-03-30T15:00:00Z', + }, + ]; + + try { + render(() => ); + + const reminder = screen.getByText(/Reminding in 7d/); + const snooze = screen.getByText(/snoozed, returns in 3h/); + expect(reminder).toHaveAttribute( + 'title', + expect.stringMatching( + /^Reminder due .+\. Pulse brings this finding back on its first reminder check after that\.$/, + ), + ); + expect(snooze).toHaveAttribute('title', expect.stringMatching(/^Snoozed until /)); + expect(screen.queryByText(/just now/)).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /Overdue commitments/ })).not.toBeInTheDocument(); + + // The findings are not re-read: only the shared clock moves. + vi.advanceTimersByTime(2 * hour); + expect(snooze).toHaveTextContent('snoozed, returns in 1h'); + + vi.advanceTimersByTime(hour); + expect(snooze).toHaveTextContent('snooze ended'); + + vi.setSystemTime(Date.parse('2026-04-06T12:30:00Z')); + vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS); + expect(reminder).toHaveTextContent('Reminder overdue'); + // The Overdue commitments chip reads the same clock as the label, with no + // findings re-read. + expect(screen.getByRole('button', { name: /Overdue commitments \(1\)/ })).toBeInTheDocument(); + expect(reminder).toHaveAttribute('title', expect.stringMatching(/^Reminder was due /)); + } finally { + vi.useRealTimers(); + } + }); + + it('keeps overdue rows mounted across clock ticks and adds a reminder once it falls due', () => { + vi.useFakeTimers({ + toFake: ['Date', 'setInterval', 'clearInterval'], + now: Date.parse('2026-03-30T12:00:00Z'), + }); + mockState.patrolFindings = [ + { + ...mockState.initialPatrolFindings[0], + id: 'finding-overdue', + title: 'Certificate renewal keeps slipping', + status: 'dismissed', + dismissedReason: 'will_fix_later', + remindAt: '2026-03-30T11:00:00Z', + }, + { + ...mockState.initialPatrolFindings[0], + id: 'finding-due-soon', + title: 'Backup job keeps slipping', + status: 'dismissed', + dismissedReason: 'will_fix_later', + remindAt: '2026-03-30T12:10:00Z', + }, + ]; + + try { + render(() => ); + fireEvent.click(screen.getByRole('button', { name: /Overdue commitments \(1\)/ })); + + const review = screen.getByRole('button', { + name: 'Review issue for Certificate renewal keeps slipping', + }); + review.focus(); + expect(screen.queryByText('Backup job keeps slipping')).not.toBeInTheDocument(); + + // A tick that moves no deadline past now leaves the rows alone. + vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS); + expect(review.isConnected).toBe(true); + expect(document.activeElement).toBe(review); + + // Once the second reminder falls due it joins the open Overdue filter + // and the chip count, on the same clock as the row labels. + vi.advanceTimersByTime(10 * 60 * 1000); + expect(screen.getByText('Backup job keeps slipping')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: /Overdue commitments \(2\)/ })).toBeInTheDocument(); + } finally { + vi.useRealTimers(); + } + }); + + it('calls a reminder overdue only once the Overdue commitments list holds it', () => { + vi.useFakeTimers({ + toFake: ['Date', 'setInterval', 'clearInterval'], + now: Date.parse('2026-03-30T12:00:00Z'), + }); + mockState.patrolFindings = [ + { + ...mockState.initialPatrolFindings[0], + id: 'finding-due', + title: 'Certificate renewal keeps slipping', + status: 'dismissed', + dismissedReason: 'will_fix_later', + remindAt: '2026-03-30T12:00:05Z', + }, + ]; + const [filter, setFilter] = createSignal<'active' | 'resolved'>('active'); + + try { + render(() => ); + expect(screen.queryByText('Certificate renewal keeps slipping')).not.toBeInTheDocument(); + + // The deadline passes between ticks of the shared clock, and the row + // first mounts before the next tick: it must not call itself overdue + // while the chip and filter do not count it. + vi.setSystemTime(Date.parse('2026-03-30T12:00:10Z')); + setFilter('resolved'); + expect(screen.getByText('Certificate renewal keeps slipping')).toBeInTheDocument(); + expect(screen.getByText(/Reminder due/)).toBeInTheDocument(); + expect(screen.queryByText(/Reminder overdue/)).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /Overdue commitments/ })).not.toBeInTheDocument(); + + // The next tick moves the label, the chip and the filter together. + vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS); + expect(screen.getByText(/Reminder overdue/)).toBeInTheDocument(); + expect(screen.getByRole('button', { name: /Overdue commitments \(1\)/ })).toBeInTheDocument(); + } finally { + vi.useRealTimers(); + } + }); +}); diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts index d5f0381115..ebc272e95c 100644 --- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts +++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts @@ -22,6 +22,8 @@ import { getFindingSeveritySortOrder, getFindingResolutionReason, getFindingRecencyPresentation, + getFindingReminderPresentation, + getFindingSnoozePresentation, getFindingLoopStateBadgeClasses, getFindingLoopStateBadgeTone, getFindingSeverityBadgeClasses, @@ -369,11 +371,14 @@ describe('FindingsPanel assistant handoff', () => { // Once a finding is dismissed as will_fix_later, the row must surface the // pending reminder so the operator knows the commitment exists; otherwise // the only place the deadline lives is the lifecycle log. The amber tone - // signals "pending operator action" rather than a generic muted note. - expect(findingsPanelSource).toContain( - "finding.dismissedReason === 'will_fix_later' && finding.remindAt", + // signals "pending operator action" rather than a generic muted note. The + // deadline is in the future, so it counts down on the shared clock rather + // than going through the past-only age formatter, and it reads overdue from + // the same list as the Overdue commitments chip. + expect(findingsPanelSource).toMatch( + /getFindingReminderPresentation\(\s*finding,\s*now\(\),\s*overdueFindingIdSet\(\)\.has\(finding\.id\),?\s*\)/, ); - expect(findingsPanelSource).toContain('Reminding {formatTime(finding.remindAt!)}'); + expect(findingsPanelSource).not.toContain('formatTime(finding.remindAt'); expect(findingsPanelSource).toContain('text-amber-600 dark:text-amber-400'); }); @@ -652,6 +657,92 @@ describe('aiFindingPresentation', () => { }); }); + describe('findingReminderAndSnoozePresentation', () => { + const now = Date.parse('2026-03-25T12:00:00Z'); + + it('counts down to a will_fix_later reminder instead of reading it as just now', () => { + const reminder = getFindingReminderPresentation( + { dismissedReason: 'will_fix_later', remindAt: '2026-03-31T12:00:00Z' }, + now, + false, + ); + expect(reminder?.label).toBe('Reminding in 6d'); + expect(reminder?.title).toMatch( + /^Reminder due .+\. Pulse brings this finding back on its first reminder check after that\.$/, + ); + expect(reminder?.title).not.toContain('still tripping'); + expect( + getFindingReminderPresentation( + { dismissedReason: 'will_fix_later', remindAt: '2026-03-25T15:00:00Z' }, + now, + false, + )?.label, + ).toBe('Reminding in 3h'); + }); + + it('calls a reminder overdue once the Overdue commitments list holds it', () => { + const reminder = getFindingReminderPresentation( + { dismissedReason: 'will_fix_later', remindAt: '2026-03-25T11:00:00Z' }, + now, + true, + ); + expect(reminder?.label).toBe('Reminder overdue'); + expect(reminder?.title).toMatch( + /^Reminder was due .+\. Pulse brings this finding back on its next reminder check\.$/, + ); + // Past the deadline but not yet on the list (it is sampled on the next + // clock tick), so the chip and filter would not count it yet. + expect( + getFindingReminderPresentation( + { dismissedReason: 'will_fix_later', remindAt: '2026-03-25T11:59:50Z' }, + now, + false, + )?.label, + ).toBe('Reminder due'); + }); + + it('shows no reminder for other dismissals or an unusable remind time', () => { + expect( + getFindingReminderPresentation( + { dismissedReason: 'not_an_issue', remindAt: '2026-03-31T12:00:00Z' }, + now, + false, + ), + ).toBeNull(); + expect( + getFindingReminderPresentation({ dismissedReason: 'will_fix_later' }, now, false), + ).toBeNull(); + expect( + getFindingReminderPresentation( + { dismissedReason: 'will_fix_later', remindAt: 'not a date' }, + now, + true, + ), + ).toBeNull(); + }); + + it('counts down to the end of a snooze and keeps the exact time on hover', () => { + const snooze = getFindingSnoozePresentation( + { status: 'snoozed', snoozedUntil: '2026-03-25T15:00:00Z' }, + now, + ); + expect(snooze?.label).toBe('snoozed, returns in 3h'); + expect(snooze?.title).toMatch(/^Snoozed until .+/); + expect( + getFindingSnoozePresentation( + { status: 'snoozed', snoozedUntil: '2026-03-25T11:00:00Z' }, + now, + )?.label, + ).toBe('snooze ended'); + expect( + getFindingSnoozePresentation( + { status: 'active', snoozedUntil: '2026-03-25T15:00:00Z' }, + now, + ), + ).toBeNull(); + }); + }); + describe('patrolFindingClassification', () => { it('describes grouped Patrol findings as issues instead of internal signals', () => { expect(getPatrolFindingIssueCountLabel(0)).toBe('0 issues'); @@ -997,7 +1088,8 @@ describe('aiFindingPresentation', () => { it('uses explicit textual separators in finding metadata instead of relying on visual spacing', () => { expect(findingsPanelSource).toContain("{' · '}acknowledged"); expect(findingsPanelSource).toContain("{' · '}last investigated"); - expect(findingsPanelSource).toContain("{' · '}snoozed until"); + expect(findingsPanelSource).toMatch(/\{' · '\}\s*\{snooze\(\)\.label\}/); + expect(findingsPanelSource).toMatch(/\{' · '\}\s*\{reminder\(\)\.label\}/); }); it('keeps the Open work heading free of a duplicate count badge', () => { diff --git a/frontend-modern/src/components/Alerts/AlertResourceTableDesktop.tsx b/frontend-modern/src/components/Alerts/AlertResourceTableDesktop.tsx index 92593af32f..92232f4ee8 100644 --- a/frontend-modern/src/components/Alerts/AlertResourceTableDesktop.tsx +++ b/frontend-modern/src/components/Alerts/AlertResourceTableDesktop.tsx @@ -43,12 +43,11 @@ import { ALERT_RESOURCE_METRIC_OFF_VALUE, getAlertResourceColumnKind, getAlertResourceColumnHeaderTooltip, - getAlertResourceEnabledDefault, getAlertResourceMetricBounds, getAlertResourceMetricDelayOverride, getAlertResourceMetricStep, - isAlertResourceMetricOff, normalizeAlertResourceMetricKey, + resolveAlertResourceGlobalDefaultCell, } from './alertResourceTableModel'; import type { OfflineState, Resource, ResourceTableProps } from './ResourceTable'; @@ -210,7 +209,10 @@ export function AlertResourceTableDesktop(props: AlertResourceTableDesktopProps) {(column) => ( {column} @@ -281,10 +283,14 @@ export function AlertResourceTableDesktop(props: AlertResourceTableDesktopProps) {(column) => { const metric = normalizeAlertResourceMetricKey(column); const bounds = getAlertResourceMetricBounds(metric); - const value = () => props.table.globalDefaults?.[metric] ?? 0; + const value = () => props.table.globalDefaults?.[metric]; + const fallback = () => props.table.globalDefaultFallbacks?.[metric]; // An unset default and a stored 0 are both disabled to the - // alert engine, so neither may render as On. - const isOff = () => isAlertResourceMetricOff(value()); + // alert engine, so neither may render as On, unless the + // metric's unset default follows another setting. + const cell = () => + resolveAlertResourceGlobalDefaultCell(metric, value(), fallback()); + const isOff = () => cell().isOff; return ( { const nextValue = parseFloat(e.currentTarget.value); @@ -318,12 +328,16 @@ export function AlertResourceTableDesktop(props: AlertResourceTableDesktopProps) })); props.table.setHasUnsavedChanges?.(true); }} - class={`w-16 px-2 py-0.5 text-sm text-center border rounded ${ + class={`${cell().follows && !isOff() ? 'w-20' : 'w-16'} px-2 py-0.5 text-sm text-center border rounded ${ isOff() ? 'border-border bg-surface-alt text-muted italic placeholder: dark:placeholder: placeholder:opacity-60 pointer-events-none' : 'border-border text-base-content focus:border-blue-500 focus:ring-1 focus:ring-blue-500' }`} - title={getAlertResourceTableMetricInputTitle(isOff())} + title={ + cell().follows + ? fallback()?.title + : getAlertResourceTableMetricInputTitle(isOff()) + } />