Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Add workload history discovery lens
Pulse Test161e322ee017
diff --git a/docs/PRIVACY.md b/docs/PRIVACY.mdindex a9fe5efb34..394bf837d3 100644--- a/docs/PRIVACY.md+++ b/docs/PRIVACY.md@@ -16,7 +16,7 @@ third-party analytics, support diagnostics, or ordinary Settings surfaces.Pulse includes outbound usage telemetry that is **enabled by default**. It sends a lightweight ping on startup and once every 24 hours with a rotating pseudonymous install ID to help me understand how many active installations exist, which releases are actually deployed, which features are in use, and whether Patrol control and governed Pulse Intelligence operations are being adopted.-The telemetry payload does not include hostnames, credentials, infrastructure identifiers, IP addresses, URLs, paths, locale, prompts, chat messages, command text, action output, token values, names, email addresses, or account identifiers. Lifecycle and outcome signals are deliberately limited to closed buckets, booleans, and aggregate counts. Local service-health signals are likewise limited to closed buckets, booleans, and normalized release versions. Pulse does not send browser events or an event-level clickstream. The local service-health probe requests only Pulse's own bound listener and never transmits the listener address, request URL, response content, or raw failure text. See the full field list below.+The telemetry payload does not include hostnames, credentials, infrastructure identifiers, IP addresses, URLs, paths, locale, prompts, chat messages, command text, action output, token values, names, email addresses, or account identifiers. Lifecycle and outcome signals are deliberately limited to closed buckets, booleans, and aggregate counts. Local service-health signals are likewise limited to closed buckets, booleans, and normalized release versions. Four browser-derived workload-history milestones are counted locally at most once per browser session and sent only as rolling aggregate counts; Pulse does not send raw browser events or an event-level clickstream. The local service-health probe requests only Pulse's own bound listener and never transmits the listener address, request URL, response content, or raw failure text. See the full field list below.While mock/demo fixture mode is enabled, Pulse suppresses outbound telemetry entirely: a mock-mode instance reports a synthetic fixture fleet rather than a real installation, so it never pings.@@ -37,7 +37,7 @@ Every field is listed below with the reason it exists. Nothing else is included| Field | Example | Purpose ||-------|---------|---------|-| Schema version | `15` | Identify the exact payload contract so old and new signals are not mixed silently |+| Schema version | `16` | Identify the exact payload contract so old and new signals are not mixed silently || Sent at | `2026-07-23T08:30:00Z` | Date the individual heartbeat without sending a history of client activity || Install ID | `a1b2c3d4-...` | Distinguish active installations within one rotation window without tying telemetry to an account or person || Version | `6.0.0-rc.1` | Track the canonical release identity currently deployed |@@ -236,6 +236,10 @@ Every field is listed below with the reason it exists. Nothing else is included| Pulse Intelligence approved action refusals: other 30d | `1` | Count pre-dispatch refusals not covered by the fixed categories without sending raw error or action content || Pulse Intelligence verified finding resolutions 30d | `1` | Count approved Patrol-origin actions whose execution succeeded and whose linked finding postcondition was independently confirmed, without sending finding IDs, action IDs, evidence, resources, or fix details || Pulse Intelligence approved action last failure reason 30d | `plan_drift` | See one fixed machine reason code for the most recent approved-action failure in the current 30-day telemetry window without sending error text, action output, command text, resource IDs, or actors |+| Workload history preview sessions 30d | `18` | Count browser sessions that successfully displayed a populated workload history preview, deduplicated locally once per session without sending a guest, user, route, timing, or browser identifier |+| Workload history scrub sessions 30d | `9` | Count browser sessions that inspected a point on a workload history graph, deduplicated locally once per session without sending coordinates, values, guests, or browser identity |+| Workload history range change sessions 30d | `6` | Count browser sessions that changed the workload history range, deduplicated locally once per session without sending the selected range or browser identity |+| Workload history details selection sessions 30d | `4` | Count browser sessions that chose the legacy Details hover mode, deduplicated locally once per session without sending subsequent interactions or browser identity |Telemetry schema v3 corrects the meaning of `notification_failures_7d`: v2counted every unsuccessful queue attempt, including attempts that later@@ -255,7 +259,7 @@ configuration, destination rejection, and unknown failures. Classification isperformed locally; raw error text and destination/provider identity are neverincluded in the payload.-The current telemetry contract is schema version 15. Schema v15 adds an eighth+Schema v15 adds an eighthfixed notification terminal-failure counter for destination HTTP 5xx servererrors. From v15 onward,new terminal failures enter `notification_failures_rejected_7d` only for HTTP@@ -283,6 +287,14 @@ occurrence exists, leaving no trustworthy fired-alert denominator. Detectedflapping episodes are not reported because their diagnostic event path may bedropped under pressure. Configuration adoption is reported instead.+The current telemetry contract is schema version 16. Schema v16 adds four+workload-history adoption counts. The browser+sends only one closed milestone name to the local Pulse server and deduplicates+each milestone once per browser session. Pulse stores bounded UTC-day counts+locally and includes only their rolling 30-day totals in the existing heartbeat;+there is no browser identifier, raw event stream, guest identity, selected+range, cursor coordinate, value, route, or interaction timing.+#### Server-side handling and retention- Telemetry pings are stored on the Pulse license server only for aggregate install/use analysis.@@ -301,7 +313,7 @@ dropped under pressure. Configuration adoption is reported instead.- No IP addresses are included in the telemetry payload or stored in telemetry rows- No hostnames, node names, VM names, or any infrastructure identifiers-- No URLs, filesystem paths, locale, browser events, or event-level clickstream+- No URLs, filesystem paths, locale, raw browser events, or event-level clickstream- No Proxmox credentials, API tokens, or passwords- No alert content, AI prompts, chat messages, tool names, tool inputs, tool outputs, command text, action output, or token values- No names, email addresses, account identifiers, or other intentionally identifying personal contentdiff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex af1b3b4401..14ead6863e 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -1532,6 +1532,12 @@ may consume those details only after the caller reaches the authenticated orprivileged security-status tier; it must not infer lifecycle readiness fromthe intentionally sparse public response.+The authenticated `POST /api/usage/workload-history` intake is adjacent+product-adoption telemetry only. It accepts a closed content-free activity and+updates a bounded aggregate tally; it does not identify, register, authorize,+configure, update, or report a Pulse agent and must not consume agent tokens,+agent inventory, registration state, or command-channel readiness.+1. Add or change install-command generation, canonical /api/auto-register behavior, or installer download behavior through the owned `internal/api/` files above.Canonical `/api/auto-register` auth is split by intent: when the setup-tokenbootstrap path succeeds, lifecycle clients must complete registration withdiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 5c75b5b76f..e223190be1 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -270,10 +270,12 @@ the current command-enabled boolean.31. `frontend-modern/src/api/nodes.ts`32. `frontend-modern/src/api/license.ts`23a. `frontend-modern/src/api/settings.ts`+ 23b. `frontend-modern/src/api/workloadHistoryActivity.ts`33. `frontend-modern/src/api/monitoredSystemLedger.ts`34. `frontend-modern/src/api/resources.ts`35. `frontend-modern/src/api/monitoring.ts`36. `internal/api/monitored_system_ledger.go`+ 36a. `internal/api/telemetry_workload_history.go`37. `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`38. `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`39. `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`@@ -9805,6 +9807,18 @@ identity. The schema parity checker remains the executable cross-repositoryproof that the browser preview and private allowlisted receiver cannot driftfrom the public runtime payload.+### Workload history telemetry is a closed aggregate contract at schema v16++Schema v16 adds four numeric 30-day counters for workload-history preview,+scrub, range-change, and Details-mode-selection sessions. The frontend local+intake request is exactly `{ "activity": <closed enum> }`; it is authenticated+with `monitoring:read`, rejects unknown fields and trailing JSON, and returns+204. Each activity is deduplicated once per browser session before the request.+The Go sender, Settings preview interface, and Pulse Pro receiver keep the same+field names and integer types. The receiver clamps them like every other count.+No guest, user, route, selected range, cursor coordinate/value, timing, or+browser identifier is part of either API or heartbeat contract.+### Per-tenant resource stores are released on offboarding and shutdown`ResourceHandlers.getStore` opens a SQLite handle per org and caches it for thediff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex be04d370bb..4e102ad49b 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -46,9 +46,10 @@ Platform-owned workload controls extend the shared `WorkloadsFilter` viewoptions rather than creating page-local toolbar shells. Persistent presentationchoices compose the shared `ViewOptionsDisclosure` instead of occupying theprimary filter rail: layout, metric style, chart visibility, memory basis, and-columns remain discoverable behind one `View` trigger, while the trend range-may stay inline only when trends are active because it is the frequent-analytical control. That inline range must carry a visible contextual label.+columns remain discoverable behind one `View` trigger. The history range stays+inline in both metric modes because bars now expose an intent-driven row+history lens and Trends keeps the same charts persistent. That inline range+must carry a visible contextual label.Controls inside the View disclosure must expand in place rather than openingnested absolute panels that can clip or create competing overlay stacks. TheProxmox page owns and persists the `Guest` / `Host` memory basis;@@ -62,6 +63,25 @@ flag, while the shared picker owns the discoverable menu placement and buttonpresentation. Tables without manual sizing omit both properties and retain theexisting picker unchanged.+The default Workloads metric presentation keeps compact progress bars at rest.+A fine-pointer preview or keyboard focus on one guest row replaces CPU, memory,+and disk together with the existing `MetricMiniSparkline` presentation without+changing row height; touch pointer entry does not trigger this transient lens,+and the persistent Trends View choice remains the touch-accessible fallback.+The active chart owns its local tooltip while its normalized cursor position is+shared across sibling charts in that guest row, so every guide represents the+same relative point in the selected history range. Leaving the row clears the+cursor and restores all three bars together. The lens mounts with a short+reduced-motion-safe fade and must not leave both bar and chart semantics in the+accessibility tree simultaneously.+Bar mode resolves history only for that active guest through its canonical+metrics target and the selected compact range; it must not start an+estate-wide chart request merely because the range changes. The active request+key is stable across equivalent live guest snapshots, and leaving the row or+selecting another range aborts superseded browser work. Persistent Trends may+retain the shared estate reader, but range changes must clear prior-range data+unless an exact-key cache entry exists.+Feature-owned scope controls that use the shared filter rail must keep theirstate in the owning route and use stable, domain-authored option identities.The Proxmox Backups `Backup location` control composes the shared filter@@ -151,6 +171,13 @@ group. The group owns one absolute hovered timestamp, while each chart mapsthat timestamp through its own plot geometry and nearest stored sample socrosshairs and tooltips remain time-aligned without coupling unrelated rangesor assuming identical value scales.+Workload tables expose their inline history lens through one shared filter+contract. Its first-use hint is visible only while bar or history metrics are+available, disappears after a populated guest preview succeeds, and is passed+through provider-owned compositions such as `ProxmoxPageSurface` rather than+reimplemented by each surface. Hover and range interactions remain session+deduplicated so the presentation layer cannot create per-row or per-frame+telemetry traffic.Object-detail navigation follows that same canonical split across platform andfeature owners. `Overview` is the stable landing tab for current operationalfacts, while stored metric charts appear only after selecting an evidence-gated@@ -3574,6 +3601,17 @@ it keeps at most 20 recent node/range summaries and aborts in-flight requestswhen organization ownership changes. Drawer navigation, chart range churn,background tabs, reconnects, and server restarts must not turn either cacheinto an append-only browser history.+Consumers whose visible meaning changes with the source key may set+`retainPreviousValueOnSourceChange` to `false`. When the new key has no retained+entry, the helper must clear to the consumer's initial value in the same+reactive turn before starting the replacement request; a failed or slow history+range request must never leave data from the previous range labeled as the+newly selected range. Cached data for the exact new key may still render+immediately and refresh in the background.+Each query run receives an `AbortSignal`; changing the source, resetting the+query, or unmounting its owner must abort the superseded browser request before+starting replacement work. Consumers must forward that signal through their+API/cache layer when the transport supports cancellation.The settings reporting shell now also owns a deliberate split betweenhistorical performance reports and current-state VM inventory export.`frontend-modern/src/components/Settings/ReportingPanel.tsx`,diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 56996a0877..f2fccd8331 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -734,6 +734,13 @@ change may globally weaken the Task 03 lifecycle-state idempotency invariant.Docker, Podman, and future container runtimes keep the same identity tonesacross Workloads, Docker, and infrastructure surfaces without addingper-row styling branches to the hot path.+ Workload history adoption signals may be emitted from this surface only+ through the session-deduplicated, closed activity boundary in+ `frontend-modern/src/api/workloadHistoryActivity.ts`. Pointer movement may+ update the shared in-memory cursor on every frame, but it must never create+ a per-frame, per-point, or per-row request stream; the scrub milestone is+ recorded at most once per browser session and contains no guest, cursor,+ value, route, timing, or browser identity.App-container image cells must use the shared compact image formatter toshow the image leaf plus tag/version while preserving the full registry andnamespace reference in tooltip/detail metadata, and the image column must@@ -1449,7 +1456,7 @@ request-local. Deriving the bounded host-plus-Docker or Docker-only tokenscope and matching install flag must remain constant work with no resourceinventory scan, telemetry fan-out, or extra persistence pass.-The bars / sparklines toggle and its sparkline-range picker on the+The bars / sparklines toggle, row-history lens, and history-range picker on theWorkloadsSurface support page-level ownership through four optionaloverrides exposed by`frontend-modern/src/components/Workloads/useWorkloadsState.ts`:@@ -1462,7 +1469,9 @@ top hosts table today), the page owns the persistent signals against+ change handlers into both surfaces. `useWorkloadsControlsState` thenshort-circuits to the supplied accessor / handler instead of itsinternal persistent signal so the toggle and the hosts-table render-stay in lockstep. Embedded sibling tables that opt into sparklines+stay in lockstep. The history range remains inline in both display modes because+the default bars mode uses it for the intent-driven guest-row history lens.+Embedded sibling tables that opt into sparklinesre-instantiate `useWorkloadTableMetricHistory`; the cache key matchesthe workloads-table reader so both readers dedupe their fetches andthe canonical Workloads hot-path budget is preserved. Standalone@@ -1510,7 +1519,7 @@ AI actions belongs on intentful guest/action surfaces, such as the guestdrawer, where the operator is inspecting a specific workload and can decidewhether that guest should be agent-managed.-Trend-mode cells own their vertical scale through+Trend-mode and row-history-lens cells own their vertical scale through`getMetricMiniSparklineScale` in`frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts`.Percent series are zero-floored and scaled to their own observed peak with a@@ -1521,17 +1530,26 @@ memory or an idle guest's CPU on top of the axis rule, where a flat line isindistinguishable from missing history. Absolute level stays readable throughthe per-cell current-value label, the hover tooltip, and bar mode, so scalework must not remove those. The scale is derived from the points already-fetched for that cell and must not add history reads, cross-row coordination,-or a second pass over the Workloads hot path.+fetched for that cell and must not add history reads or a second pass over the+Workloads hot path. Pointer scrubbing may synchronize one normalized cursor+position across the active guest row, but it must remain row-local and operate+only on the already-fetched series.The Workloads table metric display mode is part of the protected Workloads-hot path. The default bar mode must keep the existing zero-extra-history cost;-the sparkline mode may hydrate a short shared history window only when selected-and must reuse `fetchWorkloadsSummaryAndCache` /-`fetchInfrastructureSummaryAndCache` instead of adding row-local polling. Its-range control is part of the same hot-path state owner: bar mode must not start-history fetches, and sparkline ranges must stay bounded to the governed compact-table windows. Expanded history belongs in the existing guest drawer chart+hot path. Default bar mode keeps compact current-value bars at rest and swaps+only the active fine-pointer or keyboard-focused guest row to the original+sparklines; persistent Trends mode keeps sparklines visible for every rendered+row. Bar mode does not hydrate estate history at rest: the selected range is+local state until a row is active, then one centralized query reads only that+guest's canonical metrics target from `/api/metrics-store/history`, capped at+36 points. Equivalent live guest snapshots must not restart that request, and+leaving the row disables it; per-row query owners, fan-out, and polling remain+forbidden. Persistent Trends retains the shared, cache-keyed+`fetchWorkloadsSummaryAndCache` / `fetchInfrastructureSummaryAndCache` reader+for all rendered rows. Range-sensitive readers clear prior-range data when no+exact cache entry exists and forward cancellation so superseded range work+does not continue occupying browser connections. Sparkline ranges must stay+bounded to the governed compact table windows. Expanded history belongs in the existing guest drawer chartsurface, where longer-range reads stay demand-driven and scoped to the selectedworkload. Its range control belongs in the drawer chrome rather than a dedicatedchart row. The drawer history view must preserve visual density by groupingdiff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.mdindex ada0847c6b..6089b9931d 100644--- a/docs/release-control/v6/internal/subsystems/security-privacy.md+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md@@ -173,29 +173,31 @@ invisible to operators reviewing exactly what Pulse sends.27. `internal/config/watcher.go`28. `internal/telemetry/telemetry.go`29. `internal/telemetry/service_health.go`-30. `pkg/server/service_health.go`-31. `pkg/server/telemetry_pulse_intelligence.go`-32. `internal/api/router_routes_auth_security.go`-33. `internal/crypto/crypto.go`-34. `internal/securityutil/secure_storage_dir.go`-35. `internal/cloudcp/auth/magiclink.go`-36. `internal/cloudcp/auth/magiclink_store.go`-37. `pkg/tlsutil/fingerprint.go`-38. `pkg/audit/audit.go`-39. `pkg/audit/async_logger.go`-40. `pkg/audit/sqlite_logger.go`-41. `pkg/audit/signer.go`-42. `pkg/audit/sqlite_factory.go`-43. `pkg/extensions/audit_admin.go`-44. `scripts/telemetry_adoption_report.py`-45. `frontend-modern/src/components/Settings/DataHandlingPanel.tsx`-46. `frontend-modern/src/components/Settings/dataHandlingPanelModel.ts`-47. `internal/api/agent_exec_token_binding.go`-48. `internal/logging/logging.go`-49. `pkg/auth/rbac.go`-50. `pkg/auth/rbac_manager.go`-51. `pkg/auth/sqlite_manager.go`-52. `pkg/server/server.go`+30. `internal/config/workload_history_activity_tally.go`+31. `internal/api/telemetry_workload_history.go`+32. `pkg/server/service_health.go`+33. `pkg/server/telemetry_pulse_intelligence.go`+34. `internal/api/router_routes_auth_security.go`+35. `internal/crypto/crypto.go`+36. `internal/securityutil/secure_storage_dir.go`+37. `internal/cloudcp/auth/magiclink.go`+38. `internal/cloudcp/auth/magiclink_store.go`+39. `pkg/tlsutil/fingerprint.go`+40. `pkg/audit/audit.go`+41. `pkg/audit/async_logger.go`+42. `pkg/audit/sqlite_logger.go`+43. `pkg/audit/signer.go`+44. `pkg/audit/sqlite_factory.go`+45. `pkg/extensions/audit_admin.go`+46. `scripts/telemetry_adoption_report.py`+47. `frontend-modern/src/components/Settings/DataHandlingPanel.tsx`+48. `frontend-modern/src/components/Settings/dataHandlingPanelModel.ts`+49. `internal/api/agent_exec_token_binding.go`+50. `internal/logging/logging.go`+51. `pkg/auth/rbac.go`+52. `pkg/auth/rbac_manager.go`+53. `pkg/auth/sqlite_manager.go`+54. `pkg/server/server.go`## Shared Boundaries@@ -342,6 +344,15 @@ creation, unauthenticated delivery, raw SMTP secret exposure, or bypasses forthe `white_label` branding entitlement.1. Change privacy disclosures, usage-data vocabulary, or outbound-data guarantees through `docs/PRIVACY.md`, `frontend-modern/public/docs/PRIVACY.md`, `internal/telemetry/telemetry.go`, and `pkg/server/telemetry_pulse_intelligence.go` together.+ Workload-history adoption telemetry may cross the browser boundary only as+ one of four closed milestones: populated preview, cursor scrub, range+ change, or Details-mode selection. The browser must deduplicate each value+ once per session before calling the authenticated local intake. The intake+ rejects unknown fields and values, and persistence retains only bounded+ UTC-day counts. Guest/user identity, route, selected range, cursor/value,+ timing, browser identity, and raw event streams are forbidden at every+ layer; only rolling 30-day aggregate counts enter the existing opt-out+ startup/daily heartbeat.Mock/demo fixture mode is a hard suppression boundary for outbound usagetelemetry: while `internal/mock.IsMockEnabled()` reports true,`internal/telemetry` must not send startup or heartbeat pings — the check@@ -2289,7 +2300,7 @@ actor, and every audit row read stay on the install.### Telemetry ingestion matches the released sender while storage stays compatible-The active outbound contract is schema v10. Schema v8 added content-free+The active outbound contract is schema v16. Schema v8 added content-freeapproved-action refusal counters for target change, prerequisite failure, andinvalid typed contract so agent-side pre-mutation failures no longer collapseinto `other`. Schema v9 completes that split with a content-free `uncoded`@@ -2302,6 +2313,12 @@ blocked runtime state, so an install whose Patrol can never run isdistinguishable from one that runs and finds nothing. Blocked-reason text,provider endpoints, model names, and configuration stay on the install, and anuntyped blocked reason exports nothing rather than free text.+Schema v16 adds four workload-history adoption counts. Each closed activity is+deduplicated once per browser session before the authenticated local intake,+stored only as a bounded UTC-day count, and exported only as a rolling 30-day+total. The contract forbids raw browser events, event-level clickstream data,+guest/user identity, routes, selected ranges, cursor coordinates or values,+interaction timing, and browser identity.The earlier draft schema-v8 `business_estate` field was reverted and must notremain in the license server's accepted ping struct merely because a private receiver buildand database migration briefly carried it. Existing deployed databases need nodiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex fdcdb92cbc..4b0dd6cef5 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -955,6 +955,11 @@ recovery scope, or a storage/recovery-owned secret source.1. Add or change recovery-point persistence, rollups, or series derivation through `internal/recovery/`2. Route transport changes for storage and recovery endpoints through `internal/api/` and the owning `api-contracts` proof routes+ The authenticated workload-history usage intake and its bounded daily tally+ are adjacent privacy/API telemetry only. They record four content-free+ aggregate milestones and do not represent workload history data, backup+ history, recovery points, retention policy, restore evidence, or storage+ provider state; storage/recovery surfaces must not consume them as such.Commercial migration startup behavior in`internal/api/licensing_handlers.go` and `internal/api/licensing_bridge.go`remains adjacent cloud-paid/API state. Synthetic mock-license suppressiondiff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.jsonindex a22393359d..33fd060f9f 100644--- a/frontend-modern/browser-verification.json+++ b/frontend-modern/browser-verification.json@@ -1,21 +1,59 @@{"version": 1,- "base_sha": "1e805afc4b54c25ed253497e4818037476cbce23",- "verified_at": "2026-08-30T10:22:47Z",+ "base_sha": "8724f6b9e5e3a6ce3add2727c5befe19eb5c1f99",+ "verified_at": "2026-08-30T12:44:02Z","result": "passed","changed_paths": [- "frontend-modern/src/components/AI/FindingsPanel.tsx",- "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx",- "frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx"+ "frontend-modern/src/api/charts.ts",+ "frontend-modern/src/api/settings.ts",+ "frontend-modern/src/api/workloadHistoryActivity.ts",+ "frontend-modern/src/components/Workloads/GuestRow.tsx",+ "frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx",+ "frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx",+ "frontend-modern/src/components/Workloads/WorkloadPanel.tsx",+ "frontend-modern/src/components/Workloads/WorkloadsFilter.tsx",+ "frontend-modern/src/components/Workloads/WorkloadsSurface.tsx",+ "frontend-modern/src/components/Workloads/WorkloadsTable.tsx",+ "frontend-modern/src/components/Workloads/guestDrawerModel.ts",+ "frontend-modern/src/components/Workloads/guestRowModel.tsx",+ "frontend-modern/src/components/Workloads/useWorkloadTableMetricHistory.ts",+ "frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts",+ "frontend-modern/src/components/Workloads/useWorkloadsState.ts",+ "frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts",+ "frontend-modern/src/components/Workloads/workloadsFilterModel.ts",+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx",+ "frontend-modern/src/hooks/createNonSuspendingQuery.ts",+ "frontend-modern/src/i18n/messages.ts",+ "frontend-modern/src/utils/infrastructureSummaryCache.ts",+ "frontend-modern/src/utils/localStorage.ts",+ "frontend-modern/src/utils/workloadMetricHistoryTarget.ts"],"content_sha256": {- "frontend-modern/src/components/AI/FindingsPanel.tsx": "bddd32ceb519ad2d4deeb464c47e96789b12e512ab127617c6d7f01d3e32bbd8",- "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx": "34540499fb66c378bba88acae22eaf48f0444e6bd0dd5c4c00a05ae93271d48a",- "frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx": "36711b7bc41597a240109c37e50174011c3b3fb5b77aa65179e1bc6cf7165524"+ "frontend-modern/src/api/charts.ts": "fe59a29661bd0a2a37019f4c67ae87180214ff094edf73e293a42a8e59d4e0be",+ "frontend-modern/src/api/settings.ts": "23bd85aeca12c0185de9671b9014cd4daedf598828a1e158d8670d142d1b04c8",+ "frontend-modern/src/api/workloadHistoryActivity.ts": "de262d71f8924752e910fbf4be48641acc8f4fe2bb6ed35687f40b52ffe08d36",+ "frontend-modern/src/components/Workloads/GuestRow.tsx": "26dd654fd05e907f6efb74fff1c7a8367331e7fe670e9dd3ab5ecc29e86128d7",+ "frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx": "415c29b1f9068c222b22710669ae813b95f0cfde5a6506ebe3c01fae3e214882",+ "frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx": "67f8fa8304ffbff0518e4101996049912a040ce2de46f1ba9e5c61b7f67638d6",+ "frontend-modern/src/components/Workloads/WorkloadPanel.tsx": "a43e353c09eef85983405eb7e34ac2f2bfd5cb8e25181cf0bb9c015274d707bc",+ "frontend-modern/src/components/Workloads/WorkloadsFilter.tsx": "9a0cec9744bb0d7b3a3227113a46b40b754d42c357547e2903c3ecf19c8fc2ed",+ "frontend-modern/src/components/Workloads/WorkloadsSurface.tsx": "0d247a614072ad784611dea838051c490848a22fd304ff19e39b5737b547d53f",+ "frontend-modern/src/components/Workloads/WorkloadsTable.tsx": "4a410a7903b1dc1cc3e17ede6425d9ee3e81e050378ba15bba51a8672f6e2b35",+ "frontend-modern/src/components/Workloads/guestDrawerModel.ts": "34abdd17def1f8ebe71700e5a9526f31e212b4a8affb747df3b7dcd597bc0975",+ "frontend-modern/src/components/Workloads/guestRowModel.tsx": "1a8ad94dbd9bf452b1d55c5ad430a2f97911d7d3745217594125c849184665b2",+ "frontend-modern/src/components/Workloads/useWorkloadTableMetricHistory.ts": "1d71636384f35387e11cc9fceb3ebf85f27189d8e3281f0e79448f4c4fb0cae8",+ "frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts": "ad4db49e66a5223707356bd7dc5d106f81fbb88ea5f1fde51b75af3a667a7e67",+ "frontend-modern/src/components/Workloads/useWorkloadsState.ts": "8609603dcecc2ce5f19b8eb9895a1459f7aee8677742d359c184b871366d1b05",+ "frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts": "096a286cd25e846e0824fccc7393a7e4a1ca4f97ea8f4ba7a7deefdbb5c240ec",+ "frontend-modern/src/components/Workloads/workloadsFilterModel.ts": "1756509ad891c7d4836a9a447fe606e2d00b2d81ff5d6ad59f5a90e68618ef76",+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx": "50bdcb1712720c4aa01a1e8ba27360ea03026db7f96b9a8c6b375ffcd824c492",+ "frontend-modern/src/hooks/createNonSuspendingQuery.ts": "7bd85f4258c76756d232df8469708ce06f615cc748b85988dbedb2d829e6e19f",+ "frontend-modern/src/i18n/messages.ts": "02de846b6744586a0e4c892dcac18ba51cd2f8f1acddd7dfbd59d3a38be03b5e",+ "frontend-modern/src/utils/infrastructureSummaryCache.ts": "22bc5b3cee862c6bcf50ff56814668ea58eb6f5be49de4eaf697d2147062009d",+ "frontend-modern/src/utils/localStorage.ts": "9f6c40fd2f9e7848dded912c32f2314ed392bcb141f0e29b8227613318ac0f71",+ "frontend-modern/src/utils/workloadMetricHistoryTarget.ts": "84ac8139861dfb0f0dfcfe429d5c4ad0c2c112949f3f15b0c4199da9dabaed8f"},- "routes": [- "/patrol"- ],+ "routes": ["/proxmox/overview"],"viewports": [{"width": 1440,@@ -27,15 +65,20 @@}],"states": [- "Patrol Inbox selected-decision lifecycle showed the lasting finding outcome explanation and visible Open finding options handoff",- "Patrol Activity explained the finding outcome workflow and rendered a visible Finding options control on each active finding",- "expanded active finding showed Resolve or dismiss with Dismiss: Not an issue, Remember as expected, Dismiss: Later, and Create rule from this",- "desktop and narrow layouts retained readable controls, scrolling, and exact viewport fit without horizontal overflow"+ "Bars mode with compact guest rows at rest and the one-time history hint visible on a fresh browser origin",+ "Populated CPU, memory, and disk history lens for the active guest while the original row density remained stable",+ "Synchronized time cursor across every metric chart in the active row",+ "Details hover preference selected with the richer legacy tooltip and no history lens",+ "Reloaded desktop state after a successful preview with the first-use hint remaining dismissed",+ "Narrow mobile Bars layout with pointer-only history controls and the first-use hint omitted"],"interactions": [- "opened the first mock-backed Patrol Inbox decision and followed Open finding options into Activity",- "opened an active finding's outcome controls by pointer at desktop width and by keyboard Enter at narrow width",- "closed Resolve or dismiss and confirmed the Finding options trigger returned to aria-expanded false",- "inspected the Inbox handoff, Activity rows, expanded finding details, management disclosure, control placement, clipping, and scrolling at 1440 by 900 and 390 by 844"+ "hovered a guest row and verified that only the active row replaced its bars with populated history charts",+ "scrubbed one chart and verified the cursor stayed time-aligned across CPU, memory, and disk",+ "swept the pointer down warmed guest rows and observed immediate chart replacement without stale pending rows",+ "changed the history range and verified the active lens refreshed while hover priority remained responsive",+ "switched between History and Details preferences and verified each mode retained its own hover behavior",+ "reloaded after the successful preview and verified the first-use hint stayed dismissed",+ "inspected the responsive controls at 390x844 and restored the desktop viewport"]}diff --git a/frontend-modern/public/docs/PRIVACY.md b/frontend-modern/public/docs/PRIVACY.mdindex a9fe5efb34..394bf837d3 100644--- a/frontend-modern/public/docs/PRIVACY.md+++ b/frontend-modern/public/docs/PRIVACY.md@@ -16,7 +16,7 @@ third-party analytics, support diagnostics, or ordinary Settings surfaces.Pulse includes outbound usage telemetry that is **enabled by default**. It sends a lightweight ping on startup and once every 24 hours with a rotating pseudonymous install ID to help me understand how many active installations exist, which releases are actually deployed, which features are in use, and whether Patrol control and governed Pulse Intelligence operations are being adopted.-The telemetry payload does not include hostnames, credentials, infrastructure identifiers, IP addresses, URLs, paths, locale, prompts, chat messages, command text, action output, token values, names, email addresses, or account identifiers. Lifecycle and outcome signals are deliberately limited to closed buckets, booleans, and aggregate counts. Local service-health signals are likewise limited to closed buckets, booleans, and normalized release versions. Pulse does not send browser events or an event-level clickstream. The local service-health probe requests only Pulse's own bound listener and never transmits the listener address, request URL, response content, or raw failure text. See the full field list below.+The telemetry payload does not include hostnames, credentials, infrastructure identifiers, IP addresses, URLs, paths, locale, prompts, chat messages, command text, action output, token values, names, email addresses, or account identifiers. Lifecycle and outcome signals are deliberately limited to closed buckets, booleans, and aggregate counts. Local service-health signals are likewise limited to closed buckets, booleans, and normalized release versions. Four browser-derived workload-history milestones are counted locally at most once per browser session and sent only as rolling aggregate counts; Pulse does not send raw browser events or an event-level clickstream. The local service-health probe requests only Pulse's own bound listener and never transmits the listener address, request URL, response content, or raw failure text. See the full field list below.While mock/demo fixture mode is enabled, Pulse suppresses outbound telemetry entirely: a mock-mode instance reports a synthetic fixture fleet rather than a real installation, so it never pings.@@ -37,7 +37,7 @@ Every field is listed below with the reason it exists. Nothing else is included| Field | Example | Purpose ||-------|---------|---------|-| Schema version | `15` | Identify the exact payload contract so old and new signals are not mixed silently |+| Schema version | `16` | Identify the exact payload contract so old and new signals are not mixed silently || Sent at | `2026-07-23T08:30:00Z` | Date the individual heartbeat without sending a history of client activity || Install ID | `a1b2c3d4-...` | Distinguish active installations within one rotation window without tying telemetry to an account or person || Version | `6.0.0-rc.1` | Track the canonical release identity currently deployed |@@ -236,6 +236,10 @@ Every field is listed below with the reason it exists. Nothing else is included| Pulse Intelligence approved action refusals: other 30d | `1` | Count pre-dispatch refusals not covered by the fixed categories without sending raw error or action content || Pulse Intelligence verified finding resolutions 30d | `1` | Count approved Patrol-origin actions whose execution succeeded and whose linked finding postcondition was independently confirmed, without sending finding IDs, action IDs, evidence, resources, or fix details || Pulse Intelligence approved action last failure reason 30d | `plan_drift` | See one fixed machine reason code for the most recent approved-action failure in the current 30-day telemetry window without sending error text, action output, command text, resource IDs, or actors |+| Workload history preview sessions 30d | `18` | Count browser sessions that successfully displayed a populated workload history preview, deduplicated locally once per session without sending a guest, user, route, timing, or browser identifier |+| Workload history scrub sessions 30d | `9` | Count browser sessions that inspected a point on a workload history graph, deduplicated locally once per session without sending coordinates, values, guests, or browser identity |+| Workload history range change sessions 30d | `6` | Count browser sessions that changed the workload history range, deduplicated locally once per session without sending the selected range or browser identity |+| Workload history details selection sessions 30d | `4` | Count browser sessions that chose the legacy Details hover mode, deduplicated locally once per session without sending subsequent interactions or browser identity |Telemetry schema v3 corrects the meaning of `notification_failures_7d`: v2counted every unsuccessful queue attempt, including attempts that later@@ -255,7 +259,7 @@ configuration, destination rejection, and unknown failures. Classification isperformed locally; raw error text and destination/provider identity are neverincluded in the payload.-The current telemetry contract is schema version 15. Schema v15 adds an eighth+Schema v15 adds an eighthfixed notification terminal-failure counter for destination HTTP 5xx servererrors. From v15 onward,new terminal failures enter `notification_failures_rejected_7d` only for HTTP@@ -283,6 +287,14 @@ occurrence exists, leaving no trustworthy fired-alert denominator. Detectedflapping episodes are not reported because their diagnostic event path may bedropped under pressure. Configuration adoption is reported instead.+The current telemetry contract is schema version 16. Schema v16 adds four+workload-history adoption counts. The browser+sends only one closed milestone name to the local Pulse server and deduplicates+each milestone once per browser session. Pulse stores bounded UTC-day counts+locally and includes only their rolling 30-day totals in the existing heartbeat;+there is no browser identifier, raw event stream, guest identity, selected+range, cursor coordinate, value, route, or interaction timing.+#### Server-side handling and retention- Telemetry pings are stored on the Pulse license server only for aggregate install/use analysis.@@ -301,7 +313,7 @@ dropped under pressure. Configuration adoption is reported instead.- No IP addresses are included in the telemetry payload or stored in telemetry rows- No hostnames, node names, VM names, or any infrastructure identifiers-- No URLs, filesystem paths, locale, browser events, or event-level clickstream+- No URLs, filesystem paths, locale, raw browser events, or event-level clickstream- No Proxmox credentials, API tokens, or passwords- No alert content, AI prompts, chat messages, tool names, tool inputs, tool outputs, command text, action output, or token values- No names, email addresses, account identifiers, or other intentionally identifying personal contentdiff --git a/frontend-modern/src/api/__tests__/settings.test.ts b/frontend-modern/src/api/__tests__/settings.test.tsindex 7e5ac3dc4d..fcf24c73db 100644--- a/frontend-modern/src/api/__tests__/settings.test.ts+++ b/frontend-modern/src/api/__tests__/settings.test.ts@@ -84,6 +84,10 @@ const mockTelemetryPreviewPayload = {service_health_previous_healthy: true,node_test_attempts_30d: 0,node_test_failures_30d: 0,+ workload_history_preview_sessions_30d: 0,+ workload_history_scrub_sessions_30d: 0,+ workload_history_range_change_sessions_30d: 0,+ workload_history_details_selection_sessions_30d: 0,alerts_fired_30d: 0,alerts_acknowledged_30d: 0,alerts_resolved_30d: 0,diff --git a/frontend-modern/src/api/__tests__/workloadHistoryActivity.test.ts b/frontend-modern/src/api/__tests__/workloadHistoryActivity.test.tsnew file mode 100644index 0000000000..03ea4ed550--- /dev/null+++ b/frontend-modern/src/api/__tests__/workloadHistoryActivity.test.ts@@ -0,0 +1,40 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { apiFetchJSON } from '@/utils/apiClient';+import {+ recordWorkloadHistoryActivity,+ resetWorkloadHistoryActivityForTest,+} from '../workloadHistoryActivity';++vi.mock('@/utils/apiClient', () => ({ apiFetchJSON: vi.fn() }));++describe('recordWorkloadHistoryActivity', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ window.sessionStorage.clear();+ resetWorkloadHistoryActivityForTest();+ vi.mocked(apiFetchJSON).mockResolvedValue(null);+ });++ it('sends only the closed milestone and deduplicates it for the browser session', () => {+ recordWorkloadHistoryActivity('preview');+ recordWorkloadHistoryActivity('preview');++ expect(apiFetchJSON).toHaveBeenCalledTimes(1);+ expect(apiFetchJSON).toHaveBeenCalledWith('/api/usage/workload-history', {+ method: 'POST',+ body: '{"activity":"preview"}',+ });+ });++ it('allows a later retry when the local intake failed', async () => {+ vi.mocked(apiFetchJSON).mockRejectedValueOnce(new Error('offline')).mockResolvedValueOnce(null);++ recordWorkloadHistoryActivity('scrub');+ await Promise.resolve();+ await Promise.resolve();+ recordWorkloadHistoryActivity('scrub');++ expect(apiFetchJSON).toHaveBeenCalledTimes(2);+ });+});diff --git a/frontend-modern/src/api/charts.ts b/frontend-modern/src/api/charts.tsindex aa7b708b4c..ddcf8df72f 100644--- a/frontend-modern/src/api/charts.ts+++ b/frontend-modern/src/api/charts.ts@@ -172,6 +172,7 @@ export interface MetricsHistoryParams {metric?: string; // Optional: 'cpu', 'memory', 'disk', etc. Omit for all metricsrange?: HistoryTimeRange; // Default: '24h'maxPoints?: number; // Optional cap on returned points (backend may downsample)+ signal?: AbortSignal;}export function toMetricsHistoryAPIResourceType(@@ -413,7 +414,7 @@ export class ChartsAPI {searchParams.set('maxPoints', Math.round(params.maxPoints).toString());}const url = `${this.baseUrl}/metrics-store/history?${searchParams.toString()}`;- return apiFetchJSON(url);+ return params.signal ? apiFetchJSON(url, { signal: params.signal }) : apiFetchJSON(url);}/**diff --git a/frontend-modern/src/api/settings.ts b/frontend-modern/src/api/settings.tsindex 583d1bd395..81ffb4c59d 100644--- a/frontend-modern/src/api/settings.ts+++ b/frontend-modern/src/api/settings.ts@@ -85,6 +85,10 @@ export interface TelemetryPingPreview {service_health_previous_healthy: boolean;node_test_attempts_30d: number;node_test_failures_30d: number;+ workload_history_preview_sessions_30d: number;+ workload_history_scrub_sessions_30d: number;+ workload_history_range_change_sessions_30d: number;+ workload_history_details_selection_sessions_30d: number;alerts_fired_30d: number;alerts_acknowledged_30d: number;alerts_resolved_30d: number;diff --git a/frontend-modern/src/api/workloadHistoryActivity.ts b/frontend-modern/src/api/workloadHistoryActivity.tsnew file mode 100644index 0000000000..5d376c3dde--- /dev/null+++ b/frontend-modern/src/api/workloadHistoryActivity.ts@@ -0,0 +1,60 @@+import { apiFetchJSON } from '@/utils/apiClient';++export type WorkloadHistoryActivity = 'preview' | 'scrub' | 'range_change' | 'details_selected';++const SESSION_KEY_PREFIX = 'pulse:workload-history-activity:v1:';+const recordedThisPage = new Set<WorkloadHistoryActivity>();++const sessionKey = (activity: WorkloadHistoryActivity): string =>+ `${SESSION_KEY_PREFIX}${activity}`;++const wasRecordedThisSession = (activity: WorkloadHistoryActivity): boolean => {+ if (recordedThisPage.has(activity)) return true;+ if (typeof window === 'undefined') return false;+ try {+ return window.sessionStorage.getItem(sessionKey(activity)) === 'true';+ } catch {+ return false;+ }+};++const rememberThisSession = (activity: WorkloadHistoryActivity): void => {+ recordedThisPage.add(activity);+ if (typeof window === 'undefined') return;+ try {+ window.sessionStorage.setItem(sessionKey(activity), 'true');+ } catch {+ // The in-memory guard still prevents a per-interaction request stream.+ }+};++const forgetFailedAttempt = (activity: WorkloadHistoryActivity): void => {+ recordedThisPage.delete(activity);+ if (typeof window === 'undefined') return;+ try {+ window.sessionStorage.removeItem(sessionKey(activity));+ } catch {+ // A later page load may retry if storage is unavailable.+ }+};++/**+ * Records one content-free workload-history milestone at most once per browser+ * session. The server persists only a daily counter for the closed activity+ * enum; no guest, user, route, coordinate, timing, or browser identity is sent.+ */+export const recordWorkloadHistoryActivity = (activity: WorkloadHistoryActivity): void => {+ if (wasRecordedThisSession(activity)) return;+ rememberThisSession(activity);++ void apiFetchJSON('/api/usage/workload-history', {+ method: 'POST',+ body: JSON.stringify({ activity }),+ }).catch(() => {+ forgetFailedAttempt(activity);+ });+};++export const resetWorkloadHistoryActivityForTest = (): void => {+ recordedThisPage.clear();+};diff --git a/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts b/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.tsindex 00dd2ccd9e..428f541f7e 100644--- a/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/useSystemSettingsState.test.ts@@ -82,6 +82,10 @@ const buildTelemetryPreviewPayload = (update_failures_30d: 0,node_test_attempts_30d: 0,node_test_failures_30d: 0,+ workload_history_preview_sessions_30d: 0,+ workload_history_scrub_sessions_30d: 0,+ workload_history_range_change_sessions_30d: 0,+ workload_history_details_selection_sessions_30d: 0,update_last_failure_category: undefined,service_health_observed: true,service_health_healthy: true,diff --git a/frontend-modern/src/components/Workloads/GuestRow.tsx b/frontend-modern/src/components/Workloads/GuestRow.tsxindex 68f821182f..299d9e6875 100644--- a/frontend-modern/src/components/Workloads/GuestRow.tsx+++ b/frontend-modern/src/components/Workloads/GuestRow.tsx@@ -1,4 +1,4 @@-import { createMemo, Show } from 'solid-js';+import { createMemo, createSignal, Show } from 'solid-js';import BoxIcon from 'lucide-solid/icons/box';import type { VM } from '@/types/api';import type { WorkloadGuest } from '@/types/workloads';@@ -15,6 +15,7 @@ import {} from './GuestRowCells';import { StatusDot } from '@/components/shared/StatusDot';+import { recordWorkloadHistoryActivity } from '@/api/workloadHistoryActivity';import { TagBadges } from '@/components/shared/TagBadges';import { WorkloadTypeBadge } from '@/components/shared/WorkloadTypeBadge';import { getWorkloadCPUPercent, resolveWorkloadType } from '@/utils/workloads';@@ -103,6 +104,35 @@ export function GuestRow(props: GuestRowProps) {const cpuPercent = createMemo(() => getWorkloadCPUPercent(props.guest.cpu) ?? 0);const metricDisplayMode = createMemo(() => props.metricDisplayMode ?? 'bars');const isSparklineMode = createMemo(() => metricDisplayMode() === 'sparklines');+ const rowHistoryPreviewEnabled = createMemo(+ () => isSparklineMode() || (props.metricHoverMode ?? 'history') === 'history',+ );+ const [historyCursorRatio, setHistoryCursorRatio] = createSignal<number | null>(null);+ const setTrackedHistoryCursorRatio = (ratio: number | null): void => {+ setHistoryCursorRatio(ratio);+ if (ratio !== null) {+ recordWorkloadHistoryActivity('scrub');+ }+ };+ const [historyLensActive, setHistoryLensActive] = createSignal(false);+ const historyLensHasData = createMemo(() => {+ if (!historyLensActive() || !props.metricHistory) return false;+ if (props.metricHistory.hasGuestHistory) {+ return props.metricHistory.hasGuestHistory(props.guest);+ }+ return (['cpu', 'memory', 'disk', 'netIo', 'diskIo'] as const).some((metric) =>+ props+ .metricHistory!.getGuestMetricSeries(props.guest, metric)+ .some((series) => series.points.length > 0),+ );+ });+ const historyLensVisible = createMemo(+ () =>+ !isSparklineMode() &&+ rowHistoryPreviewEnabled() &&+ historyLensActive() &&+ historyLensHasData(),+ );const usesCompactTableLayout = createMemo(() =>props.workloadTableLayoutMode === 'narrow' ||@@ -168,6 +198,9 @@ export function GuestRow(props: GuestRowProps) {title={title}unit={unit}formatValue={formatValue}+ cursorRatio={historyCursorRatio()}+ onCursorRatioChange={setTrackedHistoryCursorRatio}+ showTooltip={true}/>);@@ -177,19 +210,29 @@ export function GuestRow(props: GuestRowProps) {const vm = props.guest as VM;return getWorkloadGuestDiskStatusMessage(vm.diskStatusReason);};- const interactiveRowHandlers =- props.onClick || props.onHoverChange- ? createSummaryInteractiveRowPreviewHandlers({- onPreview: () => props.onHoverChange?.(guestId()),- onPreviewClear: () => props.onHoverChange?.(null),- })- : {};+ const interactiveRowHandlers = createSummaryInteractiveRowPreviewHandlers({+ onPreview: () => {+ if (!rowHistoryPreviewEnabled()) return;+ setHistoryLensActive(true);+ props.onHoverChange?.(guestId());+ },+ onPreviewClear: () => {+ setHistoryLensActive(false);+ setHistoryCursorRatio(null);+ if (!rowHistoryPreviewEnabled()) return;+ props.onHoverChange?.(null);+ },+ });return (<><trclass={`${rowClass()} workload-row ${props.onClick ? 'cursor-pointer group' : ''}`.trim()}data-guest-id={guestId()}+ data-history-lens-active={historyLensActive() ? 'true' : undefined}+ data-history-lens-pending={+ historyLensActive() && !historyLensVisible() ? 'true' : undefined+ }data-workload-alert-accent={alertAccentTone()}data-summary-series-id={guestId()}data-summary-group-member-active={@@ -372,13 +415,29 @@ export function GuestRow(props: GuestRowProps) {when={isSparklineMode()}fallback={<div class="h-4">- <EnhancedCPUBar- usage={cpuPercent()}- cores={isMobile() ? undefined : props.guest.cpus || undefined}- resourceId={metricsKey()}- anomaly={cpuAnomaly()}- thresholds={cpuThresholds()}- />+ <Show+ when={historyLensVisible()}+ fallback={+ <EnhancedCPUBar+ usage={cpuPercent()}+ cores={isMobile() ? undefined : props.guest.cpus || undefined}+ resourceId={metricsKey()}+ anomaly={cpuAnomaly()}+ thresholds={cpuThresholds()}+ />+ }+ >+ <div class="h-4 animate-in fade-in-0 duration-100 motion-reduce:animate-none">+ {renderMetricSparkline(+ 'cpu',+ formatMetricPercent(cpuPercent()),+ `${props.guest.name} CPU history`,+ '%',+ 'inline',+ formatMetricPercent,+ )}+ </div>+ </Show></div>}>@@ -401,36 +460,68 @@ export function GuestRow(props: GuestRowProps) {<Showwhen={isSparklineMode()}fallback={- <div title={isHostMemoryBasis() ? undefined : (memoryTooltip() ?? undefined)}>- <StackedMemoryBar- used={props.guest.memory?.used || 0}- total={memoryDisplayTotal()}- unavailable={memoryDisplayUnavailable()}- percentOnly={isHostMemoryBasis() ? undefined : memoryPercentOnly()}- cache={isHostMemoryBasis() ? 0 : (props.guest.memory?.cache ?? 0)}- cacheInclusiveLabel={isHostMemoryBasis() ? undefined : 'Shown in Proxmox'}- balloon={isHostMemoryBasis() ? 0 : (props.guest.memory?.balloon ?? 0)}- swapUsed={isHostMemoryBasis() ? 0 : (props.guest.memory?.swapUsed ?? 0)}- swapTotal={isHostMemoryBasis() ? 0 : (props.guest.memory?.swapTotal ?? 0)}- resourceId={metricsKey()}- anomaly={isHostMemoryBasis() ? null : memoryAnomaly()}- thresholds={memoryThresholds()}- severityPercent={- isHostMemoryBasis()- ? usagePercent(- props.guest.memory?.used,- props.guest.memory?.total,- props.guest.memory?.usage,- )- : undefined- }- comparisonTotalLabel={isHostMemoryBasis() ? 'Host total' : undefined}- tooltipTitle={- isHostMemoryBasis()- ? `${props.parentNodeName?.trim() || 'Host'} memory share`- : undefined+ <div class="h-4">+ <Show+ when={historyLensVisible()}+ fallback={+ <div title={isHostMemoryBasis() ? undefined : (memoryTooltip() ?? undefined)}>+ <StackedMemoryBar+ used={props.guest.memory?.used || 0}+ total={memoryDisplayTotal()}+ unavailable={memoryDisplayUnavailable()}+ percentOnly={isHostMemoryBasis() ? undefined : memoryPercentOnly()}+ cache={isHostMemoryBasis() ? 0 : (props.guest.memory?.cache ?? 0)}+ cacheInclusiveLabel={isHostMemoryBasis() ? undefined : 'Shown in Proxmox'}+ balloon={isHostMemoryBasis() ? 0 : (props.guest.memory?.balloon ?? 0)}+ swapUsed={isHostMemoryBasis() ? 0 : (props.guest.memory?.swapUsed ?? 0)}+ swapTotal={isHostMemoryBasis() ? 0 : (props.guest.memory?.swapTotal ?? 0)}+ resourceId={metricsKey()}+ anomaly={isHostMemoryBasis() ? null : memoryAnomaly()}+ thresholds={memoryThresholds()}+ severityPercent={+ isHostMemoryBasis()+ ? usagePercent(+ props.guest.memory?.used,+ props.guest.memory?.total,+ props.guest.memory?.usage,+ )+ : undefined+ }+ comparisonTotalLabel={isHostMemoryBasis() ? 'Host total' : undefined}+ tooltipTitle={+ isHostMemoryBasis()+ ? `${props.parentNodeName?.trim() || 'Host'} memory share`+ : undefined+ }+ />+ </div>}- />+ >+ <div class="h-4 animate-in fade-in-0 duration-100 motion-reduce:animate-none">+ {renderMetricSparkline(+ 'memory',+ memoryDisplayUnavailable()+ ? 'N/A'+ : formatMetricPercent(+ usagePercent(+ props.guest.memory?.used,+ memoryDisplayTotal(),+ isHostMemoryBasis() ? undefined : props.guest.memory?.usage,+ ),+ ),+ isHostMemoryBasis()+ ? `${props.guest.name} host memory share history`+ : `${props.guest.name} memory history`,+ '%',+ 'inline',+ formatMetricPercent,+ {+ memoryDisplayBasis: props.memoryDisplayBasis,+ parentMemoryTotal: props.parentMemoryTotal,+ },+ )}+ </div>+ </Show></div>}>@@ -484,13 +575,31 @@ export function GuestRow(props: GuestRowProps) {</div>}>- <StackedDiskBar- mode={usesCompactTableLayout() ? 'aggregate' : undefined}- disks={props.guest.disks}- aggregateDisk={props.guest.disk}- anomaly={diskAnomaly()}- thresholds={diskThresholds()}- />+ <div class="h-4">+ <Show+ when={historyLensVisible()}+ fallback={+ <StackedDiskBar+ mode={usesCompactTableLayout() ? 'aggregate' : undefined}+ disks={props.guest.disks}+ aggregateDisk={props.guest.disk}+ anomaly={diskAnomaly()}+ thresholds={diskThresholds()}+ />+ }+ >+ <div class="h-4 animate-in fade-in-0 duration-100 motion-reduce:animate-none">+ {renderMetricSparkline(+ 'disk',+ formatMetricPercent(props.guest.disk?.usage),+ `${props.guest.name} disk usage history`,+ '%',+ 'inline',+ formatMetricPercent,+ )}+ </div>+ </Show>+ </div></Show></Show></td>diff --git a/frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx b/frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsxindex 2321aa6ca2..a6faaa2a3b 100644--- a/frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx+++ b/frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx@@ -4,7 +4,7 @@ import BarChartIcon from 'lucide-solid/icons/bar-chart';import { FilterSegmentedControl } from '@/components/shared/FilterToolbar';-import type { WorkloadsMetricDisplayMode } from './workloadsFilterModel';+import type { WorkloadsMetricDisplayMode, WorkloadsMetricHoverMode } from './workloadsFilterModel';import {WORKLOAD_TABLE_HISTORY_RANGE_LABELS,WORKLOAD_TABLE_HISTORY_RANGES,@@ -27,6 +27,33 @@ interface MetricHistoryRangeSegmentedControlProps {label?: JSX.Element;}+interface MetricHoverModeSegmentedControlProps {+ value: WorkloadsMetricHoverMode;+ onChange: (value: WorkloadsMetricHoverMode) => void;+}++export const MetricHoverModeSegmentedControl: Component<MetricHoverModeSegmentedControlProps> = (+ props,+) => (+ <FilterSegmentedControl+ aria-label="Row hover behavior"+ value={props.value}+ onChange={(value) => props.onChange(value as WorkloadsMetricHoverMode)}+ options={[+ {+ value: 'details',+ title: 'Keep current-value bars and show their detailed tooltips',+ label: 'Details',+ },+ {+ value: 'history',+ title: 'Preview synchronized CPU, memory, and disk history across the row',+ label: 'History',+ },+ ]}+ />+);+export const MetricHistoryRangeSegmentedControl: Component<MetricHistoryRangeSegmentedControlProps> = (props) => (@@ -60,7 +87,7 @@ export const MetricDisplayModeSegmentedControl: Component<options={[{value: 'bars',- title: 'Show current values as progress bars',+ title: 'Show current-value bars and preview row history on hover',label: (<><BarChartIcon class="h-3 w-3" />diff --git a/frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx b/frontend-modern/src/components/Workloads/MetricMiniSparkline.tsxindex 09c98ddca8..fedfad0d24 100644--- a/frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx+++ b/frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx@@ -22,6 +22,9 @@ interface MetricMiniSparklineProps {unit?: string;emptyLabel?: string;formatValue?: (value: number) => string;+ cursorRatio?: number | null;+ onCursorRatioChange?: (ratio: number | null) => void;+ showTooltip?: boolean;}type MetricMiniSparklineTooltipState = MetricMiniSparklineHoverState & {@@ -70,6 +73,12 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)const [hoveredState, setHoveredState] = createSignal<MetricMiniSparklineTooltipState | null>(null,);+ const synchronizedState = createMemo(() => {+ const ratio = props.cursorRatio;+ if (ratio === null || ratio === undefined) return null;+ return computeMetricMiniSparklineHoverState(props.series, ratio, 1);+ });+ const activeHoverState = createMemo(() => synchronizedState() ?? hoveredState());const rootColumns = createMemo(() =>showInlineValue() ? 'grid-cols-[minmax(2.5rem,1fr)_auto]' : 'grid-cols-[minmax(2.5rem,1fr)]',);@@ -81,13 +90,14 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)const formatHoverValue = (value: number) =>props.formatValue?.(value) ?? formatDefaultHoverValue(value, props.unit);const cursorX = createMemo(() =>- hoveredState()- ? SPARKLINE_PLOT_X_PADDING + hoveredState()!.cursorRatio * SPARKLINE_PLOT_WIDTH+ activeHoverState()+ ? SPARKLINE_PLOT_X_PADDING + activeHoverState()!.cursorRatio * SPARKLINE_PLOT_WIDTH: 0,);const handleMouseMove: JSX.EventHandler<SVGSVGElement, MouseEvent> = (event) => {if (!hasLine()) {setHoveredState(null);+ props.onCursorRatioChange?.(null);return;}@@ -106,8 +116,13 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)}: null,);+ props.onCursorRatioChange?.(next?.cursorRatio ?? null);+ };+ const handleMouseLeave = () => {+ setHoveredState(null);+ props.onCursorRatioChange?.(null);};- const handleMouseLeave = () => setHoveredState(null);+ const showTooltip = createMemo(() => (props.showTooltip ?? true) && hoveredState());return (<div@@ -141,14 +156,15 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)/>)}</For>- <Show when={hoveredState()}>+ <Show when={activeHoverState()}><line+ data-metric-history-cursor="true"x1={cursorX()}y1="2"x2={cursorX()}y2="16"stroke="currentColor"- stroke-opacity="0.36"+ stroke-opacity="0.46"stroke-width="1"vector-effect="non-scaling-stroke"/>@@ -160,7 +176,7 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props){displayLabel()}</span></Show>- <Show when={hoveredState()}>+ <Show when={showTooltip()}>{(hover) => (<TooltipPortalwhen={true}diff --git a/frontend-modern/src/components/Workloads/WorkloadPanel.tsx b/frontend-modern/src/components/Workloads/WorkloadPanel.tsxindex c7081b2cc4..9042e6be52 100644--- a/frontend-modern/src/components/Workloads/WorkloadPanel.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadPanel.tsx@@ -73,6 +73,7 @@ type WorkloadPanelProps = Pick<| 'windowedGroupedGuests'| 'workloadIOEmphasis'| 'workloadMetricDisplayMode'+ | 'workloadMetricHoverMode'| 'workloadMemoryDisplayBasis'| 'workloadMetricHistory'| 'workloadTableLayoutMode'@@ -600,6 +601,7 @@ export function WorkloadPanel(props: WorkloadPanelProps) {})}ioEmphasis={props.workloadIOEmphasis()}metricDisplayMode={props.workloadMetricDisplayMode()}+ metricHoverMode={props.workloadMetricHoverMode()}memoryDisplayBasis={props.workloadMemoryDisplayBasis()}metricHistory={props.workloadMetricHistory}nestedWorkloadContext={nestedWorkloadContext()}diff --git a/frontend-modern/src/components/Workloads/WorkloadsFilter.tsx b/frontend-modern/src/components/Workloads/WorkloadsFilter.tsxindex da252bf1d1..000086fb70 100644--- a/frontend-modern/src/components/Workloads/WorkloadsFilter.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadsFilter.tsx@@ -32,6 +32,7 @@ import type { ViewMode } from '@/types/workloads';import {MetricDisplayModeSegmentedControl,MetricHistoryRangeSegmentedControl,+ MetricHoverModeSegmentedControl,} from './MetricDisplayModeSegmentedControl';import type {WorkloadsFilterProps,@@ -346,6 +347,25 @@ export const WorkloadsFilter: Component<WorkloadsFilterProps> = (props) => {</div></Show>+ <Show+ when={+ !isMobile() &&+ props.metricDisplayMode?.() === 'bars' &&+ props.metricHoverMode &&+ props.setMetricHoverMode+ }+ >+ <div>+ <div class="mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted">+ Row hover+ </div>+ <MetricHoverModeSegmentedControl+ value={props.metricHoverMode!()}+ onChange={props.setMetricHoverMode!}+ />+ </div>+ </Show>+<Show when={props.memoryDisplayBasis && props.setMemoryDisplayBasis}><div><div class="mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted">@@ -429,16 +449,27 @@ export const WorkloadsFilter: Component<WorkloadsFilterProps> = (props) => {trailingControls={<Showwhen={- props.metricDisplayMode?.() === 'sparklines' &&props.metricHistoryRange &&- props.setMetricHistoryRange+ props.setMetricHistoryRange &&+ (props.metricDisplayMode?.() !== 'bars' ||+ (!isMobile() && (props.metricHoverMode?.() ?? 'history') === 'history'))}>- <MetricHistoryRangeSegmentedControl- label="Trend range"- range={props.metricHistoryRange!()}- onRangeChange={props.setMetricHistoryRange!}- />+ <div class="flex items-center gap-2">+ <Show when={props.metricHistoryHintVisible?.()}>+ <span+ class="hidden whitespace-nowrap text-[11px] text-muted/80 lg:inline"+ data-testid="workload-history-hover-hint"+ >+ Hover a guest to preview history+ </span>+ </Show>+ <MetricHistoryRangeSegmentedControl+ label="History"+ range={props.metricHistoryRange!()}+ onRangeChange={props.setMetricHistoryRange!}+ />+ </div></Show>}onClearAll={handleClearAll}diff --git a/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx b/frontend-modern/src/components/Workloads/WorkloadsSurface.tsxindex 5da3483d51..0439776f95 100644--- a/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadsSurface.tsx@@ -162,8 +162,11 @@ export function WorkloadsSurface(props: WorkloadsSurfaceComponentProps) {suppressTypeFilter={props.forcedViewMode !== undefined}metricDisplayMode={state.workloadMetricDisplayMode}setMetricDisplayMode={state.setWorkloadMetricDisplayMode}+ metricHoverMode={state.workloadMetricHoverMode}+ setMetricHoverMode={state.setWorkloadMetricHoverMode}metricHistoryRange={state.workloadMetricHistoryRange}setMetricHistoryRange={state.setWorkloadMetricHistoryRange}+ metricHistoryHintVisible={state.workloadMetricHistoryHintVisible}memoryDisplayBasis={props.memoryDisplayBasis ? state.workloadMemoryDisplayBasis : undefined}@@ -226,6 +229,7 @@ export function WorkloadsSurface(props: WorkloadsSurfaceComponentProps) {windowedGroupedGuests={state.windowedGroupedGuests}workloadIOEmphasis={state.workloadIOEmphasis}workloadMetricDisplayMode={state.workloadMetricDisplayMode}+ workloadMetricHoverMode={state.workloadMetricHoverMode}workloadMemoryDisplayBasis={state.workloadMemoryDisplayBasis}workloadMetricHistory={state.workloadMetricHistory}workloadTableLayoutMode={state.workloadTableLayoutMode}diff --git a/frontend-modern/src/components/Workloads/WorkloadsTable.tsx b/frontend-modern/src/components/Workloads/WorkloadsTable.tsxindex f08917eded..42634d259a 100644--- a/frontend-modern/src/components/Workloads/WorkloadsTable.tsx+++ b/frontend-modern/src/components/Workloads/WorkloadsTable.tsx@@ -56,6 +56,7 @@ type WorkloadsTableProps = Pick<| 'windowedGroupedGuests'| 'workloadIOEmphasis'| 'workloadMetricDisplayMode'+ | 'workloadMetricHoverMode'| 'workloadMemoryDisplayBasis'| 'workloadMetricHistory'| 'workloadTableLayoutMode'@@ -164,6 +165,7 @@ export function WorkloadsTable(props: WorkloadsTableProps) {windowedGroupedGuests={props.windowedGroupedGuests}workloadIOEmphasis={props.workloadIOEmphasis}workloadMetricDisplayMode={props.workloadMetricDisplayMode}+ workloadMetricHoverMode={props.workloadMetricHoverMode}workloadMemoryDisplayBasis={props.workloadMemoryDisplayBasis}workloadMetricHistory={props.workloadMetricHistory}workloadTableLayoutMode={props.workloadTableLayoutMode}diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsxindex dfbed0a89e..6e72824233 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx@@ -1,5 +1,6 @@import { describe, it, expect, vi, afterEach } from 'vitest';import { render, screen, fireEvent, cleanup } from '@solidjs/testing-library';+import { createSignal } from 'solid-js';import type { WorkloadGuest } from '@/types/workloads';import type { Memory, Disk } from '@/types/api';@@ -424,6 +425,118 @@ describe('GuestRow', () => {expect(screen.queryByTestId('disk-bar')).toBeNull();});+ it('keeps bars at rest and synchronizes the row history lens cursor', () => {+ renderGuestRow({+ guest: makeGuest({ name: 'layered-vm' }),+ visibleColumnIds: ['name', 'cpu', 'memory', 'disk'],+ metricDisplayMode: 'bars',+ metricHistory: {+ getGuestMetricSeries: (_guest, metric) => [+ {+ id: metric,+ label: metric,+ color: '#8b5cf6',+ points: [+ { timestamp: 1, value: 10 },+ { timestamp: 2, value: 25 },+ ],+ },+ ],+ getNodeMetricSeries: () => [],+ },+ });++ expect(screen.getByTestId('cpu-bar')).toBeInTheDocument();+ expect(screen.getByTestId('memory-bar')).toBeInTheDocument();+ expect(screen.getByTestId('disk-bar')).toBeInTheDocument();+ expect(screen.queryByTestId('metric-mini-sparkline')).not.toBeInTheDocument();++ const row = screen.getByText('layered-vm').closest('tr')!;+ fireEvent.pointerEnter(row, { pointerType: 'mouse' });++ expect(row).toHaveAttribute('data-history-lens-active', 'true');+ expect(screen.queryByTestId('cpu-bar')).not.toBeInTheDocument();+ expect(screen.queryByTestId('memory-bar')).not.toBeInTheDocument();+ expect(screen.queryByTestId('disk-bar')).not.toBeInTheDocument();++ const lensCharts = screen.getAllByTestId('metric-mini-sparkline');+ expect(lensCharts).toHaveLength(3);+ expect(lensCharts[0].parentElement).toHaveClass('motion-reduce:animate-none');++ const firstSvg = lensCharts[0].querySelector('svg') as SVGSVGElement;+ firstSvg.getBoundingClientRect = () =>+ ({+ bottom: 18,+ height: 18,+ left: 0,+ right: 96,+ top: 0,+ width: 96,+ x: 0,+ y: 0,+ toJSON: () => ({}),+ }) as DOMRect;++ fireEvent.mouseMove(firstSvg, { clientX: 48, clientY: 8 });+ expect(lensCharts.every((chart) => chart.querySelector('[data-metric-history-cursor]'))).toBe(+ true,+ );++ fireEvent.mouseLeave(firstSvg);+ expect(+ lensCharts.every((chart) => chart.querySelector('[data-metric-history-cursor]') === null),+ ).toBe(true);++ fireEvent.pointerLeave(row, { pointerType: 'mouse' });+ expect(row).not.toHaveAttribute('data-history-lens-active');+ expect(screen.getByTestId('cpu-bar')).toBeInTheDocument();+ expect(screen.getByTestId('memory-bar')).toBeInTheDocument();+ expect(screen.getByTestId('disk-bar')).toBeInTheDocument();+ expect(screen.queryByTestId('metric-mini-sparkline')).not.toBeInTheDocument();+ });++ it('keeps the live bars visible until warmed history is ready', () => {+ const [historyReady, setHistoryReady] = createSignal(false);+ renderGuestRow({+ guest: makeGuest({ name: 'warming-vm' }),+ visibleColumnIds: ['name', 'cpu', 'memory', 'disk'],+ metricDisplayMode: 'bars',+ metricHistory: {+ hasGuestHistory: historyReady,+ getGuestMetricSeries: (_guest, metric) => [+ {+ id: metric,+ label: metric,+ color: '#8b5cf6',+ points: [+ { timestamp: 1, value: 10 },+ { timestamp: 2, value: 25 },+ ],+ },+ ],+ getNodeMetricSeries: () => [],+ },+ });++ const row = screen.getByText('warming-vm').closest('tr')!;+ fireEvent.pointerEnter(row, { pointerType: 'mouse' });++ expect(row).toHaveAttribute('data-history-lens-active', 'true');+ expect(row).toHaveAttribute('data-history-lens-pending', 'true');+ expect(screen.getByTestId('cpu-bar')).toBeInTheDocument();+ expect(screen.getByTestId('memory-bar')).toBeInTheDocument();+ expect(screen.getByTestId('disk-bar')).toBeInTheDocument();+ expect(screen.queryByTestId('metric-mini-sparkline')).not.toBeInTheDocument();++ setHistoryReady(true);++ expect(row).not.toHaveAttribute('data-history-lens-pending');+ expect(screen.getAllByTestId('metric-mini-sparkline')).toHaveLength(3);+ expect(screen.queryByTestId('cpu-bar')).not.toBeInTheDocument();+ expect(screen.queryByTestId('memory-bar')).not.toBeInTheDocument();+ expect(screen.queryByTestId('disk-bar')).not.toBeInTheDocument();+ });+it('keeps Net I/O and Disk I/O live labels out of sparkline table cells', () => {renderGuestRow({guest: makeGuest({ name: 'spark-io-vm', networkIn: 1024, networkOut: 2048 }),@@ -709,6 +822,50 @@ describe('GuestRow', () => {expect(onHoverChange).toHaveBeenCalledWith(null);});+ it('activates and clears the history lens through keyboard focus', () => {+ const { container } = renderGuestRow({+ guest: makeGuest(),+ });+ const tr = container.querySelector('tr')!;++ fireEvent.focusIn(tr);+ expect(tr).toHaveAttribute('data-history-lens-active', 'true');++ fireEvent.focusOut(tr, { relatedTarget: document.body });+ expect(tr).not.toHaveAttribute('data-history-lens-active');+ });++ it('does not activate the history lens for touch pointer entry', () => {+ const { container } = renderGuestRow({+ guest: makeGuest(),+ });+ const tr = container.querySelector('tr')!;++ const touchPointerEnter = new MouseEvent('pointerover', { bubbles: true });+ Object.defineProperty(touchPointerEnter, 'pointerType', { value: 'touch' });+ fireEvent(tr, touchPointerEnter);+ expect(tr).not.toHaveAttribute('data-history-lens-active');+ });++ it('keeps the original bars and hover callbacks inactive in details mode', () => {+ const onHoverChange = vi.fn();+ const { container } = renderGuestRow({+ guest: makeGuest(),+ metricHoverMode: 'details',+ onHoverChange,+ });+ const tr = container.querySelector('tr')!;++ fireEvent.pointerEnter(tr, { pointerType: 'mouse' });++ expect(tr).not.toHaveAttribute('data-history-lens-active');+ expect(screen.getByTestId('cpu-bar')).toBeInTheDocument();+ expect(screen.getByTestId('memory-bar')).toBeInTheDocument();+ expect(screen.getByTestId('disk-bar')).toBeInTheDocument();+ expect(screen.queryByTestId('metric-mini-sparkline')).not.toBeInTheDocument();+ expect(onHoverChange).not.toHaveBeenCalled();+ });+it('toggles the row from the shared disclosure button keyboard path', () => {const onClick = vi.fn();const onHoverChange = vi.fn();diff --git a/frontend-modern/src/components/Workloads/__tests__/MetricDisplayModeSegmentedControl.test.tsx b/frontend-modern/src/components/Workloads/__tests__/MetricDisplayModeSegmentedControl.test.tsxindex 27fcfe03fa..020ee557bc 100644--- a/frontend-modern/src/components/Workloads/__tests__/MetricDisplayModeSegmentedControl.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/MetricDisplayModeSegmentedControl.test.tsx@@ -1,13 +1,31 @@import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';import { afterEach, describe, expect, it, vi } from 'vitest';-import { MetricDisplayModeSegmentedControl } from '../MetricDisplayModeSegmentedControl';+import {+ MetricDisplayModeSegmentedControl,+ MetricHoverModeSegmentedControl,+} from '../MetricDisplayModeSegmentedControl';afterEach(() => {cleanup();vi.clearAllMocks();});+describe('MetricHoverModeSegmentedControl', () => {+ it('switches between detailed bar tooltips and synchronized row history', async () => {+ const onChange = vi.fn();+ render(() => <MetricHoverModeSegmentedControl value="history" onChange={onChange} />);++ const group = screen.getByRole('group', { name: 'Row hover behavior' });+ expect(screen.getByRole('button', { name: 'History' })).toHaveAttribute('aria-pressed', 'true');++ await fireEvent.click(screen.getByRole('button', { name: 'Details' }));++ expect(onChange).toHaveBeenCalledWith('details');+ expect(group).toBeInTheDocument();+ });+});+describe('MetricDisplayModeSegmentedControl', () => {it('keeps the table history range hidden while current-value bars are selected', () => {render(() => (diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsFilter.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsFilter.test.tsxindex d4f1c0f3ba..a17d016c95 100644--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsFilter.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsFilter.test.tsx@@ -268,24 +268,87 @@ describe('WorkloadsFilter', () => {expect(setMemoryDisplayBasis).toHaveBeenCalledWith('host');});- it('keeps metric presentation in View and hides the range for bars', () => {+ it('keeps layered metric presentation in View while history range stays directly available', () => {render(() => (<WorkloadsFilter{...makeProps({metricDisplayMode: () => 'bars',setMetricDisplayMode: vi.fn(),+ metricHoverMode: () => 'history',+ setMetricHoverMode: vi.fn(),metricHistoryRange: () => '1h',setMetricHistoryRange: vi.fn(),})}/>));+ expect(screen.getByRole('group', { name: 'Sparkline range' })).toBeInTheDocument();+ expect(screen.getByText('History')).toBeInTheDocument();expect(screen.queryByRole('button', { name: 'Bars' })).not.toBeInTheDocument();- expect(screen.queryByRole('group', { name: 'Sparkline range' })).not.toBeInTheDocument();expect(within(openViewPreferences()).getByRole('button', { name: 'Bars' })).toHaveAttribute('aria-pressed','true',);+ expect(screen.getByText('Row hover')).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'History' })).toHaveAttribute(+ 'aria-pressed',+ 'true',+ );+ });++ it('shows the one-time history discovery hint only when requested', () => {+ const { unmount } = render(() => (+ <WorkloadsFilter+ {...makeProps({+ metricDisplayMode: () => 'bars',+ setMetricDisplayMode: vi.fn(),+ metricHoverMode: () => 'history',+ setMetricHoverMode: vi.fn(),+ metricHistoryRange: () => '1h',+ setMetricHistoryRange: vi.fn(),+ metricHistoryHintVisible: () => true,+ })}+ />+ ));++ expect(screen.getByTestId('workload-history-hover-hint')).toHaveTextContent(+ 'Hover a guest to preview history',+ );+ unmount();++ render(() => (+ <WorkloadsFilter+ {...makeProps({+ metricDisplayMode: () => 'bars',+ metricHoverMode: () => 'history',+ metricHistoryRange: () => '1h',+ setMetricHistoryRange: vi.fn(),+ metricHistoryHintVisible: () => false,+ })}+ />+ ));+ expect(screen.queryByTestId('workload-history-hover-hint')).not.toBeInTheDocument();+ });++ it('restores detailed bar hover and hides the inactive history range', () => {+ const setMetricHoverMode = vi.fn();+ render(() => (+ <WorkloadsFilter+ {...makeProps({+ metricDisplayMode: () => 'bars',+ setMetricDisplayMode: vi.fn(),+ metricHoverMode: () => 'details',+ setMetricHoverMode,+ metricHistoryRange: () => '1h',+ setMetricHistoryRange: vi.fn(),+ })}+ />+ ));++ expect(screen.queryByRole('group', { name: 'Sparkline range' })).not.toBeInTheDocument();+ const preferences = openViewPreferences();+ fireEvent.click(within(preferences).getByRole('button', { name: 'History' }));+ expect(setMetricHoverMode).toHaveBeenCalledWith('history');});it('keeps the frequently changed range inline while Trends is active', () => {@@ -301,12 +364,34 @@ describe('WorkloadsFilter', () => {));expect(screen.getByRole('group', { name: 'Sparkline range' })).toBeInTheDocument();- expect(screen.getByText('Trend range')).toBeInTheDocument();+ expect(screen.getByText('History')).toBeInTheDocument();expect(screen.queryByRole('button', { name: 'Trends' })).not.toBeInTheDocument();expect(within(openViewPreferences()).getByRole('button', { name: 'Trends' })).toHaveAttribute('aria-pressed','true',);+ expect(screen.queryByText('Row hover')).not.toBeInTheDocument();+ });++ it('omits pointer-only history controls from Bars on mobile', () => {+ isMobileMock.mockReturnValue(true);+ render(() => (+ <WorkloadsFilter+ {...makeProps({+ metricDisplayMode: () => 'bars',+ setMetricDisplayMode: vi.fn(),+ metricHoverMode: () => 'history',+ setMetricHoverMode: vi.fn(),+ metricHistoryRange: () => '1h',+ setMetricHistoryRange: vi.fn(),+ })}+ />+ ));++ expect(screen.queryByRole('group', { name: 'Sparkline range' })).not.toBeInTheDocument();+ fireEvent.click(screen.getByRole('button', { name: 'Filters' }));+ openViewPreferences();+ expect(screen.queryByText('Row hover')).not.toBeInTheDocument();});it('does not reserve an empty leading-action slot in the default mobile filter rail', () => {diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsxindex d07bf9b436..defc9b2b54 100644--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx@@ -191,6 +191,13 @@ vi.mock('@/hooks/useUnifiedResources', () => ({},}));+vi.mock('../useWorkloadTableMetricHistory', () => ({+ useWorkloadTableMetricHistory: () => ({+ getGuestMetricSeries: () => [],+ getNodeMetricSeries: () => [],+ }),+}));+vi.mock('@/api/connections', () => ({ConnectionsAPI: {list: connectionsApiMocks.list,@@ -1388,10 +1395,12 @@ describe('Workloads performance contract', () => {'workloadMemoryDisplayBasis={props.workloadMemoryDisplayBasis}',);expect(workloadsFilterSource).toContain('MetricDisplayModeSegmentedControl');+ expect(workloadsFilterSource).toContain('MetricHoverModeSegmentedControl');+ expect(workloadsFilterSource).toContain('Row hover');expect(workloadsFilterSource).toContain('viewOptions={');expect(workloadsFilterSource).not.toContain('ViewOptionsMenu');expect(workloadsFilterSource).toContain('MetricHistoryRangeSegmentedControl');- expect(workloadsFilterSource).toContain('label="Trend range"');+ expect(workloadsFilterSource).toContain('label="History"');expect(workloadsFilterSource).toContain('<ColumnPicker');expect(workloadsFilterSource).toContain('inline');expect(workloadsFilterSource).toContain('showAddFilterLabel={false}');@@ -1401,6 +1410,7 @@ describe('Workloads performance contract', () => {'WORKLOAD_TABLE_HISTORY_RANGES.map',);expect(metricDisplayModeSegmentedControlSource).toContain('aria-label="Sparkline range"');+ expect(metricDisplayModeSegmentedControlSource).toContain('aria-label="Row hover behavior"');expect(metricDisplayModeSegmentedControlSource).toContain('justify-start');expect(workloadTableHeaderSource).toContain('getWorkloadColumnHeaderLabel');expect(workloadTableHeaderSource).toContain('`${defaultLabel} · Host`');@@ -1427,6 +1437,18 @@ describe('Workloads performance contract', () => {expect(workloadTableMetricHistoryStateSource).toContain('fetchInfrastructureSummaryAndCache(parsed.range',);+ expect(+ workloadTableMetricHistoryStateSource.match(/retainPreviousValueOnSourceChange: false/g),+ ).toHaveLength(2);+ expect(workloadTableMetricHistoryStateSource).toContain('ChartsAPI.getMetricsHistory');+ expect(workloadTableMetricHistoryStateSource).toContain('options.activeGuest?.()');+ expect(workloadTableMetricHistoryStateSource).toContain('options.onDemand?.()');+ expect(workloadTableMetricHistoryStateSource).toContain('ROW_HISTORY_PREFETCH_CONCURRENCY');+ expect(workloadTableMetricHistoryStateSource).toContain('ROW_HISTORY_CACHE_MAX_ENTRIES');+ expect(workloadTableMetricHistoryStateSource).toContain('pendingRowHistory.unshift');+ expect(workloadTableMetricHistoryStateSource).toContain(+ 'maxPoints: WORKLOAD_TABLE_HISTORY_MAX_POINTS',+ );expect(workloadsStateSource).toContain('filterWorkloads(params)');expect(workloadsStateSource).not.toContain('const containerRuntimeFilterConfig = createMemo');expect(workloadsStateSource).not.toContain('useGroupedTableWindowing');diff --git a/frontend-modern/src/components/Workloads/__tests__/useWorkloadTableMetricHistory.test.tsx b/frontend-modern/src/components/Workloads/__tests__/useWorkloadTableMetricHistory.test.tsxnew file mode 100644index 0000000000..9acd3d5d4c--- /dev/null+++ b/frontend-modern/src/components/Workloads/__tests__/useWorkloadTableMetricHistory.test.tsx@@ -0,0 +1,209 @@+import { afterEach, describe, expect, it, vi } from 'vitest';+import { cleanup, render, screen, waitFor } from '@solidjs/testing-library';+import { createSignal, type Accessor } from 'solid-js';++import { ChartsAPI, type AllMetricsHistoryResponse } from '@/api/charts';+import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';+import type { WorkloadGuest } from '@/types/workloads';++import { useWorkloadTableMetricHistory } from '../useWorkloadTableMetricHistory';+import type { WorkloadTableMetricHistoryRange } from '../workloadMetricHistoryModel';++const guest = {+ id: 'cluster-a:pve1:101',+ name: 'api-101',+ type: 'qemu',+ workloadType: 'vm',+ metricsTarget: {+ resourceType: 'vm',+ resourceId: 'metrics-vm-101',+ },+} as WorkloadGuest;++const historyResponse = (+ range: WorkloadTableMetricHistoryRange,+ value: number,+): AllMetricsHistoryResponse => ({+ resourceType: 'vm',+ resourceId: 'metrics-vm-101',+ range,+ start: 1,+ end: 2,+ metrics: {+ cpu: [{ timestamp: 2, value, min: value, max: value }],+ },+ source: 'store',+});++function HistoryProbe(props: {+ activeGuest: Accessor<WorkloadGuest | null>;+ prefetchGuests?: Accessor<readonly WorkloadGuest[]>;+ range: Accessor<WorkloadTableMetricHistoryRange>;+}) {+ const reader = useWorkloadTableMetricHistory({+ activeGuest: props.activeGuest,+ enabled: () => false,+ onDemand: () => true,+ prefetchGuests: props.prefetchGuests,+ range: props.range,+ selectedNode: () => null,+ });++ const activeHistoryValue = () => {+ const active = props.activeGuest();+ return active ? (reader.getGuestMetricSeries(active, 'cpu')[0]?.points[0]?.value ?? '') : '';+ };++ return <div data-testid="active-history-value">{activeHistoryValue()}</div>;+}++afterEach(() => {+ cleanup();+ resetCreateNonSuspendingQueryCacheForTest();+ vi.restoreAllMocks();+});++describe('useWorkloadTableMetricHistory', () => {+ it('bounds slow-estate warming and prioritizes a distant active guest', async () => {+ const guests = Array.from({ length: 500 }, (_, index) => ({+ ...guest,+ id: `cluster-a:pve1:${index}`,+ name: `guest-${index}`,+ metricsTarget: {+ resourceType: 'vm',+ resourceId: `metrics-vm-${index}`,+ },+ })) as WorkloadGuest[];+ const [activeGuest, setActiveGuest] = createSignal<WorkloadGuest | null>(null);+ const [range] = createSignal<WorkloadTableMetricHistoryRange>('1h');+ const calls: string[] = [];+ const resolvers = new Map<string, () => void>();+ let inFlight = 0;+ let maxInFlight = 0;++ vi.spyOn(ChartsAPI, 'getMetricsHistory').mockImplementation((params) => {+ calls.push(params.resourceId);+ inFlight += 1;+ maxInFlight = Math.max(maxInFlight, inFlight);+ return new Promise<AllMetricsHistoryResponse>((resolve) => {+ resolvers.set(params.resourceId, () => {+ inFlight -= 1;+ resolve({+ ...historyResponse('1h', 10),+ resourceId: params.resourceId,+ });+ });+ });+ });++ render(() => (+ <HistoryProbe activeGuest={activeGuest} prefetchGuests={() => guests} range={range} />+ ));++ await waitFor(() => expect(calls).toHaveLength(4));+ expect(calls).toEqual(['metrics-vm-0', 'metrics-vm-1', 'metrics-vm-2', 'metrics-vm-3']);+ expect(maxInFlight).toBe(4);++ setActiveGuest(guests[400]);+ await Promise.resolve();+ expect(calls).toHaveLength(4);++ resolvers.get('metrics-vm-0')?.();+ await waitFor(() => expect(calls).toHaveLength(5));+ expect(calls[4]).toBe('metrics-vm-400');+ expect(maxInFlight).toBe(4);+ });++ it('warms visible guest history before the pointer reaches the row', async () => {+ const secondGuest = {+ ...guest,+ id: 'cluster-a:pve1:102',+ name: 'api-102',+ metricsTarget: {+ resourceType: 'vm',+ resourceId: 'metrics-vm-102',+ },+ } as WorkloadGuest;+ const [activeGuest, setActiveGuest] = createSignal<WorkloadGuest | null>(null);+ const [range] = createSignal<WorkloadTableMetricHistoryRange>('1h');+ const historySpy = vi.spyOn(ChartsAPI, 'getMetricsHistory').mockImplementation((params) =>+ Promise.resolve({+ ...historyResponse('1h', params.resourceId === 'metrics-vm-102' ? 20 : 10),+ resourceId: params.resourceId,+ }),+ );++ render(() => (+ <HistoryProbe+ activeGuest={activeGuest}+ prefetchGuests={() => [guest, secondGuest]}+ range={range}+ />+ ));++ await waitFor(() => {+ expect(historySpy).toHaveBeenCalledTimes(2);+ });+ setActiveGuest(secondGuest);++ await waitFor(() => {+ expect(screen.getByTestId('active-history-value')).toHaveTextContent('20');+ });+ expect(historySpy).toHaveBeenCalledTimes(2);+ });++ it('loads only the active row and clears the old range while its replacement is pending', async () => {+ const [activeGuest, setActiveGuest] = createSignal<WorkloadGuest | null>(null);+ const [range, setRange] = createSignal<WorkloadTableMetricHistoryRange>('1h');+ let resolve12h!: (value: AllMetricsHistoryResponse) => void;+ const pending12h = new Promise<AllMetricsHistoryResponse>((resolve) => {+ resolve12h = resolve;+ });+ const historySpy = vi+ .spyOn(ChartsAPI, 'getMetricsHistory')+ .mockImplementation((params) =>+ params.range === '12h' ? pending12h : Promise.resolve(historyResponse('1h', 10)),+ );++ render(() => <HistoryProbe activeGuest={activeGuest} range={range} />);++ expect(historySpy).not.toHaveBeenCalled();+ setActiveGuest(guest);++ await waitFor(() => {+ expect(historySpy).toHaveBeenCalledWith(+ expect.objectContaining({+ resourceType: 'vm',+ resourceId: 'metrics-vm-101',+ range: '1h',+ maxPoints: 36,+ signal: expect.any(AbortSignal),+ }),+ );+ expect(screen.getByTestId('active-history-value')).toHaveTextContent('10');+ });++ setActiveGuest({ ...guest });+ await Promise.resolve();+ expect(historySpy).toHaveBeenCalledTimes(1);++ setRange('12h');+ await waitFor(() => {+ expect(historySpy).toHaveBeenCalledWith(+ expect.objectContaining({+ resourceType: 'vm',+ resourceId: 'metrics-vm-101',+ range: '12h',+ maxPoints: 36,+ signal: expect.any(AbortSignal),+ }),+ );+ });+ expect(screen.getByTestId('active-history-value').textContent).toBe('');++ resolve12h(historyResponse('12h', 20));+ await waitFor(() => {+ expect(screen.getByTestId('active-history-value')).toHaveTextContent('20');+ });+ });+});diff --git a/frontend-modern/src/components/Workloads/__tests__/useWorkloadsControlsState.test.ts b/frontend-modern/src/components/Workloads/__tests__/useWorkloadsControlsState.test.tsindex d1ab80b088..79737aa220 100644--- a/frontend-modern/src/components/Workloads/__tests__/useWorkloadsControlsState.test.ts+++ b/frontend-modern/src/components/Workloads/__tests__/useWorkloadsControlsState.test.ts@@ -46,6 +46,31 @@ describe('useWorkloadsControlsState', () => {setWideViewport();});+ it('defaults row hover to history and persists a details preference', async () => {+ const dispose = createRoot((dispose) => {+ const [showFilters, setShowFilters] = createSignal(false);+ const state = useWorkloadsControlsState({+ viewMode: () => 'all' as ViewMode,+ showFilters,+ setShowFilters,+ });++ expect(state.workloadMetricHoverMode()).toBe('history');++ state.setWorkloadMetricHoverMode('details');++ expect(state.workloadMetricHoverMode()).toBe('details');+ return dispose;+ });++ try {+ await Promise.resolve();+ expect(localStorage.getItem('workloadsMetricHoverMode')).toBe('details');+ } finally {+ dispose();+ }+ });+it('only offers columns the compact table can present without horizontal scrolling', () => {setCompactViewport();createRoot((dispose) => {diff --git a/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts b/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.tsindex 2ab7e02667..9814659315 100644--- a/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts+++ b/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts@@ -15,6 +15,7 @@ import {isWorkloadTableMetricHistoryRange,normalizeWorkloadChartKey,WORKLOAD_TABLE_HISTORY_DEFAULT_RANGE,+ WORKLOAD_TABLE_HISTORY_MAX_POINTS,WORKLOAD_TABLE_HISTORY_RANGES,} from '../workloadMetricHistoryModel';@@ -27,6 +28,7 @@ describe('workloadMetricHistoryModel', () => {it('keeps table sparkline history ranges bounded to dense table windows', () => {expect(WORKLOAD_TABLE_HISTORY_DEFAULT_RANGE).toBe('1h');+ expect(WORKLOAD_TABLE_HISTORY_MAX_POINTS).toBe(36);expect(WORKLOAD_TABLE_HISTORY_RANGES).toEqual(['1h', '12h', '24h', '7d']);expect(isWorkloadTableMetricHistoryRange('12h')).toBe(true);expect(isWorkloadTableMetricHistoryRange('30d')).toBe(false);diff --git a/frontend-modern/src/components/Workloads/guestDrawerModel.ts b/frontend-modern/src/components/Workloads/guestDrawerModel.tsindex 0f1744e7c7..8299c05fa2 100644--- a/frontend-modern/src/components/Workloads/guestDrawerModel.ts+++ b/frontend-modern/src/components/Workloads/guestDrawerModel.ts@@ -9,11 +9,8 @@ import type {import { formatHistoryChartTooltipValue } from '@/components/shared/historyChartModel';import { formatBytes, formatPercent, getBackupInfo, type BackupThresholds } from '@/utils/format';import { getWorkloadsGuestBackupStatusPresentation } from '@/utils/workloadGuestPresentation';-import {- getCanonicalWorkloadId,- getWorkloadCPUPercent,- resolveWorkloadType,-} from '@/utils/workloads';+import { getWorkloadCPUPercent, resolveWorkloadType } from '@/utils/workloads';+import { getWorkloadMetricHistoryTarget } from '@/utils/workloadMetricHistoryTarget';import type { NestedWorkloadContext } from './nestedWorkloadContext';import type { WorkloadsMemoryDisplayBasis } from './workloadsFilterModel';@@ -284,28 +281,7 @@ export const getGuestDrawerHistoryRangeBounds = (};export const getGuestDrawerHistoryTarget = (guest: Guest): GuestDrawerHistoryTarget | null => {- const explicitResourceType = guest.metricsTarget?.resourceType;- const explicitResourceId = guest.metricsTarget?.resourceId?.trim();- if (explicitResourceType && explicitResourceId) {- return { resourceType: explicitResourceType, resourceId: explicitResourceId };- }-- const resourceId = getCanonicalWorkloadId(guest).trim();- if (!resourceId) return null;-- const workloadType = resolveWorkloadType(guest);- switch (workloadType) {- case 'vm':- return { resourceType: 'vm', resourceId };- case 'system-container':- return { resourceType: 'system-container', resourceId };- case 'app-container':- return { resourceType: 'app-container', resourceId };- case 'pod':- return { resourceType: 'pod', resourceId };- default:- return null;- }+ return getWorkloadMetricHistoryTarget(guest);};export const hasGuestDrawerOsInfo = (guest: Guest): boolean =>diff --git a/frontend-modern/src/components/Workloads/guestRowModel.tsx b/frontend-modern/src/components/Workloads/guestRowModel.tsxindex d6a5c53f5c..40b81bf47e 100644--- a/frontend-modern/src/components/Workloads/guestRowModel.tsx+++ b/frontend-modern/src/components/Workloads/guestRowModel.tsx@@ -17,7 +17,7 @@ import type {} from './workloadMetricHistoryModel';import type { NestedWorkloadContext } from './nestedWorkloadContext';import type { WorkloadColumnWidths } from './workloadColumnWidths';-import type { WorkloadsMemoryDisplayBasis } from './workloadsFilterModel';+import type { WorkloadsMemoryDisplayBasis, WorkloadsMetricHoverMode } from './workloadsFilterModel';export type WorkloadTableLayoutMode = 'narrow' | 'phone' | 'mobile' | 'tablet' | 'compact' | 'wide';@@ -121,6 +121,7 @@ export interface GuestRowProps {summaryGroupMemberState?: SummaryGroupMemberInteractionState;ioEmphasis?: WorkloadIOEmphasis;metricDisplayMode?: 'bars' | 'sparklines';+ metricHoverMode?: WorkloadsMetricHoverMode;memoryDisplayBasis?: WorkloadsMemoryDisplayBasis;metricHistory?: WorkloadMetricHistoryReader;nestedWorkloadContext?: Pick<NestedWorkloadContext, 'count' | 'label'>;diff --git a/frontend-modern/src/components/Workloads/useWorkloadTableMetricHistory.ts b/frontend-modern/src/components/Workloads/useWorkloadTableMetricHistory.tsindex c9847aa6cb..9a0969b59f 100644--- a/frontend-modern/src/components/Workloads/useWorkloadTableMetricHistory.ts+++ b/frontend-modern/src/components/Workloads/useWorkloadTableMetricHistory.ts@@ -1,8 +1,17 @@-import { createMemo, type Accessor } from 'solid-js';+import { createEffect, createMemo, createSignal, onCleanup, type Accessor } from 'solid-js';-import type { WorkloadChartsResponse } from '@/api/charts';+import {+ ChartsAPI,+ type AllMetricsHistoryResponse,+ type ResourceType,+ type SingleMetricHistoryResponse,+ type WorkloadChartsResponse,+} from '@/api/charts';import type { Node } from '@/types/api';+import type { WorkloadGuest } from '@/types/workloads';import { createNonSuspendingQuery } from '@/hooks/createNonSuspendingQuery';+import { getCanonicalWorkloadId } from '@/utils/workloads';+import { getWorkloadMetricHistoryTarget } from '@/utils/workloadMetricHistoryTarget';import {fetchInfrastructureSummaryAndCache,type InfrastructureSummaryFetchResult,@@ -23,11 +32,21 @@ import {} from './workloadMetricHistoryModel';interface WorkloadTableMetricHistoryOptions {+ activeGuest?: Accessor<WorkloadGuest | null>;enabled: Accessor<boolean>;+ onDemand?: Accessor<boolean>;+ prefetchGuests?: Accessor<readonly WorkloadGuest[]>;range: Accessor<WorkloadTableMetricHistoryRange>;selectedNode: Accessor<string | null | undefined>;}+interface ActiveGuestHistoryQueryKey {+ guestId: string;+ range: WorkloadTableMetricHistoryRange;+ resourceId: string;+ resourceType: ResourceType;+}+const EMPTY_WORKLOAD_CHARTS_RESPONSE: WorkloadChartsResponse = {data: {},dockerData: {},@@ -41,6 +60,26 @@ const EMPTY_INFRASTRUCTURE_CHARTS_RESPONSE: InfrastructureSummaryFetchResult = {oldestDataTimestamp: null,};+const ROW_HISTORY_PREFETCH_CONCURRENCY = 4;+const ROW_HISTORY_INITIAL_PREFETCH_COUNT = 6;+const ROW_HISTORY_ADJACENT_PREFETCH_COUNT = 4;+const ROW_HISTORY_CACHE_MAX_ENTRIES = 18;++const normalizeActiveGuestHistoryResponse = (+ response: AllMetricsHistoryResponse | SingleMetricHistoryResponse,+): AllMetricsHistoryResponse =>+ 'metrics' in response+ ? response+ : {+ resourceType: response.resourceType,+ resourceId: response.resourceId,+ range: response.range,+ start: response.start,+ end: response.end,+ metrics: { [response.metric]: response.points },+ source: response.source,+ };+const normalizeNodeScope = (value: string | null | undefined): string => value?.trim() ?? '';const buildHistoryScope = (range: WorkloadTableMetricHistoryRange, nodeScope = ''): string =>`${range}::${nodeScope || '__all__'}`;@@ -52,6 +91,23 @@ const parseHistoryScope = (scope: string) => {};};+const buildActiveGuestHistoryQueryKey = (+ guest: WorkloadGuest,+ range: WorkloadTableMetricHistoryRange,+): ActiveGuestHistoryQueryKey | null => {+ const target = getWorkloadMetricHistoryTarget(guest);+ if (!target) return null;+ return {+ guestId: getCanonicalWorkloadId(guest),+ range,+ resourceId: target.resourceId,+ resourceType: target.resourceType,+ };+};++const buildActiveGuestHistoryCacheKey = (key: ActiveGuestHistoryQueryKey): string =>+ `${key.resourceType}:${key.resourceId}:${key.range}:${WORKLOAD_TABLE_HISTORY_MAX_POINTS}`;+export function useWorkloadTableMetricHistory(options: WorkloadTableMetricHistoryOptions,): WorkloadMetricHistoryReader {@@ -66,38 +122,208 @@ export function useWorkloadTableMetricHistory(const workloadHistory = createNonSuspendingQuery<WorkloadChartsResponse, string>({source: workloadHistoryScope,- fetcher: (scope) => {+ fetcher: (scope, signal) => {const parsed = parseHistoryScope(scope);return fetchWorkloadsSummaryAndCache(parsed.range, {caller: 'WorkloadTableMetricHistory',maxPoints: WORKLOAD_TABLE_HISTORY_MAX_POINTS,nodeId: parsed.nodeScope === '__all__' ? null : parsed.nodeScope,+ signal,});},initialValue: EMPTY_WORKLOAD_CHARTS_RESPONSE,cacheKey: (scope) => `workload-table-history:${scope}`,pollMs: WORKLOAD_TABLE_HISTORY_POLL_MS,+ retainPreviousValueOnSourceChange: false,});const infrastructureHistory = createNonSuspendingQuery<InfrastructureSummaryFetchResult, string>({source: infrastructureHistoryScope,- fetcher: (scope) => {+ fetcher: (scope, signal) => {const parsed = parseHistoryScope(scope);return fetchInfrastructureSummaryAndCache(parsed.range, {caller: 'WorkloadTableMetricHistory',metrics: WORKLOAD_TABLE_HISTORY_INFRA_METRICS,+ signal,});},initialValue: EMPTY_INFRASTRUCTURE_CHARTS_RESPONSE,cacheKey: (scope) => `workload-table-infra-history:${scope}`,pollMs: WORKLOAD_TABLE_HISTORY_POLL_MS,+ retainPreviousValueOnSourceChange: false,+ });++ const [rowHistoryRevision, setRowHistoryRevision] = createSignal(0);+ const rowHistoryCache = new Map<string, AllMetricsHistoryResponse>();+ const pendingRowHistory: ActiveGuestHistoryQueryKey[] = [];+ const inFlightRowHistory = new Map<string, { controller: AbortController; generation: number }>();+ let rowHistoryGeneration = 0;+ let scheduledRange: WorkloadTableMetricHistoryRange | null = null;+ let rowHistoryWarmingActive = false;+ let disposed = false;++ const cancelRowHistoryQueue = () => {+ rowHistoryGeneration += 1;+ pendingRowHistory.splice(0, pendingRowHistory.length);+ inFlightRowHistory.forEach(({ controller }) => controller.abort());+ inFlightRowHistory.clear();+ };++ const trimRowHistoryCache = () => {+ while (rowHistoryCache.size > ROW_HISTORY_CACHE_MAX_ENTRIES) {+ const oldestKey = rowHistoryCache.keys().next().value as string | undefined;+ if (!oldestKey) return;+ rowHistoryCache.delete(oldestKey);+ }+ };++ const pumpRowHistoryQueue = () => {+ while (+ !disposed &&+ inFlightRowHistory.size < ROW_HISTORY_PREFETCH_CONCURRENCY &&+ pendingRowHistory.length > 0+ ) {+ const key = pendingRowHistory.shift();+ if (!key) break;+ const cacheKey = buildActiveGuestHistoryCacheKey(key);+ if (rowHistoryCache.has(cacheKey) || inFlightRowHistory.has(cacheKey)) continue;++ const controller = new AbortController();+ const generation = rowHistoryGeneration;+ inFlightRowHistory.set(cacheKey, { controller, generation });+ void ChartsAPI.getMetricsHistory({+ resourceType: key.resourceType,+ resourceId: key.resourceId,+ range: key.range,+ maxPoints: WORKLOAD_TABLE_HISTORY_MAX_POINTS,+ signal: controller.signal,+ })+ .then((response) => {+ if (disposed || generation !== rowHistoryGeneration || controller.signal.aborted) return;+ rowHistoryCache.set(cacheKey, normalizeActiveGuestHistoryResponse(response));+ trimRowHistoryCache();+ setRowHistoryRevision((revision) => revision + 1);+ })+ .catch(() => {+ // Hover warming is opportunistic. The live bars remain available if+ // history is missing or the request is cancelled by a range change.+ })+ .finally(() => {+ const current = inFlightRowHistory.get(cacheKey);+ if (current?.generation === generation) {+ inFlightRowHistory.delete(cacheKey);+ }+ pumpRowHistoryQueue();+ });+ }+ };++ const enqueueRowHistory = (keys: ActiveGuestHistoryQueryKey[], prioritize: boolean) => {+ const uniqueKeys = keys.filter((key, index) => {+ const cacheKey = buildActiveGuestHistoryCacheKey(key);+ return (+ keys.findIndex((candidate) => buildActiveGuestHistoryCacheKey(candidate) === cacheKey) ===+ index &&+ !rowHistoryCache.has(cacheKey) &&+ !inFlightRowHistory.has(cacheKey)+ );+ });+ if (uniqueKeys.length === 0) return;++ const uniqueCacheKeys = new Set(uniqueKeys.map(buildActiveGuestHistoryCacheKey));+ for (let index = pendingRowHistory.length - 1; index >= 0; index -= 1) {+ if (uniqueCacheKeys.has(buildActiveGuestHistoryCacheKey(pendingRowHistory[index]))) {+ pendingRowHistory.splice(index, 1);+ }+ }+ if (prioritize) {+ pendingRowHistory.unshift(...uniqueKeys);+ } else {+ pendingRowHistory.push(...uniqueKeys);+ }+ pumpRowHistoryQueue();+ };++ createEffect(() => {+ const range = options.range();+ const onDemand = options.onDemand?.() ?? false;+ const candidates = options.prefetchGuests?.() ?? [];+ const activeGuest = options.activeGuest?.() ?? null;++ if (scheduledRange !== range) {+ cancelRowHistoryQueue();+ rowHistoryCache.clear();+ setRowHistoryRevision((revision) => revision + 1);+ scheduledRange = range;+ }++ if (!onDemand) {+ if (rowHistoryWarmingActive) cancelRowHistoryQueue();+ rowHistoryWarmingActive = false;+ return;+ }+ rowHistoryWarmingActive = true;++ if (!activeGuest) {+ enqueueRowHistory(+ candidates+ .slice(0, ROW_HISTORY_INITIAL_PREFETCH_COUNT)+ .map((guest) => buildActiveGuestHistoryQueryKey(guest, range))+ .filter((key): key is ActiveGuestHistoryQueryKey => key !== null),+ false,+ );+ return;+ }++ const activeId = getCanonicalWorkloadId(activeGuest);+ const activeIndex = candidates.findIndex((guest) => getCanonicalWorkloadId(guest) === activeId);+ const adjacentGuests =+ activeIndex >= 0+ ? [+ activeGuest,+ ...candidates.slice(+ activeIndex + 1,+ activeIndex + 1 + ROW_HISTORY_ADJACENT_PREFETCH_COUNT,+ ),+ ...(activeIndex > 0 ? [candidates[activeIndex - 1]] : []),+ ]+ : [activeGuest];+ enqueueRowHistory(+ adjacentGuests+ .map((guest) => buildActiveGuestHistoryQueryKey(guest, range))+ .filter((key): key is ActiveGuestHistoryQueryKey => key !== null),+ true,+ );+ });++ onCleanup(() => {+ disposed = true;+ cancelRowHistoryQueue();});+ const getCachedGuestHistory = (guest: WorkloadGuest): AllMetricsHistoryResponse | null => {+ rowHistoryRevision();+ const key = buildActiveGuestHistoryQueryKey(guest, options.range());+ return key ? (rowHistoryCache.get(buildActiveGuestHistoryCacheKey(key)) ?? null) : null;+ };+const getGuestMetricSeries: WorkloadMetricHistoryReader['getGuestMetricSeries'] = (guest,metric,seriesOptions,) => {+ const activeGuest = options.onDemand?.() ? options.activeGuest?.() : null;+ if (activeGuest) {+ if (getCanonicalWorkloadId(activeGuest) !== getCanonicalWorkloadId(guest)) {+ return [];+ }+ return getMetricSparklineSeriesFromChartData(+ getCachedGuestHistory(guest)?.metrics,+ metric,+ seriesOptions,+ );+ }+const response = workloadHistory.value();const chartData = findChartDataForCandidates(getWorkloadChartKeyCandidates(guest), [response.data,@@ -114,6 +340,12 @@ export function useWorkloadTableMetricHistory(};return {+ hasGuestHistory: (guest) => {+ const response = getCachedGuestHistory(guest);+ return (+ response !== null && Object.values(response.metrics).some((points) => points.length > 0)+ );+ },getGuestMetricSeries,getNodeMetricSeries,};diff --git a/frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts b/frontend-modern/src/components/Workloads/useWorkloadsControlsState.tsindex a44b409ced..e79ca7b01e 100644--- a/frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts+++ b/frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts@@ -1,6 +1,7 @@import { createEffect, createMemo, createSignal, onMount, type Accessor } from 'solid-js';import { useLocation, useNavigate } from '@solidjs/router';+import { recordWorkloadHistoryActivity } from '@/api/workloadHistoryActivity';import { useBreakpoint } from '@/hooks/useBreakpoint';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { usePersistentSignal } from '@/hooks/usePersistentSignal';@@ -21,9 +22,11 @@ import {DEFAULT_WORKLOADS_SORT_DIRECTION,DEFAULT_WORKLOADS_SORT_KEY,DEFAULT_WORKLOADS_METRIC_DISPLAY_MODE,+ DEFAULT_WORKLOADS_METRIC_HOVER_MODE,DEFAULT_WORKLOADS_STATUS_MODE,type WorkloadsGroupingMode,type WorkloadsMetricDisplayMode,+ type WorkloadsMetricHoverMode,type WorkloadsSortKey,type WorkloadsStatusMode,} from './workloadsFilterModel';@@ -69,6 +72,8 @@ interface WorkloadsControlsStateOptions {// page-level state instead of forking a local persistent signal.metricDisplayMode?: Accessor<WorkloadsMetricDisplayMode>;onMetricDisplayModeChange?: (value: WorkloadsMetricDisplayMode) => void;+ metricHoverMode?: Accessor<WorkloadsMetricHoverMode>;+ onMetricHoverModeChange?: (value: WorkloadsMetricHoverMode) => void;metricHistoryRange?: Accessor<WorkloadTableMetricHistoryRange>;onMetricHistoryRangeChange?: (value: WorkloadTableMetricHistoryRange) => void;columnVisibilityStorageScope?: string;@@ -213,6 +218,28 @@ export function useWorkloadsControlsState(options: WorkloadsControlsStateOptionssetInternalMetricDisplayMode(value);};+ const [internalMetricHoverMode, setInternalMetricHoverMode] =+ usePersistentSignal<WorkloadsMetricHoverMode>(+ STORAGE_KEYS.WORKLOADS_METRIC_HOVER_MODE,+ DEFAULT_WORKLOADS_METRIC_HOVER_MODE,+ {+ deserialize: (raw) =>+ raw === 'details' || raw === 'history' ? raw : DEFAULT_WORKLOADS_METRIC_HOVER_MODE,+ },+ );+ const workloadMetricHoverMode: Accessor<WorkloadsMetricHoverMode> =+ options.metricHoverMode ?? internalMetricHoverMode;+ const setWorkloadMetricHoverMode = (value: WorkloadsMetricHoverMode): void => {+ if (value === 'details' && value !== workloadMetricHoverMode()) {+ recordWorkloadHistoryActivity('details_selected');+ }+ if (options.onMetricHoverModeChange) {+ options.onMetricHoverModeChange(value);+ return;+ }+ setInternalMetricHoverMode(value);+ };+const [internalMetricHistoryRange, setInternalMetricHistoryRange] =usePersistentSignal<WorkloadTableMetricHistoryRange>(STORAGE_KEYS.WORKLOADS_METRIC_HISTORY_RANGE,@@ -225,6 +252,9 @@ export function useWorkloadsControlsState(options: WorkloadsControlsStateOptionsconst workloadMetricHistoryRange: Accessor<WorkloadTableMetricHistoryRange> =options.metricHistoryRange ?? internalMetricHistoryRange;const setWorkloadMetricHistoryRange = (value: WorkloadTableMetricHistoryRange): void => {+ if (value !== workloadMetricHistoryRange()) {+ recordWorkloadHistoryActivity('range_change');+ }if (options.onMetricHistoryRangeChange) {options.onMetricHistoryRangeChange(value);return;@@ -558,6 +588,7 @@ export function useWorkloadsControlsState(options: WorkloadsControlsStateOptionsvisibleColumns,workloadMetricHistoryRange,workloadMetricDisplayMode,+ workloadMetricHoverMode,workloadTableVisibleColumnIds,workloadTableVisibleColumns,workloadTableLayoutMode,@@ -573,5 +604,6 @@ export function useWorkloadsControlsState(options: WorkloadsControlsStateOptionsresetWorkloadColumnWidths,setWorkloadMetricHistoryRange,setWorkloadMetricDisplayMode,+ setWorkloadMetricHoverMode,} as const;}diff --git a/frontend-modern/src/components/Workloads/useWorkloadsState.ts b/frontend-modern/src/components/Workloads/useWorkloadsState.tsindex dc2cde7d46..7a4e1fdccb 100644--- a/frontend-modern/src/components/Workloads/useWorkloadsState.ts+++ b/frontend-modern/src/components/Workloads/useWorkloadsState.ts@@ -4,6 +4,7 @@ import {RuntimeInventorySourcesAPI,type RuntimeInventorySourcesResponse,} from '@/api/runtimeInventorySources';+import { recordWorkloadHistoryActivity } from '@/api/workloadHistoryActivity';import { nodeOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';import type { VM, Container, Node } from '@/types/api';import type { Resource } from '@/types/resource';@@ -25,6 +26,7 @@ import {} from '@/utils/workloadEmptyStatePresentation';import { getCanonicalWorkloadId } from '@/utils/workloads';import { nodeFromResource } from '@/utils/resourceStateAdapters';+import { STORAGE_KEYS } from '@/utils/localStorage';import {buildWorkloadSummaryGroupScopeMap,createWorkloadSortComparator,@@ -36,6 +38,7 @@ import {type WorkloadsGroupingMode,type WorkloadsMemoryDisplayBasis,type WorkloadsMetricDisplayMode,+ type WorkloadsMetricHoverMode,type WorkloadsStatusOption,type WorkloadsSortKey,} from './workloadsFilterModel';@@ -115,6 +118,8 @@ export interface WorkloadsSurfaceProps {// surface falls back to its own persistent signals.metricDisplayMode?: Accessor<WorkloadsMetricDisplayMode>;onMetricDisplayModeChange?: (value: WorkloadsMetricDisplayMode) => void;+ metricHoverMode?: Accessor<WorkloadsMetricHoverMode>;+ onMetricHoverModeChange?: (value: WorkloadsMetricHoverMode) => void;metricHistoryRange?: Accessor<WorkloadTableMetricHistoryRange>;onMetricHistoryRangeChange?: (value: WorkloadTableMetricHistoryRange) => void;// Proxmox can compare guest memory use with either the allocation assigned@@ -324,8 +329,10 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {clearWorkloadColumnWidth,resetWorkloadColumnWidths,workloadMetricDisplayMode,+ workloadMetricHoverMode,workloadMetricHistoryRange,setWorkloadMetricDisplayMode,+ setWorkloadMetricHoverMode,setWorkloadMetricHistoryRange,} = useWorkloadsControlsState({defaultSortKey: props.defaultSortKey,@@ -333,6 +340,8 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {statusModeStorageScope: props.statusModeStorageScope,metricDisplayMode: props.metricDisplayMode,onMetricDisplayModeChange: props.onMetricDisplayModeChange,+ metricHoverMode: props.metricHoverMode,+ onMetricHoverModeChange: props.onMetricHoverModeChange,metricHistoryRange: props.metricHistoryRange,onMetricHistoryRangeChange: props.onMetricHistoryRangeChange,columnVisibilityStorageScope: props.columnVisibilityStorageScope,@@ -384,11 +393,6 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {const workloadInventoryIssues = createMemo(() =>buildWorkloadInventorySourceIssues(inventorySourcesSnapshot.value().sources ?? []),);- const workloadMetricHistory = useWorkloadTableMetricHistory({- enabled: () => workloadMetricDisplayMode() === 'sparklines',- range: workloadMetricHistoryRange,- selectedNode,- });const hasWorkloadsData = createMemo(() => allGuests().length > 0);const hasInfrastructureSources = createMemo(() =>workloadsEnabled()@@ -492,6 +496,7 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {focusedSummaryWorkloadGroupScope,focusedSummaryWorkloadGroupId,hoveredSummaryWorkloadGroupScope,+ hoveredWorkloadId,revealedGuestId,selectedGuestId,setClearSurfaceRootRef,@@ -513,6 +518,20 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {routeStateEnabled: props.routeStateEnabled,});+ const activeHistoryGuest = createMemo(() => {+ const activeId = hoveredWorkloadId();+ if (!activeId) return null;+ return allGuests().find((guest) => getCanonicalWorkloadId(guest) === activeId) ?? null;+ });+ createEffect(() => {+ if (+ workloadMetricDisplayMode() === 'bars' &&+ workloadMetricHoverMode() === 'details' &&+ hoveredWorkloadId() !== null+ ) {+ setHoveredWorkloadId(null);+ }+ });const {bottomSpacerHeight,getGroupLabel,@@ -542,6 +561,41 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {groupLabelBadges,});+ const metricHistoryPrefetchGuests = createMemo(() =>+ visibleGroupKeys().flatMap((groupKey) => windowedGroupedGuests()[groupKey] ?? []),+ );+ const workloadMetricHistory = useWorkloadTableMetricHistory({+ activeGuest: activeHistoryGuest,+ // Persistent Trends owns the estate-wide batch reader. Bars mode warms a+ // small visible/adjacent window so sequential row hover remains immediate.+ enabled: () => workloadMetricDisplayMode() === 'sparklines',+ onDemand: () =>+ workloadMetricDisplayMode() === 'bars' && workloadMetricHoverMode() === 'history',+ prefetchGuests: metricHistoryPrefetchGuests,+ range: workloadMetricHistoryRange,+ selectedNode,+ });+ const [workloadHistoryHintSeen, setWorkloadHistoryHintSeen] = usePersistentSignal<boolean>(+ STORAGE_KEYS.WORKLOADS_HISTORY_HINT_SEEN,+ false,+ { deserialize: (raw) => raw === 'true' },+ );+ const workloadMetricHistoryHintVisible = createMemo(+ () =>+ !workloadHistoryHintSeen() &&+ workloadMetricDisplayMode() === 'bars' &&+ workloadMetricHoverMode() === 'history' &&+ filteredGuests().length > 0,+ );+ createEffect(() => {+ const active = activeHistoryGuest();+ if (!active || !workloadMetricHistory.hasGuestHistory?.(active)) return;+ recordWorkloadHistoryActivity('preview');+ if (!workloadHistoryHintSeen()) {+ setWorkloadHistoryHintSeen(true);+ }+ });+return {activeAlerts,alertsEnabled,@@ -627,6 +681,7 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {setTableWrapperRef,setViewMode: setEffectiveViewMode,setWorkloadMetricDisplayMode,+ setWorkloadMetricHoverMode,setWorkloadMetricHistoryRange,sortDirection,sortKey,@@ -642,7 +697,9 @@ export function useWorkloadsState(props: WorkloadsSurfaceProps) {windowedGroupedGuests,workloadIOEmphasis,workloadMetricHistoryRange,+ workloadMetricHistoryHintVisible,workloadMetricDisplayMode,+ workloadMetricHoverMode,workloadMemoryDisplayBasis,workloadMetricHistory,workloadTableVisibleColumnIds,diff --git a/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts b/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.tsindex 461a757890..d2fa35b55a 100644--- a/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts+++ b/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts@@ -19,6 +19,7 @@ export interface WorkloadGuestMetricSeriesOptions {}export interface WorkloadMetricHistoryReader {+ hasGuestHistory?: (guest: WorkloadGuest) => boolean;getGuestMetricSeries: (guest: WorkloadGuest,metric: WorkloadTableMetric,@@ -74,7 +75,10 @@ export const WORKLOAD_TABLE_HISTORY_RANGE_LABELS: Record<WorkloadTableMetricHist'7d': '7d',};export const WORKLOAD_TABLE_HISTORY_DEFAULT_RANGE: WorkloadTableMetricHistoryRange = '1h';-export const WORKLOAD_TABLE_HISTORY_MAX_POINTS = 72;+// A 120px table sparkline cannot resolve more than roughly one sample every+// three pixels. Keeping this compact also bounds all-workload history payloads+// when an operator changes range on a large estate.+export const WORKLOAD_TABLE_HISTORY_MAX_POINTS = 36;export const MIN_PERCENT_SCALE_CEILING = 5;export const WORKLOAD_TABLE_HISTORY_POLL_MS = 30_000;diff --git a/frontend-modern/src/components/Workloads/workloadsFilterModel.ts b/frontend-modern/src/components/Workloads/workloadsFilterModel.tsindex 9788993ef6..1054dd1baf 100644--- a/frontend-modern/src/components/Workloads/workloadsFilterModel.ts+++ b/frontend-modern/src/components/Workloads/workloadsFilterModel.ts@@ -7,6 +7,7 @@ import type { WorkloadTableMetricHistoryRange } from './workloadMetricHistoryModexport type WorkloadsStatusMode = 'all' | 'running' | 'degraded' | 'stopped';export type WorkloadsGroupingMode = 'grouped' | 'flat';export type WorkloadsMetricDisplayMode = 'bars' | 'sparklines';+export type WorkloadsMetricHoverMode = 'details' | 'history';export type WorkloadsMemoryDisplayBasis = 'guest' | 'host';export type WorkloadsSortKey = keyof WorkloadGuest | 'diskIo' | 'info' | 'netIo';@@ -78,8 +79,11 @@ export interface WorkloadsFilterProps {onChartsToggle?: () => void;metricDisplayMode?: () => WorkloadsMetricDisplayMode;setMetricDisplayMode?: (value: WorkloadsMetricDisplayMode) => void;+ metricHoverMode?: () => WorkloadsMetricHoverMode;+ setMetricHoverMode?: (value: WorkloadsMetricHoverMode) => void;metricHistoryRange?: () => WorkloadTableMetricHistoryRange;setMetricHistoryRange?: (value: WorkloadTableMetricHistoryRange) => void;+ metricHistoryHintVisible?: () => boolean;memoryDisplayBasis?: () => WorkloadsMemoryDisplayBasis;setMemoryDisplayBasis?: (value: WorkloadsMemoryDisplayBasis) => void;pinnedSelectionActive?: () => boolean;@@ -109,6 +113,7 @@ export const DEFAULT_WORKLOADS_SORT_DIRECTION = 'asc';export const DEFAULT_WORKLOADS_VIEW_MODE: ViewMode = 'all';export const DEFAULT_WORKLOADS_STATUS_MODE: WorkloadsStatusMode = 'all';export const DEFAULT_WORKLOADS_METRIC_DISPLAY_MODE: WorkloadsMetricDisplayMode = 'bars';+export const DEFAULT_WORKLOADS_METRIC_HOVER_MODE: WorkloadsMetricHoverMode = 'history';export const countActiveWorkloadsFilters = (options: CountActiveWorkloadsFiltersOptions,diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsxindex 0be7fd0029..7a8a4c44d8 100644--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx@@ -516,8 +516,11 @@ function ProxmoxOverview(props: ProxmoxOverviewProps) {platformFilter={undefined}metricDisplayMode={workloadsState.workloadMetricDisplayMode}setMetricDisplayMode={workloadsState.setWorkloadMetricDisplayMode}+ metricHoverMode={workloadsState.workloadMetricHoverMode}+ setMetricHoverMode={workloadsState.setWorkloadMetricHoverMode}metricHistoryRange={workloadsState.workloadMetricHistoryRange}setMetricHistoryRange={workloadsState.setWorkloadMetricHistoryRange}+ metricHistoryHintVisible={workloadsState.workloadMetricHistoryHintVisible}memoryDisplayBasis={workloadsState.workloadMemoryDisplayBasis}setMemoryDisplayBasis={props.setMemoryDisplayBasis}forcedPlatform={PROXMOX_PLATFORM_FILTER}diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsxindex 8dfe4d46c7..daeec40ce1 100644--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx@@ -461,6 +461,9 @@ describe('ProxmoxPageSurface contract', () => {expect(workloadFilterIndex).toBeGreaterThan(nodesTableIndex);expect(workloadsSurfaceIndex).toBeGreaterThan(workloadFilterIndex);expect(proxmoxPageSurfaceSource).not.toContain('<ProxmoxBackupServersTable');+ expect(proxmoxPageSurfaceSource).toContain(+ 'metricHistoryHintVisible={workloadsState.workloadMetricHistoryHintVisible}',+ );});it('keeps the bounded node preview before guests at every viewport', () => {diff --git a/frontend-modern/src/hooks/__tests__/createNonSuspendingQuery.test.tsx b/frontend-modern/src/hooks/__tests__/createNonSuspendingQuery.test.tsxindex cefdb8d272..d8442b46de 100644--- a/frontend-modern/src/hooks/__tests__/createNonSuspendingQuery.test.tsx+++ b/frontend-modern/src/hooks/__tests__/createNonSuspendingQuery.test.tsx@@ -16,14 +16,16 @@ afterEach(() => {function QueryProbe(props: {cacheNamespace: string;- fetcher: (key: string) => Promise<string>;+ fetcher: (key: string, signal?: AbortSignal) => Promise<string>;queryKey?: () => string;+ retainPreviousValueOnSourceChange?: boolean;}) {const state = createNonSuspendingQuery<string, string>({source: () => props.queryKey?.() ?? 'stable-key',cacheKey: (key) => `${props.cacheNamespace}:${key}`,fetcher: props.fetcher,initialValue: 'initial',+ retainPreviousValueOnSourceChange: props.retainPreviousValueOnSourceChange,});return (@@ -51,7 +53,7 @@ describe('createNonSuspendingQuery', () => {render(() => <QueryProbe cacheNamespace={cacheNamespace} fetcher={secondFetcher} />);await waitFor(() => {- expect(secondFetcher).toHaveBeenCalledWith('stable-key');+ expect(secondFetcher).toHaveBeenCalledWith('stable-key', expect.any(AbortSignal));});expect(screen.getByTestId('query-probe').textContent).toContain('loaded');@@ -60,6 +62,88 @@ describe('createNonSuspendingQuery', () => {expect(screen.getByTestId('query-probe').textContent).not.toContain('initial');});+ it('retains the previous source value by default while the replacement loads', async () => {+ const [queryKey, setQueryKey] = createSignal('1h');+ const fetcher = vi.fn((key: string) =>+ key === '1h' ? Promise.resolve('loaded:1h') : new Promise<string>(() => {}),+ );++ render(() => (+ <QueryProbe+ cacheNamespace={`retained-source-${Date.now()}`}+ fetcher={fetcher}+ queryKey={queryKey}+ />+ ));++ await waitFor(() => {+ expect(screen.getByTestId('query-probe').textContent).toContain('loaded:1h');+ });++ setQueryKey('24h');+ await waitFor(() => {+ expect(fetcher).toHaveBeenCalledWith('24h', expect.any(AbortSignal));+ });++ expect(screen.getByTestId('query-probe').textContent).toContain('loaded:1h');+ expect(screen.getByTestId('query-probe').textContent).toContain('loading:true');+ });++ it('clears a prior source immediately when retained data would mislabel the active range', async () => {+ const [queryKey, setQueryKey] = createSignal('1h');+ const fetcher = vi.fn((key: string) =>+ key === '1h' ? Promise.resolve('loaded:1h') : new Promise<string>(() => {}),+ );++ render(() => (+ <QueryProbe+ cacheNamespace={`source-honest-${Date.now()}`}+ fetcher={fetcher}+ queryKey={queryKey}+ retainPreviousValueOnSourceChange={false}+ />+ ));++ await waitFor(() => {+ expect(screen.getByTestId('query-probe').textContent).toContain('loaded:1h');+ });++ setQueryKey('24h');+ await waitFor(() => {+ expect(fetcher).toHaveBeenCalledWith('24h', expect.any(AbortSignal));+ });++ expect(screen.getByTestId('query-probe').textContent).toContain('initial');+ expect(screen.getByTestId('query-probe').textContent).toContain('resolved:false');+ expect(screen.getByTestId('query-probe').textContent).toContain('loading:true');+ expect(screen.getByTestId('query-probe').textContent).not.toContain('loaded:1h');+ });++ it('aborts superseded source requests', async () => {+ const [queryKey, setQueryKey] = createSignal('1h');+ const signals: AbortSignal[] = [];+ const fetcher = vi.fn((_key: string, signal?: AbortSignal) => {+ signals.push(signal!);+ return new Promise<string>(() => {});+ });++ render(() => (+ <QueryProbe+ cacheNamespace={`abort-superseded-${Date.now()}`}+ fetcher={fetcher}+ queryKey={queryKey}+ />+ ));++ await waitFor(() => expect(signals).toHaveLength(1));+ expect(signals[0].aborted).toBe(false);++ setQueryKey('7d');+ await waitFor(() => expect(signals).toHaveLength(2));+ expect(signals[0].aborted).toBe(true);+ expect(signals[1].aborted).toBe(false);+ });+it('evicts least-recently-used resource and range entries at the cache limit', async () => {const cacheNamespace = `bounded-query-cache-${Date.now()}`;const { maxEntries } = getCreateNonSuspendingQueryCacheDiagnosticsForTest();diff --git a/frontend-modern/src/hooks/createNonSuspendingQuery.ts b/frontend-modern/src/hooks/createNonSuspendingQuery.tsindex 661f995aca..f1835606bd 100644--- a/frontend-modern/src/hooks/createNonSuspendingQuery.ts+++ b/frontend-modern/src/hooks/createNonSuspendingQuery.ts@@ -3,10 +3,11 @@ import { eventBus } from '@/stores/events';interface CreateNonSuspendingQueryOptions<T, K> {source: Accessor<K | null>;- fetcher: (key: K) => Promise<T>;+ fetcher: (key: K, signal: AbortSignal) => Promise<T>;initialValue: T;cacheKey?: (key: K) => string | null;pollMs?: number;+ retainPreviousValueOnSourceChange?: boolean;}interface QueryRunOptions {@@ -176,8 +177,15 @@ export function createNonSuspendingQuery<T, K>(options: CreateNonSuspendingQueryconst [resolvedOnce, setResolvedOnce] = createSignal(initialCached?.resolvedOnce ?? false);let latestRequestId = 0;+ let activeAbortController: AbortController | null = null;++ const cancelActiveRequest = () => {+ activeAbortController?.abort();+ activeAbortController = null;+ };const reset = () => {+ cancelActiveRequest();latestRequestId += 1;setValue(() => options.initialValue);setLoading(false);@@ -201,6 +209,9 @@ export function createNonSuspendingQuery<T, K>(options: CreateNonSuspendingQueryonCleanup(unsubscribeLiveQueryOrgSwitch);const run = async (key: K, runOptions: QueryRunOptions = {}): Promise<T> => {+ cancelActiveRequest();+ const abortController = new AbortController();+ activeAbortController = abortController;const requestId = ++latestRequestId;const retainedCacheKey = getRetainedCacheKey(key);const cacheGeneration = retainedQueryCacheGeneration;@@ -209,7 +220,7 @@ export function createNonSuspendingQuery<T, K>(options: CreateNonSuspendingQuery}try {- const nextValue = await options.fetcher(key);+ const nextValue = await options.fetcher(key, abortController.signal);if (requestId !== latestRequestId) {return value();}@@ -223,6 +234,7 @@ export function createNonSuspendingQuery<T, K>(options: CreateNonSuspendingQueryreturn value();} finally {if (requestId === latestRequestId) {+ activeAbortController = null;setResolvedOnce(true);if (retainedCacheKey && cacheGeneration === retainedQueryCacheGeneration) {writeRetainedQueryCacheEntry(retainedCacheKey, {@@ -247,10 +259,22 @@ export function createNonSuspendingQuery<T, K>(options: CreateNonSuspendingQueryconst cached = readRetainedValue(key);if (cached) {applyRetainedValue(cached);+ } else if (options.retainPreviousValueOnSourceChange === false) {+ // A retained value is only honest when it belongs to the active source.+ // Range-sensitive history consumers opt out of showing the prior range+ // while its replacement is loading or has failed.+ setValue(() => options.initialValue);+ setError(null);+ setResolvedOnce(false);}void run(key, { background: Boolean(cached) });});+ onCleanup(() => {+ cancelActiveRequest();+ latestRequestId += 1;+ });+const refetch = async (runOptions: QueryRunOptions = {}): Promise<T> => {const key = options.source();if (key === null) {diff --git a/frontend-modern/src/i18n/messages.ts b/frontend-modern/src/i18n/messages.tsindex 3ccd603fcf..bbc5f9541f 100644--- a/frontend-modern/src/i18n/messages.ts+++ b/frontend-modern/src/i18n/messages.ts@@ -359,12 +359,12 @@ export const EN_MESSAGES = {'settings.general.temperature.title': 'Temperature unit','settings.general.telemetry.copyJson': 'Copy JSON','settings.general.telemetry.description':- 'Help improve Pulse by sharing outbound usage data: a rotating pseudonymous install ID, normalized release identity, runtime platform, coarse deployment and lifecycle buckets, aggregate resource and outcome counts, coarse feature flags, and content-free Patrol, Assistant, and capability-API usage counters. The payload does not include hostnames, credentials, infrastructure identifiers, URLs, paths, locale, browser events, prompts, chat messages, command text, action output, token values, names, email addresses, or IP addresses. Telemetry rows are retained for up to 90 days, and request IP addresses are used only transiently for rate limiting and are not stored in telemetry rows.',+ 'Help improve Pulse by sharing outbound usage data: a rotating pseudonymous install ID, normalized release identity, runtime platform, coarse deployment and lifecycle buckets, aggregate resource and outcome counts, coarse feature flags, content-free Patrol, Assistant, and capability-API usage counters, and four session-deduplicated workload-history adoption counts. The payload does not include hostnames, credentials, infrastructure identifiers, URLs, paths, locale, raw browser events, an event-level clickstream, prompts, chat messages, command text, action output, token values, names, email addresses, or IP addresses. Telemetry rows are retained for up to 90 days, and request IP addresses are used only transiently for rate limiting and are not stored in telemetry rows.','settings.general.telemetry.disabledPreview':'Telemetry is currently disabled. This preview shows the payload Pulse would send if you enable it.','settings.general.telemetry.fullDetails': 'Full details','settings.general.telemetry.notice.description':- 'Pulse now adds coarse deployment, lifecycle, estate-size, and aggregate alert and notification outcome signals when outbound usage telemetry is enabled. It still excludes personal details, infrastructure IDs, content, browser events, and clickstream data.',+ 'Pulse now adds four content-free, session-deduplicated workload-history adoption counts when outbound usage telemetry is enabled. It still excludes personal details, infrastructure IDs, content, raw browser events, and event-level clickstream data.','settings.general.telemetry.notice.disable': 'Disable telemetry','settings.general.telemetry.notice.dismissLabel': 'Dismiss telemetry payload update','settings.general.telemetry.notice.dismissTitle': 'Dismiss permanently',diff --git a/frontend-modern/src/stores/__tests__/systemSettings.test.ts b/frontend-modern/src/stores/__tests__/systemSettings.test.tsindex 02d9a1aeba..13cdb09dd6 100644--- a/frontend-modern/src/stores/__tests__/systemSettings.test.ts+++ b/frontend-modern/src/stores/__tests__/systemSettings.test.ts@@ -98,7 +98,7 @@ describe('systemSettings store', () => {expect(telemetryDescription).toContain('content-free Patrol, Assistant, and capability-API usage counters',);- expect(telemetryDescription).toContain('URLs, paths, locale, browser events');+ expect(telemetryDescription).toContain('URLs, paths, locale, raw browser events');expect(telemetryDescription).not.toContain('Pulse Intelligence loop adoption');expect(telemetryDescription).not.toContain('activation loop');expect(telemetryDescription).not.toContain('operations loop');diff --git a/frontend-modern/src/utils/infrastructureSummaryCache.ts b/frontend-modern/src/utils/infrastructureSummaryCache.tsindex f1547d93db..31c81232af 100644--- a/frontend-modern/src/utils/infrastructureSummaryCache.ts+++ b/frontend-modern/src/utils/infrastructureSummaryCache.ts@@ -107,6 +107,7 @@ export interface InfrastructureSummaryCacheHit {export interface InfrastructureSummaryFetchOptions {caller?: string;metrics?: readonly InfrastructureSummaryMetric[] | null;+ signal?: AbortSignal;}export interface InfrastructureSummaryFetchResult {@@ -331,7 +332,7 @@ export function fetchInfrastructureSummaryAndCache(const normalizedMetrics = normalizeInfrastructureSummaryMetrics(options?.metrics);const inFlightKey = inFlightKeyFor(range, orgScope, normalizedMetrics);- const existing = inFlightFetches.get(inFlightKey);+ const existing = options?.signal ? undefined : inFlightFetches.get(inFlightKey);if (existing) {infraSummaryPerfLog('fetch deduped', { caller, range, orgScope });return existing;@@ -341,7 +342,7 @@ export function fetchInfrastructureSummaryAndCache(const startedAt = infraSummaryPerfNow();infraSummaryPerfLog('fetch start', { caller, range, orgScope, requestId });- const request = ChartsAPI.getInfrastructureSummaryCharts(range, undefined, {+ const request = ChartsAPI.getInfrastructureSummaryCharts(range, options?.signal, {metrics: [...normalizedMetrics],}).then((response) => {@@ -389,10 +390,14 @@ export function fetchInfrastructureSummaryAndCache(throw error;}).finally(() => {- inFlightFetches.delete(inFlightKey);+ if (!options?.signal) {+ inFlightFetches.delete(inFlightKey);+ }});- inFlightFetches.set(inFlightKey, request);+ if (!options?.signal) {+ inFlightFetches.set(inFlightKey, request);+ }return request;}diff --git a/frontend-modern/src/utils/localStorage.ts b/frontend-modern/src/utils/localStorage.tsindex ed3867acd8..29af1273a3 100644--- a/frontend-modern/src/utils/localStorage.ts+++ b/frontend-modern/src/utils/localStorage.ts@@ -202,7 +202,9 @@ export const STORAGE_KEYS = {// Workloads settingsWORKLOADS_SEARCH_HISTORY: 'workloadsSearchHistory',WORKLOADS_METRIC_DISPLAY_MODE: 'workloadsMetricDisplayMode',+ WORKLOADS_METRIC_HOVER_MODE: 'workloadsMetricHoverMode',WORKLOADS_METRIC_HISTORY_RANGE: 'workloadsMetricHistoryRange',+ WORKLOADS_HISTORY_HINT_SEEN: 'workloadsHistoryHintSeenV4',WORKLOADS_MEMORY_DISPLAY_BASIS: 'workloadsMemoryDisplayBasis',AGENTS_SEARCH_HISTORY: 'agentsSearchHistory',diff --git a/frontend-modern/src/utils/workloadMetricHistoryTarget.ts b/frontend-modern/src/utils/workloadMetricHistoryTarget.tsnew file mode 100644index 0000000000..fdc752e475--- /dev/null+++ b/frontend-modern/src/utils/workloadMetricHistoryTarget.ts@@ -0,0 +1,34 @@+import type { ResourceType } from '@/api/charts';+import type { WorkloadGuest } from '@/types/workloads';+import { getCanonicalWorkloadId, resolveWorkloadType } from '@/utils/workloads';++export interface WorkloadMetricHistoryTarget {+ resourceType: ResourceType;+ resourceId: string;+}++export const getWorkloadMetricHistoryTarget = (+ guest: WorkloadGuest,+): WorkloadMetricHistoryTarget | null => {+ const explicitResourceType = guest.metricsTarget?.resourceType;+ const explicitResourceId = guest.metricsTarget?.resourceId?.trim();+ if (explicitResourceType && explicitResourceId) {+ return { resourceType: explicitResourceType, resourceId: explicitResourceId };+ }++ const resourceId = getCanonicalWorkloadId(guest).trim();+ if (!resourceId) return null;++ switch (resolveWorkloadType(guest)) {+ case 'vm':+ return { resourceType: 'vm', resourceId };+ case 'system-container':+ return { resourceType: 'system-container', resourceId };+ case 'app-container':+ return { resourceType: 'app-container', resourceId };+ case 'pod':+ return { resourceType: 'pod', resourceId };+ default:+ return null;+ }+};diff --git a/internal/api/route_inventory_test.go b/internal/api/route_inventory_test.goindex a30bc0aef5..da5c878ed6 100644--- a/internal/api/route_inventory_test.go+++ b/internal/api/route_inventory_test.go@@ -699,6 +699,7 @@ var allRouteAllowlist = []string{"/api/discovery/","/api/agent/ws","POST /api/agent/workflow-prompt-activity",+ "POST /api/usage/workload-history","/api/agents/agent/enroll","/api/agents/host/enroll","/api/clusters/",diff --git a/internal/api/router_routes_monitoring.go b/internal/api/router_routes_monitoring.goindex 730ec86fe3..90bd9dd8f3 100644--- a/internal/api/router_routes_monitoring.go+++ b/internal/api/router_routes_monitoring.go@@ -128,6 +128,7 @@ func (r *Router) registerMonitoringResourceRoutes(// startup to learn what's available.r.mux.HandleFunc("/api/agent/capabilities", HandleAgentCapabilitiesManifest)r.mux.HandleFunc("POST /api/agent/workflow-prompt-activity", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.HandleAgentWorkflowPromptActivity)))+ r.mux.HandleFunc("POST /api/usage/workload-history", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.HandleWorkloadHistoryActivity)))// Agent SSE event stream — agents subscribe once and receive// real-time notifications instead of polling. Auth at// monitoring:read because the stream surfaces the samediff --git a/internal/api/telemetry_workload_history.go b/internal/api/telemetry_workload_history.gonew file mode 100644index 0000000000..49d278bbfe--- /dev/null+++ b/internal/api/telemetry_workload_history.go@@ -0,0 +1,92 @@+package api++import (+ "encoding/json"+ "io"+ "net/http"+ "strings"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/internal/telemetry"+ "github.com/rs/zerolog/log"+)++type workloadHistoryActivityRequest struct {+ Activity string `json:"activity"`+}++// HandleWorkloadHistoryActivity accepts one closed, content-free adoption+// milestone. The browser deduplicates each value per session; this boundary+// rejects everything except the four declared values and persists only counts.+func (r *Router) HandleWorkloadHistoryActivity(w http.ResponseWriter, req *http.Request) {+ if req.Method != http.MethodPost {+ http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)+ return+ }++ var payload workloadHistoryActivityRequest+ dec := json.NewDecoder(http.MaxBytesReader(w, req.Body, 1024))+ dec.DisallowUnknownFields()+ if err := dec.Decode(&payload); err != nil {+ http.Error(w, "Invalid request", http.StatusBadRequest)+ return+ }+ var discard json.RawMessage+ if err := dec.Decode(&discard); err != io.EOF {+ http.Error(w, "Invalid request", http.StatusBadRequest)+ return+ }++ activity := strings.TrimSpace(payload.Activity)+ switch activity {+ case config.WorkloadHistoryActivityPreview,+ config.WorkloadHistoryActivityScrub,+ config.WorkloadHistoryActivityRangeChange,+ config.WorkloadHistoryActivityDetailsSelected:+ default:+ http.Error(w, "Unknown workload history activity", http.StatusBadRequest)+ return+ }++ persistence := r.persistenceForOrg(req.Context())+ if persistence != nil {+ if err := persistence.RecordWorkloadHistoryActivity(activity, time.Now().UTC()); err != nil {+ log.Debug().Err(err).Str("activity", activity).Msg("Failed to record workload history activity")+ }+ }+ w.WriteHeader(http.StatusNoContent)+}++// ApplyWorkloadHistoryTelemetrySnapshot aggregates the bounded, content-free+// counters across local organizations for the existing daily telemetry ping.+func (r *Router) ApplyWorkloadHistoryTelemetrySnapshot(s *telemetry.Snapshot, now time.Time) {+ if r == nil || s == nil {+ return+ }+ if now.IsZero() {+ now = time.Now()+ }+ since := now.UTC().Add(-telemetry.PulseIntelligenceTelemetryWindow)+ for _, orgID := range r.pulseIntelligenceTelemetryOrgIDs() {+ persistence := r.persistence+ if orgID != "default" && r.multiTenant != nil {+ var err error+ persistence, err = r.multiTenant.GetPersistence(orgID)+ if err != nil {+ continue+ }+ }+ if persistence == nil {+ continue+ }+ tally, err := persistence.LoadWorkloadHistoryActivityTally()+ if err != nil || tally == nil {+ continue+ }+ s.WorkloadHistoryPreviewSessions30d += tally.PreviewsSince(since)+ s.WorkloadHistoryScrubSessions30d += tally.ScrubsSince(since)+ s.WorkloadHistoryRangeChangeSessions30d += tally.RangeChangesSince(since)+ s.WorkloadHistoryDetailsSelectionSessions30d += tally.DetailsSelectedSince(since)+ }+}diff --git a/internal/api/telemetry_workload_history_test.go b/internal/api/telemetry_workload_history_test.gonew file mode 100644index 0000000000..f22d5dc76c--- /dev/null+++ b/internal/api/telemetry_workload_history_test.go@@ -0,0 +1,73 @@+package api++import (+ "net/http"+ "net/http/httptest"+ "strings"+ "testing"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/internal/telemetry"+)++func TestHandleWorkloadHistoryActivityRecordsOnlyCount(t *testing.T) {+ persistence := config.NewConfigPersistence(t.TempDir())+ router := &Router{persistence: persistence}+ req := httptest.NewRequest(http.MethodPost, "/api/usage/workload-history", strings.NewReader(`{"activity":"preview"}`))+ rec := httptest.NewRecorder()++ router.HandleWorkloadHistoryActivity(rec, req)++ if rec.Code != http.StatusNoContent {+ t.Fatalf("status = %d body=%q, want 204", rec.Code, rec.Body.String())+ }+ tally, err := persistence.LoadWorkloadHistoryActivityTally()+ if err != nil {+ t.Fatalf("LoadWorkloadHistoryActivityTally = %v", err)+ }+ if got := tally.PreviewsSince(time.Now().UTC().AddDate(0, 0, -30)); got != 1 {+ t.Fatalf("previews = %d, want 1", got)+ }+}++func TestHandleWorkloadHistoryActivityRejectsContentAndUnknownFields(t *testing.T) {+ for _, body := range []string{+ `{"activity":"guest-101"}`,+ `{"activity":"preview","guest_id":"101"}`,+ `{"activity":"preview"}{"activity":"scrub"}`,+ } {+ router := &Router{persistence: config.NewConfigPersistence(t.TempDir())}+ req := httptest.NewRequest(http.MethodPost, "/api/usage/workload-history", strings.NewReader(body))+ rec := httptest.NewRecorder()+ router.HandleWorkloadHistoryActivity(rec, req)+ if rec.Code != http.StatusBadRequest {+ t.Fatalf("body %q status = %d, want 400", body, rec.Code)+ }+ }+}++func TestApplyWorkloadHistoryTelemetrySnapshotAggregatesRollingCounts(t *testing.T) {+ persistence := config.NewConfigPersistence(t.TempDir())+ now := time.Now().UTC()+ for _, activity := range []string{+ config.WorkloadHistoryActivityPreview,+ config.WorkloadHistoryActivityPreview,+ config.WorkloadHistoryActivityScrub,+ config.WorkloadHistoryActivityRangeChange,+ config.WorkloadHistoryActivityDetailsSelected,+ } {+ if err := persistence.RecordWorkloadHistoryActivity(activity, now); err != nil {+ t.Fatalf("record %q = %v", activity, err)+ }+ }++ snapshot := telemetry.Snapshot{}+ (&Router{persistence: persistence}).ApplyWorkloadHistoryTelemetrySnapshot(&snapshot, now)+ if snapshot.WorkloadHistoryPreviewSessions30d != 2 ||+ snapshot.WorkloadHistoryScrubSessions30d != 1 ||+ snapshot.WorkloadHistoryRangeChangeSessions30d != 1 ||+ snapshot.WorkloadHistoryDetailsSelectionSessions30d != 1 {+ t.Fatalf("unexpected workload history snapshot: %+v", snapshot)+ }+}diff --git a/internal/config/workload_history_activity_tally.go b/internal/config/workload_history_activity_tally.gonew file mode 100644index 0000000000..4dc1999d26--- /dev/null+++ b/internal/config/workload_history_activity_tally.go@@ -0,0 +1,190 @@+package config++import (+ "encoding/json"+ "errors"+ "fmt"+ "os"+ "path/filepath"+ "time"++ "github.com/rs/zerolog/log"+)++const (+ WorkloadHistoryActivityPreview = "preview"+ WorkloadHistoryActivityScrub = "scrub"+ WorkloadHistoryActivityRangeChange = "range_change"+ WorkloadHistoryActivityDetailsSelected = "details_selected"++ workloadHistoryActivityTallyFileName = "workload_history_activity_tally.json"+ workloadHistoryActivityTallyVersion = 1+ workloadHistoryActivityRetentionDays = 31+)++// WorkloadHistoryActivityTallyData stores only daily counts for four closed,+// session-deduplicated UI milestones. It never receives a user, guest, route,+// browser, coordinate, duration, or other event-level identifier.+type WorkloadHistoryActivityTallyData struct {+ Version int `json:"version"`+ LastSaved time.Time `json:"last_saved"`+ DailyPreviews map[string]int `json:"daily_previews,omitempty"`+ DailyScrubs map[string]int `json:"daily_scrubs,omitempty"`+ DailyRanges map[string]int `json:"daily_range_changes,omitempty"`+ DailyDetails map[string]int `json:"daily_details_selected,omitempty"`+}++func workloadHistoryActivityDayKey(at time.Time) string {+ return at.UTC().Format("2006-01-02")+}++func workloadHistoryActivityCountSince(daily map[string]int, since time.Time) int {+ sinceDay := workloadHistoryActivityDayKey(since)+ total := 0+ for day, count := range daily {+ if day >= sinceDay {+ total += count+ }+ }+ return total+}++func (data *WorkloadHistoryActivityTallyData) PreviewsSince(since time.Time) int {+ if data == nil {+ return 0+ }+ return workloadHistoryActivityCountSince(data.DailyPreviews, since)+}++func (data *WorkloadHistoryActivityTallyData) ScrubsSince(since time.Time) int {+ if data == nil {+ return 0+ }+ return workloadHistoryActivityCountSince(data.DailyScrubs, since)+}++func (data *WorkloadHistoryActivityTallyData) RangeChangesSince(since time.Time) int {+ if data == nil {+ return 0+ }+ return workloadHistoryActivityCountSince(data.DailyRanges, since)+}++func (data *WorkloadHistoryActivityTallyData) DetailsSelectedSince(since time.Time) int {+ if data == nil {+ return 0+ }+ return workloadHistoryActivityCountSince(data.DailyDetails, since)+}++func pruneWorkloadHistoryActivityTally(data *WorkloadHistoryActivityTallyData, now time.Time) {+ if data == nil {+ return+ }+ cutoff := workloadHistoryActivityDayKey(now.UTC().AddDate(0, 0, -workloadHistoryActivityRetentionDays))+ for _, daily := range []map[string]int{+ data.DailyPreviews,+ data.DailyScrubs,+ data.DailyRanges,+ data.DailyDetails,+ } {+ for day := range daily {+ if day < cutoff {+ delete(daily, day)+ }+ }+ }+}++func (c *ConfigPersistence) workloadHistoryActivityTallyPath() string {+ return filepath.Join(c.configDir, workloadHistoryActivityTallyFileName)+}++func (c *ConfigPersistence) loadWorkloadHistoryActivityTallyLocked() *WorkloadHistoryActivityTallyData {+ data := &WorkloadHistoryActivityTallyData{Version: workloadHistoryActivityTallyVersion}+ if raw, err := c.fs.ReadFile(c.workloadHistoryActivityTallyPath()); err == nil && len(raw) > 0 {+ decoded := &WorkloadHistoryActivityTallyData{}+ if err := json.Unmarshal(raw, decoded); err == nil {+ data = decoded+ } else {+ log.Warn().Err(err).Msg("Discarding unreadable workload history activity tally")+ }+ }+ if data.DailyPreviews == nil {+ data.DailyPreviews = make(map[string]int, workloadHistoryActivityRetentionDays)+ }+ if data.DailyScrubs == nil {+ data.DailyScrubs = make(map[string]int, workloadHistoryActivityRetentionDays)+ }+ if data.DailyRanges == nil {+ data.DailyRanges = make(map[string]int, workloadHistoryActivityRetentionDays)+ }+ if data.DailyDetails == nil {+ data.DailyDetails = make(map[string]int, workloadHistoryActivityRetentionDays)+ }+ return data+}++func (c *ConfigPersistence) LoadWorkloadHistoryActivityTally() (*WorkloadHistoryActivityTallyData, error) {+ if c == nil || c.configDir == "" {+ return &WorkloadHistoryActivityTallyData{}, nil+ }+ c.mu.RLock()+ defer c.mu.RUnlock()+ return c.loadWorkloadHistoryActivityTallyLocked(), nil+}++// RecordWorkloadHistoryActivity folds one allowlisted, browser-session-level+// milestone into a bounded daily counter. Unknown values are rejected before+// any write so this file can never become an event or content sink.+func (c *ConfigPersistence) RecordWorkloadHistoryActivity(activity string, now time.Time) error {+ if c == nil || c.configDir == "" {+ return nil+ }+ if now.IsZero() {+ now = time.Now()+ }+ now = now.UTC()++ c.mu.Lock()+ defer c.mu.Unlock()++ data := c.loadWorkloadHistoryActivityTallyLocked()+ day := workloadHistoryActivityDayKey(now)+ switch activity {+ case WorkloadHistoryActivityPreview:+ data.DailyPreviews[day]+++ case WorkloadHistoryActivityScrub:+ data.DailyScrubs[day]+++ case WorkloadHistoryActivityRangeChange:+ data.DailyRanges[day]+++ case WorkloadHistoryActivityDetailsSelected:+ data.DailyDetails[day]+++ default:+ return fmt.Errorf("unknown workload history activity")+ }++ pruneWorkloadHistoryActivityTally(data, now)+ data.Version = workloadHistoryActivityTallyVersion+ data.LastSaved = now+ encoded, err := json.Marshal(data)+ if err != nil {+ return fmt.Errorf("encode workload history activity tally: %w", err)+ }++ path := c.workloadHistoryActivityTallyPath()+ if err := c.fs.MkdirAll(filepath.Dir(path), 0o700); err != nil {+ return fmt.Errorf("create workload history activity tally directory: %w", err)+ }+ tmpPath := path + ".tmp"+ if err := c.fs.WriteFile(tmpPath, encoded, 0o600); err != nil {+ return fmt.Errorf("write temp workload history activity tally: %w", err)+ }+ if err := c.fs.Rename(tmpPath, path); err != nil {+ if removeErr := c.fs.Remove(tmpPath); removeErr != nil && !errors.Is(removeErr, os.ErrNotExist) {+ log.Warn().Err(removeErr).Str("tmp_path", tmpPath).Msg("Failed to remove temporary workload history activity tally after failed rename")+ }+ return fmt.Errorf("commit workload history activity tally: %w", err)+ }+ return nil+}diff --git a/internal/config/workload_history_activity_tally_test.go b/internal/config/workload_history_activity_tally_test.gonew file mode 100644index 0000000000..19a0587fac--- /dev/null+++ b/internal/config/workload_history_activity_tally_test.go@@ -0,0 +1,73 @@+package config_test++import (+ "testing"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+)++func TestWorkloadHistoryActivityTallyCountsOnlyClosedMilestones(t *testing.T) {+ persistence := config.NewConfigPersistence(t.TempDir())+ now := time.Now().UTC()+ for _, activity := range []string{+ config.WorkloadHistoryActivityPreview,+ config.WorkloadHistoryActivityScrub,+ config.WorkloadHistoryActivityRangeChange,+ config.WorkloadHistoryActivityDetailsSelected,+ } {+ if err := persistence.RecordWorkloadHistoryActivity(activity, now); err != nil {+ t.Fatalf("RecordWorkloadHistoryActivity(%q) = %v", activity, err)+ }+ }++ tally, err := persistence.LoadWorkloadHistoryActivityTally()+ if err != nil {+ t.Fatalf("LoadWorkloadHistoryActivityTally = %v", err)+ }+ since := now.AddDate(0, 0, -30)+ if got := tally.PreviewsSince(since); got != 1 {+ t.Fatalf("PreviewsSince = %d, want 1", got)+ }+ if got := tally.ScrubsSince(since); got != 1 {+ t.Fatalf("ScrubsSince = %d, want 1", got)+ }+ if got := tally.RangeChangesSince(since); got != 1 {+ t.Fatalf("RangeChangesSince = %d, want 1", got)+ }+ if got := tally.DetailsSelectedSince(since); got != 1 {+ t.Fatalf("DetailsSelectedSince = %d, want 1", got)+ }+}++func TestWorkloadHistoryActivityTallyRejectsUnknownActivity(t *testing.T) {+ persistence := config.NewConfigPersistence(t.TempDir())+ if err := persistence.RecordWorkloadHistoryActivity("guest-101", time.Now().UTC()); err == nil {+ t.Fatal("unknown activity was accepted")+ }+ tally, err := persistence.LoadWorkloadHistoryActivityTally()+ if err != nil {+ t.Fatalf("LoadWorkloadHistoryActivityTally = %v", err)+ }+ if got := tally.PreviewsSince(time.Time{}); got != 0 {+ t.Fatalf("unknown activity changed tally: previews = %d", got)+ }+}++func TestWorkloadHistoryActivityTallyPrunesOutsideRetention(t *testing.T) {+ persistence := config.NewConfigPersistence(t.TempDir())+ now := time.Now().UTC()+ if err := persistence.RecordWorkloadHistoryActivity(config.WorkloadHistoryActivityPreview, now.AddDate(0, 0, -40)); err != nil {+ t.Fatalf("record old activity = %v", err)+ }+ if err := persistence.RecordWorkloadHistoryActivity(config.WorkloadHistoryActivityPreview, now); err != nil {+ t.Fatalf("record current activity = %v", err)+ }+ tally, err := persistence.LoadWorkloadHistoryActivityTally()+ if err != nil {+ t.Fatalf("LoadWorkloadHistoryActivityTally = %v", err)+ }+ if got := tally.PreviewsSince(now.AddDate(0, 0, -30)); got != 1 {+ t.Fatalf("PreviewsSince = %d, want 1", got)+ }+}diff --git a/internal/telemetry/telemetry.go b/internal/telemetry/telemetry.goindex bae31aaf44..0506f9e2ec 100644--- a/internal/telemetry/telemetry.go+++ b/internal/telemetry/telemetry.go@@ -45,6 +45,8 @@// plus event-history and active-state persistence health// - Aggregate notification attempt/delivery/failure counts over seven days// - Coarse update funnel counters and last failure category over the current install-ID rotation window+// - Workload-history preview, scrub, range-change, and Details-selection+// session counts over the current install-ID rotation window// - Patrol, Assistant, and external-agent usage counters over the current install-ID rotation window:// configured/active/governed-action/approved-execution/resolved-loop state,// Patrol control completed-loop and resolved-loop proof reported through@@ -65,6 +67,8 @@// - No action targets, resource IDs, finding IDs, approval actors, or approval reasons// - No names, email addresses, account identifiers, or other intentionally identifying personal content// - No listener addresses, self-check URLs, response bodies, asset names, or raw startup/self-check errors+// - No raw browser events, clickstream, guest/user identity, routes, selected+// ranges, cursor values, interaction timing, or browser identity//// # How to disable//@@ -189,7 +193,10 @@ const (// and reports only aggregate lifecycle, adoption, and persistence health.// Schema v15 separates destination HTTP 5xx server failures from rejected// HTTP 4xx responses. Both remain aggregate terminal-failure counters.- TelemetrySchemaVersion = 15+ // Schema v16 adds four content-free workload-history adoption counters.+ // Each browser reports each closed milestone at most once per session to a+ // bounded local daily tally; no event stream or browser identity is sent.+ TelemetrySchemaVersion = 16)type installIDRecord struct {@@ -338,6 +345,15 @@ type Ping struct {NodeTestAttempts30d int `json:"node_test_attempts_30d"`NodeTestFailures30d int `json:"node_test_failures_30d"`+ // Workload history adoption over the install-ID rotation window. The local+ // browser intake is session-deduplicated and contains only the closed+ // milestone; guest/user identity, routes, coordinates, and timings never+ // enter the tally or payload.+ WorkloadHistoryPreviewSessions30d int `json:"workload_history_preview_sessions_30d"`+ WorkloadHistoryScrubSessions30d int `json:"workload_history_scrub_sessions_30d"`+ WorkloadHistoryRangeChangeSessions30d int `json:"workload_history_range_change_sessions_30d"`+ WorkloadHistoryDetailsSelectionSessions30d int `json:"workload_history_details_selection_sessions_30d"`+// Core product outcomes. Alert history is retained locally for 30 days;// notification delivery rows are locally retention-bounded to seven days.AlertsFired30d int `json:"alerts_fired_30d"`@@ -527,6 +543,10 @@ type Snapshot struct {UpdateLastFailureCategory stringNodeTestAttempts30d intNodeTestFailures30d int+ WorkloadHistoryPreviewSessions30d int+ WorkloadHistoryScrubSessions30d int+ WorkloadHistoryRangeChangeSessions30d int+ WorkloadHistoryDetailsSelectionSessions30d intAuthConfigured boolConfiguredConnections intAlertsFired30d int@@ -997,7 +1017,7 @@ func Start(ctx context.Context, cfg Config) {log.Info().Str("platform", platformName(cfg.IsDocker)).- Msg("Outbound usage telemetry enabled: sends a rotating pseudonymous install ID, version identity, coarse lifecycle and local service-health buckets, aggregate resource/outcome counts, feature flags, and content-free Patrol, Assistant, and capability-API usage counters")+ Msg("Outbound usage telemetry enabled: sends a rotating pseudonymous install ID, version identity, coarse lifecycle and local service-health buckets, aggregate resource/outcome counts, feature flags, content-free Patrol, Assistant, capability-API, and session-deduplicated workload-history adoption counters")r.wg.Add(1)go func() {@@ -1194,6 +1214,10 @@ func applySnapshot(base Ping, fn SnapshotFunc) Ping {ping.UpdateLastFailureCategory = s.UpdateLastFailureCategoryping.NodeTestAttempts30d = s.NodeTestAttempts30dping.NodeTestFailures30d = s.NodeTestFailures30d+ ping.WorkloadHistoryPreviewSessions30d = s.WorkloadHistoryPreviewSessions30d+ ping.WorkloadHistoryScrubSessions30d = s.WorkloadHistoryScrubSessions30d+ ping.WorkloadHistoryRangeChangeSessions30d = s.WorkloadHistoryRangeChangeSessions30d+ ping.WorkloadHistoryDetailsSelectionSessions30d = s.WorkloadHistoryDetailsSelectionSessions30dping.AuthConfigured = s.AuthConfiguredping.ConfiguredConnections = s.ConfiguredConnectionsping.AlertsFired30d = s.AlertsFired30ddiff --git a/internal/telemetry/telemetry_test.go b/internal/telemetry/telemetry_test.goindex 9c27c33445..70aeaa5c25 100644--- a/internal/telemetry/telemetry_test.go+++ b/internal/telemetry/telemetry_test.go@@ -727,7 +727,7 @@ func TestTelemetryPrivacyDocsDisclosePseudonymousIdentityAndIPHandling(t *testin"outbound usage telemetry","enabled by default","rotating pseudonymous install ID",- "Pulse does not send browser events or an event-level clickstream",+ "Pulse does not send raw browser events or an event-level clickstream","Lifecycle and outcome signals are deliberately limited to closed buckets, booleans, and aggregate counts","PULSE_TELEMETRY=false","The license server uses request IP addresses transiently for abuse/rate limiting",diff --git a/pkg/server/server.go b/pkg/server/server.goindex ecffa44a24..d176f7be87 100644--- a/pkg/server/server.go+++ b/pkg/server/server.go@@ -668,6 +668,7 @@ func Run(ctx context.Context, version string) (runErr error) {if router != nil {router.ApplyUpdateTelemetrySnapshot(&snap, now)router.ApplyLicensedFeatureTelemetrySnapshot(&snap, now)+ router.ApplyWorkloadHistoryTelemetrySnapshot(&snap, now)}applyNodeTestTelemetrySnapshot(&snap, telemetryPersistence, now)var actionSnapshot telemetry.PulseIntelligenceActionSnapshot