Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Clarify monitored-system admission freeze posture

rcourtman6c1364ef5409
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 653ace6b0f..441de4a7bc 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -456,6 +456,11 @@ needs them, but `/api/license/commercial-posture`,
public demo mode and those lifecycle flows must not depend on licensed
identity, plan labels, upgrade reasons, checkout handoff state, or observed
usage counts surviving the public-demo contract.
+That same demo-safe runtime contract now also redacts monitored-system
+capacity posture from public-preview runtime capabilities. Lifecycle-adjacent
+install or reporting surfaces may still depend on demo-safe capability flags,
+but they must not expect `monitored_system_capacity`, admission-freeze copy,
+or observed plan overage posture to survive the public-demo boundary.
That same demo-hidden API boundary also keeps runtime-admin operations out of
public lifecycle flows: `/api/diagnostics`,
`/api/diagnostics/docker/prepare-token`, and `/api/logs/*` must return `404`
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 6ca23bd207..300ccfd035 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -187,27 +187,27 @@ when the disabled candidate no longer counts toward monitored-system capacity.
and the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` and `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` cards' infrastructure resource-link default, so the Patrol page, resource drawer, and problem-resource dashboard panels inherit the canonical resource-filter path construction instead of rebuilding infrastructure URLs inline
and the Patrol runtime-remediation destination shared with `/api/settings/ai`, so summary actions and runtime-finding actions may reuse the governed provider-settings route while still presenting that destination to Patrol operators as Patrol provider configuration instead of generic `AI Settings` copy
and the Patrol route-shell destination itself, so the thin page shell at `frontend-modern/src/pages/AIIntelligence.tsx` may continue to bridge the shared AI-runtime payload boundary while exposing `/patrol` as the canonical product route and preserving `/ai` only as a compatibility redirect
-8. Route frontend API-client parsed error propagation, API-error-status fallback handling, allowed-status handling, custom status-specific error handling, command-trigger success envelope handling, shared response parsing pipelines, missing-resource lookup handling, metadata CRUD routing, stream event consumption, response status, collection normalization, scalar payload coercion, and structured error normalization through canonical shared helpers under `frontend-modern/src/api/`
-9. Add or change API token scope, assignment, and revocation presentation through `frontend-modern/src/components/Settings/APITokenManager.tsx`, `frontend-modern/src/components/Settings/apiTokenManagerModel.ts`, and `frontend-modern/src/components/Settings/useAPITokenManagerState.ts`
-10. Add or change infrastructure operations token generation, lookup, assignment, the pure unified-agent inventory/install model, the split infrastructure install/reporting state owners, the split direct-node/discovery infrastructure settings owners, the shared infrastructure-operations state provider/context shell, and reporting/install presentation through `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`, `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`, `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`, `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`, `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`, `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`, and `frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx`
-11. Keep `internal/api/session_store.go` on a fail-closed auth-persistence boundary: persisted OIDC refresh tokens may only round-trip through encrypted-at-rest session payloads, and any missing-crypto or invalid-ciphertext path must drop the token instead of preserving plaintext-at-rest session state.
-12. Keep tenant AI handler wiring on canonical provider ownership: `internal/api/ai_handlers.go` may wire tenant `ReadState` and tenant-scoped unified-resource providers into AI services, but it must not revive tenant snapshot-provider bridges once Patrol can initialize and verify from those canonical providers directly.
-13. Keep Patrol status transport semantics explicit in that same AI handler layer: the Patrol status endpoint must carry machine-readable runtime availability such as blocked, running, disabled, active, or unavailable rather than asking frontend consumers to infer operator state from stale summaries or run history.
-14. Keep Patrol quickstart transport semantics explicit as well: zero remaining quickstart credits are inventory data, not a standalone runtime-state override, so frontend consumers may only present the exhausted quickstart warning when the payload still reports `using_quickstart` or a runtime state that is blocked by quickstart exhaustion.
-15. Keep Patrol intelligence summary transport semantics single-voiced: the canonical overall-health payload and Patrol run-history payload together must support one primary assessment plus one explicit verification explanation, and frontend consumers must not need to derive a second compact assessment or verification verdict row from the same payloads beneath the primary summary card.
-16. Keep Pulse Mobile relay credential minting and permission ownership on backend ownership: `internal/api/router_routes_auth_security.go`, `internal/api/security_tokens.go`, `internal/api/auth.go`, `internal/api/relay_mobile_capability.go`, `internal/api/router_routes_ai_relay.go`, and `frontend-modern/src/api/security.ts` may expose the canonical mobile runtime token creator and governed route gates, but browser callers must only consume that route and must not define the mobile runtime scope, compatibility gate list, route inventory, or token-purpose metadata locally.
-17. Keep hosted tenant browser-session precedence on the shared auth boundary: `internal/api/auth.go`, `internal/api/contract_test.go`, and hosted tenant callers must treat a valid `pulse_session` as authoritative before any API-only token fallback or no-local-auth anonymous fallback, so cloud handoff can continue into protected hosted routes without flattening the operator back to `anonymous` or forcing a browser session through bearer-token-only mode after the tenant has minted API tokens.
-18. Keep tenant settings-scope authorization aligned with org management: `internal/api/security_setup_fix.go`, `internal/api/contract_test.go`, and settings-bound hosted callers must allow the current non-default org owner/admin membership to exercise privileged tenant routes, rather than requiring a separate configured local admin identity after hosted handoff.
-19. Keep mobile onboarding payload reads aligned with the server-owned relay-mobile credential: `internal/api/router_routes_ai_relay.go`, `internal/api/onboarding_handlers.go`, and `internal/api/contract_test.go` must allow the dedicated `relay:mobile:access` scope to reach the governed QR, deep-link, and connection-validation payloads without reintroducing a broader `settings:read` requirement for token-authenticated pairing clients.
-20. Keep hosted billing-state quickstart payload fields on the shared API contract: `internal/api/hosted_entitlement_refresh.go`, `internal/api/subscription_state_handlers.go`, and `internal/api/contract_test.go` must preserve `quickstart_credits_granted`, `quickstart_credits_used`, and `quickstart_credits_granted_at` through hosted signup, hosted lease refresh, and billing-state reads instead of letting lease rewrites silently erase seeded quickstart inventory.
-21. Keep hosted AI settings bootstrap on the shared API contract: `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handlers.go`, `internal/api/ai_handler.go`, and `internal/api/contract_test.go` must treat a missing `ai.enc` in hosted mode as a canonical bootstrap condition, persist one machine-owned quickstart-backed AI config with the Pulse-owned alias `quickstart:pulse-hosted` when hosted entitlements grant AI capability, and preserve that configured settings payload as the same public contract that Chat, Patrol, and AI Settings consume instead of embedding a third-party model ID in the transport contract.
+9. Route frontend API-client parsed error propagation, API-error-status fallback handling, allowed-status handling, custom status-specific error handling, command-trigger success envelope handling, shared response parsing pipelines, missing-resource lookup handling, metadata CRUD routing, stream event consumption, response status, collection normalization, scalar payload coercion, and structured error normalization through canonical shared helpers under `frontend-modern/src/api/`
+10. Add or change API token scope, assignment, and revocation presentation through `frontend-modern/src/components/Settings/APITokenManager.tsx`, `frontend-modern/src/components/Settings/apiTokenManagerModel.ts`, and `frontend-modern/src/components/Settings/useAPITokenManagerState.ts`
+11. Add or change infrastructure operations token generation, lookup, assignment, the pure unified-agent inventory/install model, the split infrastructure install/reporting state owners, the split direct-node/discovery infrastructure settings owners, the shared infrastructure-operations state provider/context shell, and reporting/install presentation through `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`, `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`, `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`, `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`, `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`, `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`, and `frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx`
+12. Keep `internal/api/session_store.go` on a fail-closed auth-persistence boundary: persisted OIDC refresh tokens may only round-trip through encrypted-at-rest session payloads, and any missing-crypto or invalid-ciphertext path must drop the token instead of preserving plaintext-at-rest session state.
+13. Keep tenant AI handler wiring on canonical provider ownership: `internal/api/ai_handlers.go` may wire tenant `ReadState` and tenant-scoped unified-resource providers into AI services, but it must not revive tenant snapshot-provider bridges once Patrol can initialize and verify from those canonical providers directly.
+14. Keep Patrol status transport semantics explicit in that same AI handler layer: the Patrol status endpoint must carry machine-readable runtime availability such as blocked, running, disabled, active, or unavailable rather than asking frontend consumers to infer operator state from stale summaries or run history.
+15. Keep Patrol quickstart transport semantics explicit as well: zero remaining quickstart credits are inventory data, not a standalone runtime-state override, so frontend consumers may only present the exhausted quickstart warning when the payload still reports `using_quickstart` or a runtime state that is blocked by quickstart exhaustion.
+16. Keep Patrol intelligence summary transport semantics single-voiced: the canonical overall-health payload and Patrol run-history payload together must support one primary assessment plus one explicit verification explanation, and frontend consumers must not need to derive a second compact assessment or verification verdict row from the same payloads beneath the primary summary card.
+17. Keep Pulse Mobile relay credential minting and permission ownership on backend ownership: `internal/api/router_routes_auth_security.go`, `internal/api/security_tokens.go`, `internal/api/auth.go`, `internal/api/relay_mobile_capability.go`, `internal/api/router_routes_ai_relay.go`, and `frontend-modern/src/api/security.ts` may expose the canonical mobile runtime token creator and governed route gates, but browser callers must only consume that route and must not define the mobile runtime scope, compatibility gate list, route inventory, or token-purpose metadata locally.
+18. Keep hosted tenant browser-session precedence on the shared auth boundary: `internal/api/auth.go`, `internal/api/contract_test.go`, and hosted tenant callers must treat a valid `pulse_session` as authoritative before any API-only token fallback or no-local-auth anonymous fallback, so cloud handoff can continue into protected hosted routes without flattening the operator back to `anonymous` or forcing a browser session through bearer-token-only mode after the tenant has minted API tokens.
+19. Keep tenant settings-scope authorization aligned with org management: `internal/api/security_setup_fix.go`, `internal/api/contract_test.go`, and settings-bound hosted callers must allow the current non-default org owner/admin membership to exercise privileged tenant routes, rather than requiring a separate configured local admin identity after hosted handoff.
+20. Keep mobile onboarding payload reads aligned with the server-owned relay-mobile credential: `internal/api/router_routes_ai_relay.go`, `internal/api/onboarding_handlers.go`, and `internal/api/contract_test.go` must allow the dedicated `relay:mobile:access` scope to reach the governed QR, deep-link, and connection-validation payloads without reintroducing a broader `settings:read` requirement for token-authenticated pairing clients.
+21. Keep hosted billing-state quickstart payload fields on the shared API contract: `internal/api/hosted_entitlement_refresh.go`, `internal/api/subscription_state_handlers.go`, and `internal/api/contract_test.go` must preserve `quickstart_credits_granted`, `quickstart_credits_used`, and `quickstart_credits_granted_at` through hosted signup, hosted lease refresh, and billing-state reads instead of letting lease rewrites silently erase seeded quickstart inventory.
+22. Keep hosted AI settings bootstrap on the shared API contract: `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handlers.go`, `internal/api/ai_handler.go`, and `internal/api/contract_test.go` must treat a missing `ai.enc` in hosted mode as a canonical bootstrap condition, persist one machine-owned quickstart-backed AI config with the Pulse-owned alias `quickstart:pulse-hosted` when hosted entitlements grant AI capability, and preserve that configured settings payload as the same public contract that Chat, Patrol, and AI Settings consume instead of embedding a third-party model ID in the transport contract.
That same hosted bootstrap surface must also preserve the secure quickstart-identity contract: hosted or trial-backed AI settings reads and enablement may bootstrap Patrol quickstart from the effective signed entitlement lease when no self-hosted installation token exists, but they must not fabricate installation-scoped activation state or anonymous client identity to satisfy `/v1/quickstart/bootstrap`.
-22. Keep post-boot AI enablement contract-backed on the shared AI/mobile approval surface: `internal/api/ai_handler.go`, `internal/api/ai_handlers.go`, `internal/api/router_routes_ai_relay.go`, and `internal/api/contract_test.go` must turn the governed approvals-list API into the canonical empty-list payload as soon as settings-driven AI enablement succeeds, rather than leaving that surface on `503 Approval store not initialized` until some separate startup-only side effect happens.
-23. Keep infrastructure summary chart transport contract-backed on the shared API surface: `internal/api/router.go`, `internal/api/contract_test.go`, and frontend infrastructure summary consumers must normalize long-range mixed-cadence history into equal-time summary buckets before shipping the infrastructure charts API payload, so 7-day and 30-day summary cards do not expose compressed right-edge tails just because recent samples arrive at a finer storage resolution.
-24. Keep long-range workload chart transport time-proportional on the shared API surface: `internal/api/router.go`, `internal/api/contract_test.go`, and workload chart consumers must cap mixed-cadence workload history by equal-time buckets rather than raw point index for the per-workload and aggregate workload chart APIs, so 7-day and 30-day workload cards do not bunch recent samples at the right edge just because recent telemetry is stored more densely.
-25. Keep chart timestamp precision canonical on that same shared API surface: when `internal/api/router.go` serializes monitoring history into infrastructure or workload chart payloads, it must preserve canonical millisecond timestamps from the shared monitoring timeline instead of rounding through whole-second conversion, so seeded mock history and live appends collapse onto one operator-visible timeline instead of appearing as duplicated tail samples.
-26. Keep storage chart identity canonical on that same shared API surface: the shared storage charts endpoint must key pool and physical-disk series by the resolved unified-resource `MetricsTarget.ResourceID`, not by canonical resource IDs or page-local aliases, so storage rows, focused summary cards, sticky summary shells, and detail charts all address the same history series in live and mock mode.
-27. Keep synthetic summary-chart fallback identity canonical on that same shared API surface: when `internal/api/router.go` has to synthesize mock summary history for infrastructure, workloads, or storage cards, it must derive the fallback from canonical `resourceType`, `resourceID`, and `metricType` ownership instead of raw min/max seed-prefix helpers, so range changes and runtime mock updates stay on one governed timeline.
+23. Keep post-boot AI enablement contract-backed on the shared AI/mobile approval surface: `internal/api/ai_handler.go`, `internal/api/ai_handlers.go`, `internal/api/router_routes_ai_relay.go`, and `internal/api/contract_test.go` must turn the governed approvals-list API into the canonical empty-list payload as soon as settings-driven AI enablement succeeds, rather than leaving that surface on `503 Approval store not initialized` until some separate startup-only side effect happens.
+24. Keep infrastructure summary chart transport contract-backed on the shared API surface: `internal/api/router.go`, `internal/api/contract_test.go`, and frontend infrastructure summary consumers must normalize long-range mixed-cadence history into equal-time summary buckets before shipping the infrastructure charts API payload, so 7-day and 30-day summary cards do not expose compressed right-edge tails just because recent samples arrive at a finer storage resolution.
+25. Keep long-range workload chart transport time-proportional on the shared API surface: `internal/api/router.go`, `internal/api/contract_test.go`, and workload chart consumers must cap mixed-cadence workload history by equal-time buckets rather than raw point index for the per-workload and aggregate workload chart APIs, so 7-day and 30-day workload cards do not bunch recent samples at the right edge just because recent telemetry is stored more densely.
+26. Keep chart timestamp precision canonical on that same shared API surface: when `internal/api/router.go` serializes monitoring history into infrastructure or workload chart payloads, it must preserve canonical millisecond timestamps from the shared monitoring timeline instead of rounding through whole-second conversion, so seeded mock history and live appends collapse onto one operator-visible timeline instead of appearing as duplicated tail samples.
+27. Keep storage chart identity canonical on that same shared API surface: the shared storage charts endpoint must key pool and physical-disk series by the resolved unified-resource `MetricsTarget.ResourceID`, not by canonical resource IDs or page-local aliases, so storage rows, focused summary cards, sticky summary shells, and detail charts all address the same history series in live and mock mode.
+28. Keep synthetic summary-chart fallback identity canonical on that same shared API surface: when `internal/api/router.go` has to synthesize mock summary history for infrastructure, workloads, or storage cards, it must derive the fallback from canonical `resourceType`, `resourceID`, and `metricType` ownership instead of raw min/max seed-prefix helpers, so range changes and runtime mock updates stay on one governed timeline.
The same compact chart boundary also owns aggregate-only storage summary
transport. `/api/charts/storage-summary` may batch only the canonical
`used` and `avail` storage series required for the aggregate capacity
@@ -217,31 +217,31 @@ when the disabled candidate no longer counts toward monitored-system capacity.
When mock mode is active, that same endpoint must come from the
monitor-owned aggregate summary cache rather than rehydrating each pool
chart on request.
-28. Keep workload-chart response identity canonical on that same shared API surface: `internal/api/router.go`, `internal/api/contract_test.go`, and workload summary consumers must emit provider-backed VM and system-container series under the same canonical workload IDs that workloads page rows use, while resolving history through the unified `MetricsTarget.ResourceID`, so hover and focus selection do not fall off for provider-backed rows.
+29. Keep workload-chart response identity canonical on that same shared API surface: `internal/api/router.go`, `internal/api/contract_test.go`, and workload summary consumers must emit provider-backed VM and system-container series under the same canonical workload IDs that workloads page rows use, while resolving history through the unified `MetricsTarget.ResourceID`, so hover and focus selection do not fall off for provider-backed rows.
Kubernetes pod workload rows follow that same contract through their
metrics target. `/api/resources` may expose pod history only through the
unified `MetricsTarget.ResourceID`, but that target must be the canonical
prefixed runtime key `k8s:<cluster>:pod:<uid>` and not the bare source pod
ID, so pod workload rows and pod chart payloads stay on one history series.
-29. Keep the hosted account portal bootstrap intelligible without duplicate
+30. Keep the hosted account portal bootstrap intelligible without duplicate
chrome. `internal/cloudcp/portal/page.go`, the maintained portal frontend
bundle, and the shared portal styles may refine layout density, but the
account/billing shell must remain understandable from the primary header,
section title, and factual body content alone instead of depending on a
second context-chip strip to restate the same scope.
-30. Keep storage wire metadata lossless across shared API payload types.
+31. Keep storage wire metadata lossless across shared API payload types.
`frontend-modern/src/types/api.ts` must continue to expose provider-backed
storage metadata such as Proxmox `pool` and `zfsPool` fields when the
backend emits them, instead of silently dropping that detail from the
shared runtime contract.
-31. Keep hosted entitlement refresh ownership on the same governed API contract
+32. Keep hosted entitlement refresh ownership on the same governed API contract
as hosted status and entitlements reads. `internal/api/licensing_handlers.go`,
`internal/api/hosted_entitlement_refresh.go`, and
`internal/api/contract_test.go` must resolve the effective hosted billing
target before refresh, persistence, and evaluator rewiring, so tenant-
scoped hosted routes cannot refresh against an empty non-default org while
the machine's real hosted lease still lives on `default`.
-32. Keep public demo bootstrap posture on the shared security-status contract.
+33. Keep public demo bootstrap posture on the shared security-status contract.
`internal/api/router_routes_auth_security.go`,
`internal/api/security_status_capabilities.go`, frontend security-status
consumers, and shared demo-mode stores must treat
@@ -253,7 +253,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
the store boundary, so public demo shells do not probe `/api/ai/approvals`
or `/api/ai/remediation/plans` after the read-only demo posture is already
known.
-33. Keep public demo commercial posture middleware-owned on that same shared
+34. Keep public demo commercial posture middleware-owned on that same shared
API contract. `internal/api/demo_middleware.go`,
`internal/api/demo_mode_commercial.go`,
`internal/api/subscription_entitlements.go`, and
@@ -265,7 +265,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
hidden. Upgrade prompts, trial nudges, monitored-system migration guidance,
usage counts, billing identity, and plan metadata must therefore not depend
on hidden commercial routes surviving the public demo boundary.
-34. Keep the storage summary route in `internal/api/router.go` as the
+35. Keep the storage summary route in `internal/api/router.go` as the
canonical storage summary contract across dashboard and storage consumers.
`internal/api/router.go`,
`internal/api/contract_test.go`, and shared frontend consumers must expose
@@ -273,7 +273,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
metrics-target IDs, preserve millisecond chart timestamps, and avoid
reconstructing storage summary behavior from per-pool
`/api/metrics-store/history` fan-out.
-35. Keep infrastructure summary metric filtering canonical on that same shared
+36. Keep infrastructure summary metric filtering canonical on that same shared
API surface. `frontend-modern/src/api/charts.ts`,
`internal/api/router_routes_monitoring.go`, `internal/api/router.go`,
`internal/api/types.go`, and `internal/api/contract_test.go` must route
@@ -284,7 +284,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
metric filters through the shared guest-chart batch loader in
`internal/monitoring/monitor_metrics.go` instead of fetching the full guest
metric set and trimming after the API payload is already assembled.
-36. Keep the compact dashboard overview route canonical on that same shared API
+37. Keep the compact dashboard overview route canonical on that same shared API
surface. `internal/api/resources.go`,
`internal/api/router_routes_monitoring.go`,
`frontend-modern/src/api/resources.ts`,
@@ -294,7 +294,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
through `/api/resources/dashboard-summary` instead of reconstructing that
shell from the paginated `/api/resources` list payload or guessing how
dashboard trend identities map onto infrastructure chart series.
-37. Keep mock and demo chart reads on the same canonical unified snapshot as
+38. Keep mock and demo chart reads on the same canonical unified snapshot as
the rest of the API surface. `internal/api/router.go`,
`internal/api/contract_test.go`, and chart consumers must route
`/api/charts`, `/api/charts/infrastructure`, and `/api/storage-charts`
@@ -392,29 +392,29 @@ when the disabled candidate no longer counts toward monitored-system capacity.
defaults.
10. Treat Patrol summary supporting metrics as readouts, not reinterpretations: when frontend consumers derive cards such as active findings, criticals, warnings, or fixes from the canonical payloads, those cards must stay numeric and must not synthesize new assessment labels like `Issues detected` or verification labels like `Partial verification` beneath the primary summary contract
11. Treat active Patrol runtime transport as compatible with factual activity surfaces: when the runtime is currently running, frontend consumers may surface in-progress activity context, but they must not replace the activity strip with a second assessment verdict derived from runtime state alone
-11. Treat Patrol recency as a singular transport-driven fact: once header metadata, verification copy, or the findings footer already present the governed Patrol timing context, frontend summary consumers must not derive an extra timing pill from the same payloads inside the primary summary card
-12. Treat Patrol findings counts as a singular supporting surface as well: when the summary shell already exposes count cards for active findings, warnings, criticals, and fixes, the primary assessment card must not repeat those same payload-derived counts as secondary badges
-13. Treat Patrol schedule and recency as header-owned metadata on the main Patrol page: findings empty-state consumers should not receive or restate `next_patrol_at`, `last_patrol_at`, `last_activity_at`, or interval timing once those transport fields are already presented by the primary header and verification shell
-14. Keep recovery payload filters canonical across `/api/recovery/rollups`, `/api/recovery/points`, `/api/recovery/series`, and `/api/recovery/facets`: when `internal/api/recovery_handlers.go` adds a governed recovery filter or display field such as provider-neutral `itemType`, the same normalized transport must land across all four endpoints and the contract tests must pin both outbound payload shape and accepted query aliases in the same slice
-15. Keep recovery platform-query vocabulary canonical across that same `/api/recovery/*` surface: operator-facing transport must emit `platform` as the canonical query field, accepted legacy `provider` aliases must remain compatibility-only input, and `internal/api/contract_test.go` must pin that fallback behavior in the same slice as any handler change
-16. Keep recovery payload platform vocabulary canonical across that same `/api/recovery/*` surface: point payloads must expose `platform`, rollup payloads must expose `platforms`, and any compatibility `provider` / `providers` aliases must remain secondary fallback fields rather than replacing the shared response model
-17. Keep recovery linked-resource vocabulary canonical across that same `/api/recovery/*` surface: points and rollups must expose `itemResourceId` as the canonical linked-resource field, accepted legacy `subjectResourceId` aliases must remain compatibility-only input or secondary payload fields, and the shared proof surface must pin that normalization in the same slice as any handler change
-18. Keep recovery external item-reference vocabulary canonical across that same `/api/recovery/*` surface: point and rollup payloads must expose `itemRef` as the canonical external item-reference field, accepted legacy `subjectRef` aliases must remain compatibility-only secondary payload fields, and the shared proof surface must pin that normalization in the same slice as any handler change
-19. Keep first-host lookup completion explicit on the shared install-state API
+12. Treat Patrol recency as a singular transport-driven fact: once header metadata, verification copy, or the findings footer already present the governed Patrol timing context, frontend summary consumers must not derive an extra timing pill from the same payloads inside the primary summary card
+13. Treat Patrol findings counts as a singular supporting surface as well: when the summary shell already exposes count cards for active findings, warnings, criticals, and fixes, the primary assessment card must not repeat those same payload-derived counts as secondary badges
+14. Treat Patrol schedule and recency as header-owned metadata on the main Patrol page: findings empty-state consumers should not receive or restate `next_patrol_at`, `last_patrol_at`, `last_activity_at`, or interval timing once those transport fields are already presented by the primary header and verification shell
+15. Keep recovery payload filters canonical across `/api/recovery/rollups`, `/api/recovery/points`, `/api/recovery/series`, and `/api/recovery/facets`: when `internal/api/recovery_handlers.go` adds a governed recovery filter or display field such as provider-neutral `itemType`, the same normalized transport must land across all four endpoints and the contract tests must pin both outbound payload shape and accepted query aliases in the same slice
+16. Keep recovery platform-query vocabulary canonical across that same `/api/recovery/*` surface: operator-facing transport must emit `platform` as the canonical query field, accepted legacy `provider` aliases must remain compatibility-only input, and `internal/api/contract_test.go` must pin that fallback behavior in the same slice as any handler change
+17. Keep recovery payload platform vocabulary canonical across that same `/api/recovery/*` surface: point payloads must expose `platform`, rollup payloads must expose `platforms`, and any compatibility `provider` / `providers` aliases must remain secondary fallback fields rather than replacing the shared response model
+18. Keep recovery linked-resource vocabulary canonical across that same `/api/recovery/*` surface: points and rollups must expose `itemResourceId` as the canonical linked-resource field, accepted legacy `subjectResourceId` aliases must remain compatibility-only input or secondary payload fields, and the shared proof surface must pin that normalization in the same slice as any handler change
+19. Keep recovery external item-reference vocabulary canonical across that same `/api/recovery/*` surface: point and rollup payloads must expose `itemRef` as the canonical external item-reference field, accepted legacy `subjectRef` aliases must remain compatibility-only secondary payload fields, and the shared proof surface must pin that normalization in the same slice as any handler change
+20. Keep first-host lookup completion explicit on the shared install-state API
boundary: when
`frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`
receives a successful connected-agent lookup result, the canonical install
flow must expose direct navigation into `/dashboard` and
`/settings/infrastructure/operations` rather than leaving the operator on a
transport-only status readout.
-20. Keep the shared first-host detection contract explicit on `/api/state` as
+21. Keep the shared first-host detection contract explicit on `/api/state` as
used by
`frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`:
the canonical `connectedInfrastructure` projection must stay suitable for
detecting the first active reporting system during install so brand-new
operators can receive the first success handoff without typing a hostname
or agent ID.
-21. Keep the shared first-run install-token transport explicit on
+22. Keep the shared first-run install-token transport explicit on
`/api/security/tokens` as used by
`frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`:
once quick setup has produced the setup handoff credentials, the canonical
@@ -425,7 +425,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
install-state surface must describe that prepared token path consistently
with the live runtime behavior rather than directing the operator to create
another install token manually.
-22. Keep connected-infrastructure surface vocabulary canonical across the
+23. Keep connected-infrastructure surface vocabulary canonical across the
shared `/api/state` and reporting/install consumers:
`frontend-modern/src/types/api.ts` must treat `truenas` as a first-class
connected-infrastructure surface kind, and connected-infrastructure
@@ -437,14 +437,14 @@ when the disabled candidate no longer counts toward monitored-system capacity.
(`agent`, `docker`, `kubernetes`) and platform-connections-managed
surfaces (`proxmox`, `pbs`, `pmg`, `truenas`) instead of collapsing them
into one uninstall/stop-monitoring model.
-23. Keep AI settings payload continuity explicit on the shared `/api/settings/ai`
+24. Keep AI settings payload continuity explicit on the shared `/api/settings/ai`
surface: `internal/api/ai_handlers.go` and `internal/api/contract_test.go`
must expose masked provider-auth state such as `ollama_username` and
`ollama_password_set` without echoing raw stored secrets, and the same
backend contract must keep provider test routes bound to the selected
provider's configured model instead of whichever other provider currently
owns the default `model` field.
-24. Keep shared AI runtime reads centralized on that same governed contract:
+25. Keep shared AI runtime reads centralized on that same governed contract:
`frontend-modern/src/stores/aiRuntimeState.ts` is the canonical frontend
read owner for `/api/settings/ai` and `/api/ai/models`. AI-owned consumers
such as `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`,
@@ -459,7 +459,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
store after an owned settings mutation, but they must not reintroduce
page-local mount loops that fetch `/api/settings/ai` or `/api/ai/models`
separately for chat, Patrol, and cost/budget views.
-23. Keep API-backed first-target onboarding canonical on that same shared
+26. Keep API-backed first-target onboarding canonical on that same shared
infrastructure-settings boundary:
`frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`,
`frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`,
@@ -473,7 +473,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
route API-backed first systems to `/settings/infrastructure/platforms`
instead of implying that a host install command is required before those
platforms can report into Pulse.
-24. Keep shared install-script fallback transport pinned to published release
+27. Keep shared install-script fallback transport pinned to published release
lineage. `internal/api/unified_agent.go` and
`internal/api/contract_test.go` must only map stable tags or explicit RC
prerelease tags without build metadata to GitHub install-script release
@@ -481,7 +481,7 @@ when the disabled candidate no longer counts toward monitored-system capacity.
`+git...` builds, and other unpublished prerelease identifiers must fail
closed on that API boundary instead of generating fake release URLs from
a local runtime version string.
-23. Keep local trial-start transport explicit on the shared commercial API
+28. Keep local trial-start transport explicit on the shared commercial API
boundary: `/api/license/trial/start` must preserve the hosted-signup
redirect contract as `409 trial_signup_required` during the allowed retry
burst, then return `429 trial_rate_limited` with the actual remaining
@@ -490,19 +490,19 @@ when the disabled candidate no longer counts toward monitored-system capacity.
self-serve verification failures may render owned HTML, but they must
preserve originating Pulse context instead of collapsing into generic
control-plane failures.
-24. Keep `/api/security/dev/reset-first-run` transport-backed and genuinely
+29. Keep `/api/security/dev/reset-first-run` transport-backed and genuinely
unauthenticated: when the dev reset route clears first-run auth it must
also clear any env-backed auth state that feeds `/api/security/status`, so
the status payload flips `hasAuthentication` to `false`, preserves
`bootstrapTokenPath`, and allows browser-owned first-session proof to
re-enter the real setup wizard instead of silently falling back to an
authenticated dashboard state.
-22. Keep shared SSO test and metadata-preview transport fail-closed: SAML
+30. Keep shared SSO test and metadata-preview transport fail-closed: SAML
metadata URLs and OIDC issuer URLs must reject non-HTTP or userinfo-bearing
inputs before any outbound request is attempted, and OIDC discovery must
append `/.well-known/openid-configuration` beneath the configured issuer
base path instead of resetting to the origin root.
-25. Keep config-archive import reloads fail-closed on the shared API/runtime
+31. Keep config-archive import reloads fail-closed on the shared API/runtime
boundary. `internal/api/config_export_import_handlers.go`,
`internal/api/contract_test.go`, and adjacent config/runtime helpers must
tolerate absent notification managers and other optional runtime managers
@@ -610,6 +610,13 @@ That same SSO boundary also owns manual SAML endpoint validation payloads.
through the same validated absolute HTTP(S) helpers instead of letting the
manual logout URL drift out of the request model or bypass the governed URL
normalization path.
+That same runtime SSO contract also owns the Pulse-side public URL that feeds
+SAML service-provider metadata and auth requests. `internal/api/saml_handlers.go`,
+`internal/api/saml_service.go`, and the SAML regression tests must rebind
+previously initialized SAML providers to the current configured `PublicURL`
+before metadata or browser login flows emit SP entity, ACS, or metadata URLs,
+so a stale startup-time blank/relative base URL cannot leak back into runtime
+metadata or auth request generation once the canonical external URL is known.
That same SSO API boundary also owns final browser redirect construction after
local auth handoff. OIDC and SAML success/error handlers must build their
local `returnTo` targets through one canonical local-path helper that rejects
@@ -1402,7 +1409,7 @@ and clipboard transport.
That same shared `InfrastructureOperationsController.tsx` boundary now also consumes the canonical
`connectedInfrastructure` projection from the backend state contract instead of
reconstructing reporting rows by merging raw unified-resource facets and
-removed-* arrays in the browser. v6 clients no longer receive those removed-*
+removed-_ arrays in the browser. v6 clients no longer receive those removed-_
arrays at all for this surface; Connected infrastructure row
identity, reporting-surface labels, and ignore/reconnect scope must be owned
by the backend payload contract, with frontend rendering limited to
@@ -1448,6 +1455,15 @@ resolved, those API contracts must fail closed for net-new admissions rather
than serializing a fake zero. `/api/license/entitlements` therefore carries
limit-level `current_available` truth so clients can distinguish unavailable
monitored-system usage from a real `current: 0`.
+That same entitlement family now also owns the canonical monitored-system
+capacity posture. `/api/license/runtime-capabilities`,
+`/api/license/commercial-posture`, and `/api/license/entitlements` must expose
+`monitored_system_capacity` with one shared admission model:
+`usage_unavailable`, `unlimited`, `within_limit`, `at_limit_blocking_new`, or
+`over_limit_frozen`. That contract must state whether new monitored systems are
+blocked and whether existing monitoring continues, so browser surfaces stop
+guessing from raw `current / limit` math or inventing a hard-cap model that
+the backend does not enforce.
That same contract now also owns migrated legacy continuity. When a supported
v5 license auto-exchanges or is activated manually in v6, `/api/license/status`
and `/api/license/entitlements` must surface `max_monitored_systems` from the
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 5ba67dbc3f..03d4b09063 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -99,11 +99,11 @@ agreement, and cloud-specific enforcement rules.
dev build metadata, or anonymous telemetry.
4. `internal/api/payments_webhook_handlers.go` shared with `api-contracts`: commercial payment webhook handlers carry both API payload contract and cloud-paid billing boundary ownership.
5. `internal/api/public_signup_handlers.go` shared with `api-contracts`: hosted signup handlers carry both API payload contract and cloud-paid hosted provisioning boundary ownership.
-That shared monitored-system presentation boundary also owns disabled
-provider-connection copy. Commercial entitlement surfaces must treat canonical
-zero-delta and removal-only TrueNAS or VMware previews as non-consuming or
-capacity-freeing changes rather than warning users that a disabled connection
-still grows monitored-system usage.
+ That shared monitored-system presentation boundary also owns disabled
+ provider-connection copy. Commercial entitlement surfaces must treat canonical
+ zero-delta and removal-only TrueNAS or VMware previews as non-consuming or
+ capacity-freeing changes rather than warning users that a disabled connection
+ still grows monitored-system usage.
The real `pulse-pro` license-server legacy checkout issuance, recurring
renewals, manual issue, and legacy exchange flows are part of that same
@@ -187,8 +187,8 @@ the same active-at-snapshot rule as the live server before anyone sets
`ai_alerts`, `ai_autofix`, and `kubernetes_ai`, but the customer-facing
plan cards, highlights, and comparison rows must use the canonical product
vocabulary already exposed elsewhere in the commercial shell: `Pulse
- Patrol`, `Pulse Alert Analysis`, `Patrol Auto-Fix`, and `Kubernetes
- Insights`, rather than reviving generic `AI Patrol` or `AI ... analysis`
+Patrol`, `Pulse Alert Analysis`, `Patrol Auto-Fix`, and `Kubernetes
+Insights`, rather than reviving generic `AI Patrol` or `AI ... analysis`
branding inside self-hosted pricing surfaces.
## Forbidden Paths
@@ -1136,11 +1136,15 @@ capacity, `ProLicensePlanSection.tsx` may still open that disclosure by
default, but the same top-level-root definition must remain the canonical
counted-unit explanation rather than introducing a second plan-local wording.
The same boundary also owns the warning-banner shorthand: customer-facing
-monitored-system warnings should describe the current counted total in plain
-language such as `16 monitored systems currently counted`, and any Community
-overflow/setup-slot message must explain the included monitored systems plus the
-temporary setup slot in customer terms rather than compressing the contract
-into slash-style quota strings that imply Pulse is counting every child device.
+monitored-system warnings should describe the current admission posture in
+plain language, not just raw `current / limit` math. When a plan is full, copy
+must explain that existing monitoring continues while new monitored systems are
+blocked; when an installation is already above the current plan, copy must
+explain that Pulse is in an over-plan frozen state rather than implying a hard
+runtime blackout. Community overflow/setup-slot messaging must still explain
+the included monitored systems plus the temporary setup slot in customer terms
+rather than compressing the contract into slash-style quota strings that imply
+Pulse is counting every child device.
Those same billing-facing surfaces must also describe the commercial contract in
customer terms: monitored systems, plan limits, subscription status, and
license status. They must not revive legacy `installed-agent` wording or vague
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index e3d5ed0a40..6585f64ecb 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -202,7 +202,12 @@ work extends shared components instead of creating new local variants.
hiding and table-width sizing through shared classes plus HTML attributes,
not inline overflow or min-width styles.
3. Add feature-specific presentation only when no shared primitive should own it
-4. Add guardrail tests when a new shared pattern is introduced
+4. Add guardrail tests when a new shared pattern is introduced.
+ Shared monitored-system warning primitives must prove their admission-freeze
+ posture through the canonical `frontend-modern/src/utils/monitoredSystemPresentation.ts`
+ helper plus runtime `monitored_system_capacity` reads rather than
+ reconstructing raw `current / limit` slash math or `0 remaining` copy in
+ the banner shell, state owner, or shared model.
5. Keep shared platform-connections shell state on the reusable settings boundary: `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`, `frontend-modern/src/components/Settings/InfrastructurePlatformConnectionsSummaryCard.tsx`, and `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx` must continue to derive provider counts, availability, and shared subtab copy from one infrastructure-settings source instead of creating provider-local summary fetches or VMware-only shell vocabulary.
6. Keep shared storage feature presenters on canonical platform truth. When reusable storage presenters under `frontend-modern/src/features/storageBackups/` classify canonical resources for the shared storage route, API-backed virtualization datastores such as VMware must stay inventory-only datastores instead of inheriting PBS-specific backup-repository or protected-target copy from older fallback branches.
7. Keep shared source/platform vocabulary on the governed manifest boundary. `frontend-modern/src/utils/platformSupportManifest.generated.ts` must be the tracked frontend projection of `docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.json`, `frontend-modern/src/utils/platformSupportManifest.ts`, `frontend-modern/src/utils/sourcePlatforms.ts`, and `frontend-modern/src/utils/sourcePlatformOptions.ts` must consume that generated projection instead of embedding divergent future-label lists, setup/onboarding path allowlists, or presentation-only guesses, and `frontend-modern/scripts/canonical-platform-audit.mjs` must fail when the generated projection drifts from the governed manifest.
@@ -1715,6 +1720,14 @@ state or route selection back into the render shell. When the warning points at
Pulse Pro billing, the shared primitive must preserve distinct route-owned
arrivals for usage explanation vs upgrade intent instead of re-collapsing both
CTAs onto one generic billing href.
+That same shared warning boundary now also owns the monitored-system capacity
+posture vocabulary. Shared banners, plan summaries, and ledger headers must
+describe the canonical admission-freeze model from
+`monitored_system_capacity`: existing monitoring continues, new monitored
+systems block at the plan boundary, and over-plan posture is an explicitly
+frozen state. Shared primitives must not fall back to raw `current / limit`
+slash math or `0 remaining` wording that implies Pulse should retroactively
+black out already-monitored systems.
orchestration, tracking, or naming math back into the shared shell or
reintroducing banner-local monitored-system copy strings.
Shared frontend label-formatting helpers now also have an explicit owner here.
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 106d5acd68..c4ab49a121 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -554,6 +554,11 @@ reads for capability and history-retention truth, but
licensed identity, upgrade prompts, trial urgency, checkout handoff state, or
observed usage counts to remain present once the public-demo contract is
applied.
+That same runtime-safe exception now also redacts monitored-system capacity
+posture. Storage/recovery surfaces may keep demo-safe capability and retention
+truth from `/api/license/runtime-capabilities`, but they must not expect
+`monitored_system_capacity`, admission-freeze copy, or observed plan overage
+to survive the public-demo API boundary.
That same adjacent commercial boundary also owns one-time checkout-return
lookup. Storage and recovery may coexist with the shared purchase return routes
in the app shell, but they must not cache, derive, or replay the
diff --git a/frontend-modern/src/api/__tests__/license.test.ts b/frontend-modern/src/api/__tests__/license.test.ts
index ba3306bd74..be8020ab24 100644
--- a/frontend-modern/src/api/__tests__/license.test.ts
+++ b/frontend-modern/src/api/__tests__/license.test.ts
@@ -20,6 +20,17 @@ describe('LicenseAPI', () => {
limits: [],
hosted_mode: false,
max_history_days: 14,
+ monitored_system_capacity: {
+ mode: 'within_limit',
+ urgency: 'ok',
+ current: 4,
+ limit: 10,
+ current_available: true,
+ available_slots: 6,
+ overage: 0,
+ blocks_new_systems: false,
+ existing_monitoring_continues: true,
+ },
});
const result = await LicenseAPI.getRuntimeCapabilities();
@@ -28,6 +39,9 @@ describe('LicenseAPI', () => {
expect(result).toMatchObject({
capabilities: ['relay'],
max_history_days: 14,
+ monitored_system_capacity: {
+ mode: 'within_limit',
+ },
});
});
@@ -70,6 +84,18 @@ describe('LicenseAPI', () => {
effective_limit: 10,
capture_pending: true,
},
+ monitored_system_capacity: {
+ mode: 'usage_unavailable',
+ urgency: 'ok',
+ current: 0,
+ limit: 10,
+ current_available: false,
+ current_unavailable_reason: 'supplemental_inventory_unsettled',
+ available_slots: 0,
+ overage: 0,
+ blocks_new_systems: false,
+ existing_monitoring_continues: false,
+ },
});
const result = await LicenseAPI.getCommercialEntitlements();
@@ -79,6 +105,10 @@ describe('LicenseAPI', () => {
effective_limit: 10,
capture_pending: true,
});
+ expect(result.monitored_system_capacity).toMatchObject({
+ mode: 'usage_unavailable',
+ current_available: false,
+ });
expect(result.limits[0]).toMatchObject({
current_available: false,
current_unavailable_reason: 'supplemental_inventory_unsettled',
diff --git a/frontend-modern/src/api/license.ts b/frontend-modern/src/api/license.ts
index 9959f61e2b..7687b1ced4 100644
--- a/frontend-modern/src/api/license.ts
+++ b/frontend-modern/src/api/license.ts
@@ -54,12 +54,26 @@ export interface MonitoredSystemContinuityStatus {
captured_at?: number;
}
+export interface MonitoredSystemCapacityStatus {
+ mode: string;
+ urgency: string;
+ current: number;
+ limit: number;
+ current_available: boolean;
+ current_unavailable_reason?: string;
+ available_slots: number;
+ overage: number;
+ blocks_new_systems: boolean;
+ existing_monitoring_continues: boolean;
+}
+
// Mirrors internal/api/subscription_entitlements.go:RuntimeCapabilitiesPayload
export interface LicenseRuntimeCapabilities {
capabilities: string[];
limits: EntitlementLimitStatus[];
hosted_mode?: boolean;
max_history_days?: number;
+ monitored_system_capacity?: MonitoredSystemCapacityStatus;
}
// Mirrors internal/api/subscription_entitlements.go:CommercialPosturePayload
@@ -75,6 +89,7 @@ export interface LicenseCommercialPosture {
legacy_connections?: EntitlementLegacyConnections;
has_migration_gap?: boolean;
commercial_migration?: CommercialMigrationStatus;
+ monitored_system_capacity?: MonitoredSystemCapacityStatus;
}
// Mirrors internal/api/subscription_entitlements.go:EntitlementPayload
diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
index 445f21031e..55799e2e1f 100644
--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
@@ -15,15 +15,21 @@ import type {
MonitoredSystemLedgerEntry,
MonitoredSystemLedgerExplanationSurface,
} from '@/api/monitoredSystemLedger';
-import type { EntitlementLimitStatus, MonitoredSystemContinuityStatus } from '@/api/license';
+import type {
+ EntitlementLimitStatus,
+ MonitoredSystemCapacityStatus,
+ MonitoredSystemContinuityStatus,
+} from '@/api/license';
import { apiErrorCode, apiErrorDetailField } from '@/api/responseUtils';
import { getSimpleStatusIndicator } from '@/utils/status';
import { PulseLogoIcon } from '@/components/icons/PulseLogoIcon';
import {
formatMonitoredSystemGroupedSourcesLabel,
formatMonitoredSystemLedgerUnavailableMessage,
+ getMonitoredSystemLimitContextSummary,
formatMonitoredSystemLatestIncludedSignalSentence,
formatMonitoredSystemSurfaceAttribution,
+ getMonitoredSystemLimitUsageSummary,
getMonitoredSystemLimitUnavailableReason,
getMonitoredSystemLedgerErrorState,
getMonitoredSystemLedgerDescription,
@@ -34,6 +40,7 @@ import {
getMonitoredSystemCountingDetailsToggleLabel,
getMonitoredSystemLedgerPresentation,
isMonitoredSystemLimitUsageAvailable,
+ resolveMonitoredSystemCapacityStatus,
} from '@/utils/monitoredSystemPresentation';
import { MonitoredSystemDefinitionDisclosure } from '@/components/Commercial/MonitoredSystemDefinitionDisclosure';
import {
@@ -43,6 +50,7 @@ import {
interface MonitoredSystemLedgerPanelProps {
embedded?: boolean;
+ monitoredSystemCapacity?: MonitoredSystemCapacityStatus | null;
monitoredSystemContinuity?: MonitoredSystemContinuityStatus | null;
monitoredSystemLimit?: EntitlementLimitStatus | null;
showCountingRulesByDefault?: boolean;
@@ -120,19 +128,46 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
const hasLimit = () => limit() > 0;
const overLimit = () => hasLimit() && total() > limit();
const pct = () => usagePercent(total(), limit());
+ const displayLimit = createMemo<EntitlementLimitStatus | null>(() => {
+ if (ledger()) {
+ return {
+ key: 'max_monitored_systems',
+ limit: limit(),
+ current: total(),
+ current_available: true,
+ state: props.monitoredSystemCapacity?.urgency ?? props.monitoredSystemLimit?.state ?? '',
+ };
+ }
+ return props.monitoredSystemLimit ?? null;
+ });
+ const displayCapacity = createMemo(() =>
+ ledger()
+ ? resolveMonitoredSystemCapacityStatus(undefined, displayLimit())
+ : resolveMonitoredSystemCapacityStatus(props.monitoredSystemCapacity, displayLimit()),
+ );
+ const capacitySummary = createMemo(() =>
+ getMonitoredSystemLimitUsageSummary(displayLimit(), displayCapacity()),
+ );
+ const capacityContext = createMemo(() =>
+ getMonitoredSystemLimitContextSummary(displayLimit(), displayCapacity()),
+ );
const usageUnavailableReason = () => {
if (apiErrorCode(explanation.error) === 'monitored_system_usage_unavailable') {
return apiErrorDetailField(explanation.error, 'reason') ?? undefined;
}
if (!ledger()) {
- return getMonitoredSystemLimitUnavailableReason(props.monitoredSystemLimit);
+ return getMonitoredSystemLimitUnavailableReason(
+ props.monitoredSystemLimit,
+ props.monitoredSystemCapacity,
+ );
}
return undefined;
};
const usageUnavailable = () =>
!ledger() &&
(apiErrorCode(explanation.error) === 'monitored_system_usage_unavailable' ||
- !isMonitoredSystemLimitUsageAvailable(props.monitoredSystemLimit));
+ !isMonitoredSystemLimitUsageAvailable(props.monitoredSystemLimit) ||
+ displayCapacity()?.current_available === false);
const genericError = () => Boolean(explanation.error) && !usageUnavailable();
const continuity = () => props.monitoredSystemContinuity ?? null;
const hasContinuityContext = () => {
@@ -184,16 +219,25 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
/>
</div>
<Show when={ledger()}>
- <span
- class="text-sm font-medium"
- classList={{
- 'text-base-content': !overLimit(),
- 'text-red-600 dark:text-red-400': overLimit(),
- }}
- >
- {total()}
- <Show when={hasLimit()}>{` / ${limit()}`}</Show>
- </span>
+ <div class="text-right">
+ <p
+ class="text-sm font-medium"
+ classList={{
+ 'text-base-content':
+ displayCapacity()?.urgency !== 'warning' &&
+ displayCapacity()?.mode !== 'over_limit_frozen',
+ 'text-amber-700 dark:text-amber-300':
+ displayCapacity()?.urgency === 'warning' ||
+ displayCapacity()?.mode === 'at_limit_blocking_new',
+ 'text-red-600 dark:text-red-400': displayCapacity()?.mode === 'over_limit_frozen',
+ }}
+ >
+ {capacitySummary()}
+ </p>
+ <Show when={capacityContext()}>
+ <p class="max-w-xs text-xs text-muted">{capacityContext()}</p>
+ </Show>
+ </div>
</Show>
<Show when={!ledger() && usageUnavailable()}>
<span class="text-sm font-medium text-amber-700 dark:text-amber-300">
diff --git a/frontend-modern/src/components/Settings/ProLicensePanel.tsx b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
index 38c26de7a8..36de035913 100644
--- a/frontend-modern/src/components/Settings/ProLicensePanel.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
@@ -105,6 +105,7 @@ const ProLicensePanelContent: Component = () => {
hasLicenseDetails={state.hasLicenseDetails()}
hasPaidFeatures={state.hasPaidFeatures()}
loading={state.loading()}
+ monitoredSystemCapacityNotice={state.monitoredSystemCapacityNotice()}
monitoredSystemContinuityNotice={state.monitoredSystemContinuityNotice()}
onReload={() => void state.loadPanelData()}
purchaseActivationAction={state.purchaseActivationAction()}
@@ -143,6 +144,7 @@ const ProLicensePanelContent: Component = () => {
>
<MonitoredSystemLedgerPanel
embedded
+ monitoredSystemCapacity={state.entitlements()?.monitored_system_capacity}
monitoredSystemContinuity={state.entitlements()?.monitored_system_continuity}
monitoredSystemLimit={
state
diff --git a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
index 39eebb937c..be7939ec03 100644
--- a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
@@ -36,6 +36,7 @@ interface ProLicensePlanSectionProps {
hasLicenseDetails: boolean;
hasPaidFeatures: boolean;
loading: boolean;
+ monitoredSystemCapacityNotice: Notice | null;
monitoredSystemContinuityNotice: Notice | null;
onReload: () => void;
onStartTrial: () => void;
@@ -163,6 +164,14 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (pro
</div>
)}
</Show>
+ <Show when={props.monitoredSystemCapacityNotice}>
+ {(notice) => (
+ <div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>
+ <p class="font-medium">{notice().title}</p>
+ <p class="mt-1 text-xs opacity-90">{notice().body}</p>
+ </div>
+ )}
+ </Show>
<Show when={props.trialEnded && !licenseEntitlementsLoadError() && trialEndedNotice}>
<div class={`mb-4 rounded-md border p-3 text-sm ${trialEndedNotice?.tone ?? ''}`}>
<p class="font-medium">{trialEndedNotice?.title}</p>
diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
index 88614f3ff2..d7c02daaf5 100644
--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
@@ -266,7 +266,7 @@ describe('MonitoredSystemLedgerPanel', () => {
));
await waitFor(() => {
- expect(screen.getByText('7 / 12')).toBeInTheDocument();
+ expect(screen.getByText('7 monitored systems')).toBeInTheDocument();
});
expect(screen.getByText('Plan continuity')).toBeInTheDocument();
@@ -390,7 +390,10 @@ describe('MonitoredSystemLedgerPanel', () => {
),
).toBeInTheDocument();
expect(screen.getByText('server-b')).toBeInTheDocument();
- expect(screen.getByText('2 / 10')).toBeInTheDocument();
+ expect(screen.getByText('2 monitored systems')).toBeInTheDocument();
+ expect(
+ screen.getByText('8 remaining before new monitored systems are blocked.'),
+ ).toBeInTheDocument();
expect(screen.getAllByRole('button', { name: 'View counting details' })).toHaveLength(2);
fireEvent.click(screen.getAllByRole('button', { name: 'View counting details' })[1]!);
expect(
@@ -572,7 +575,7 @@ describe('MonitoredSystemLedgerPanel', () => {
render(() => <MonitoredSystemLedgerPanel showCountingRulesByDefault />);
await waitFor(() => {
- expect(screen.getByText('2 / 5')).toBeInTheDocument();
+ expect(screen.getByText('2 monitored systems')).toBeInTheDocument();
});
expect(screen.getByRole('button', { name: 'Hide counting rules' })).toHaveAttribute(
diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
index 32f5baf6fc..7e9451e401 100644
--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
@@ -259,8 +259,8 @@ describe('ProLicensePanel', () => {
expect(screen.getByText('Plan Terms')).toBeInTheDocument();
});
- expect(screen.getByText('5 / 12')).toBeInTheDocument();
- expect(screen.getByText('7')).toBeInTheDocument();
+ expect(screen.getByText('5 monitored systems')).toBeInTheDocument();
+ expect(screen.getByText('7 remaining')).toBeInTheDocument();
expect(screen.getAllByText('Active').length).toBeGreaterThan(0);
expect(screen.getByText('V5 Pro Monthly (Grandfathered)')).toBeInTheDocument();
expect(screen.getByText('Included Monitored Systems')).toBeInTheDocument();
@@ -337,7 +337,9 @@ describe('ProLicensePanel', () => {
expect(screen.getByText(tc.expectedLabel)).toBeInTheDocument();
expect(screen.getByText('Grandfathered v5 pricing')).toBeInTheDocument();
expect(
- screen.getByText(/keeps its existing recurring price and uncapped monitored-system and guest capacity until you cancel/i),
+ screen.getByText(
+ /keeps its existing recurring price and uncapped monitored-system and guest capacity until you cancel/i,
+ ),
).toBeInTheDocument();
expect(
within(screen.getByText('Monitored Systems').parentElement as HTMLElement).getByText(
@@ -345,7 +347,7 @@ describe('ProLicensePanel', () => {
),
).toBeInTheDocument();
expect(
- within(screen.getByText('Remaining System Capacity').parentElement as HTMLElement).getByText(
+ within(screen.getByText('Capacity Status').parentElement as HTMLElement).getByText(
'Unlimited',
),
).toBeInTheDocument();
@@ -438,7 +440,8 @@ describe('ProLicensePanel', () => {
expect(
screen.getByText(/keeps an effective monitored-system limit of 23/i),
).toBeInTheDocument();
- expect(screen.getByText('23 / 23')).toBeInTheDocument();
+ expect(screen.getByText('23 monitored systems')).toBeInTheDocument();
+ expect(screen.getByText('Monitored-system limit reached')).toBeInTheDocument();
expect(screen.getByText('Plan Monitored System Limit')).toBeInTheDocument();
expect(screen.getByText('Effective Monitored System Limit')).toBeInTheDocument();
expect(screen.getByText('Grandfathered Floor')).toBeInTheDocument();
@@ -579,26 +582,35 @@ describe('ProLicensePanel', () => {
actionLabel: 'Try again',
actionHref: getSelfHostedPurchaseStartUrl(),
},
- ])('shows the purchase arrival notice for $purchase', async ({ purchase, title, actionLabel, actionHref, redirectedHref = SELF_HOSTED_PRO_BILLING_PLAN_HREF }) => {
- useLocationMock.mockReturnValue({
- search: `?purchase=${purchase}`,
- pathname: '/settings/system/billing/plan',
- hash: '',
- });
+ ])(
+ 'shows the purchase arrival notice for $purchase',
+ async ({
+ purchase,
+ title,
+ actionLabel,
+ actionHref,
+ redirectedHref = SELF_HOSTED_PRO_BILLING_PLAN_HREF,
+ }) => {
+ useLocationMock.mockReturnValue({
+ search: `?purchase=${purchase}`,
+ pathname: '/settings/system/billing/plan',
+ hash: '',
+ });
- renderPanel();
+ renderPanel();
- expect(screen.getByText(title)).toBeInTheDocument();
- if (actionLabel && actionHref) {
- expect(screen.getByRole('link', { name: actionLabel })).toHaveAttribute('href', actionHref);
- } else {
- expect(screen.queryByRole('link', { name: 'Review usage' })).not.toBeInTheDocument();
- }
- expect(navigateMock).toHaveBeenCalledWith(redirectedHref, {
- replace: true,
- scroll: false,
- });
- });
+ expect(screen.getByText(title)).toBeInTheDocument();
+ if (actionLabel && actionHref) {
+ expect(screen.getByRole('link', { name: actionLabel })).toHaveAttribute('href', actionHref);
+ } else {
+ expect(screen.queryByRole('link', { name: 'Review usage' })).not.toBeInTheDocument();
+ }
+ expect(navigateMock).toHaveBeenCalledWith(redirectedHref, {
+ replace: true,
+ scroll: false,
+ });
+ },
+ );
it('shows a monitored-system activation success action and suppresses the compare-plans arrival callout', async () => {
useLocationMock.mockReturnValue({
@@ -626,9 +638,7 @@ describe('ProLicensePanel', () => {
renderPanel();
- const recoveryDisclosure = screen
- .getByText('Redeem existing key')
- .closest('details');
+ const recoveryDisclosure = screen.getByText('Redeem existing key').closest('details');
expect(recoveryDisclosure).toHaveAttribute('open');
});
@@ -681,7 +691,9 @@ describe('ProLicensePanel', () => {
renderPanel();
expect(
- screen.getByText('Pulse counts top-level monitored systems. Child resources underneath them are included.'),
+ screen.getByText(
+ 'Pulse counts top-level monitored systems. Child resources underneath them are included.',
+ ),
).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'View counting rules' })).toBeInTheDocument();
expect(
diff --git a/frontend-modern/src/components/Settings/useProLicensePanelState.ts b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
index 432705cee7..22300d8892 100644
--- a/frontend-modern/src/components/Settings/useProLicensePanelState.ts
+++ b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
@@ -48,8 +48,10 @@ import {
} from '@/utils/pricingHandoff';
import { buildSelfHostedCommercialPlanModel } from '@/utils/commercialBillingModel';
import {
- getMonitoredSystemLimitRemainingCapacity,
+ getMonitoredSystemLimitCapacityStatusSummary,
+ getMonitoredSystemLimitContextSummary,
getMonitoredSystemLimitUsageSummary,
+ resolveMonitoredSystemCapacityStatus,
} from '@/utils/monitoredSystemPresentation';
import { runStartProTrialAction } from '@/utils/trialStartAction';
import { resolveUpgradeDestination, type UpgradeDestination } from '@/utils/upgradeNavigation';
@@ -247,27 +249,58 @@ export function useProLicensePanelState() {
const limitStatus = (key: string) => entitlements()?.limits?.find((entry) => entry.key === key);
const monitoredSystemLimitStatus = createMemo(() => limitStatus('max_monitored_systems'));
+ const monitoredSystemCapacity = createMemo(() => entitlements()?.monitored_system_capacity);
const uncappedGrandfatheredPlan = createMemo(() =>
isUncappedGrandfatheredPlanVersion(entitlements()?.plan_version, entitlements()?.is_lifetime),
);
const monitoredSystemUsageSummary = createMemo(() => {
const limit = monitoredSystemLimitStatus();
- if (!limit && uncappedGrandfatheredPlan()) {
+ const capacity = monitoredSystemCapacity();
+ if (!limit && !capacity && uncappedGrandfatheredPlan()) {
return 'Unlimited';
}
- return getMonitoredSystemLimitUsageSummary(limit);
+ return getMonitoredSystemLimitUsageSummary(limit, capacity);
});
- const remainingSystemCapacity = createMemo(() => {
+ const monitoredSystemCapacityStatusSummary = createMemo(() => {
const limit = monitoredSystemLimitStatus();
- if (!limit && uncappedGrandfatheredPlan()) {
+ const capacity = monitoredSystemCapacity();
+ if (!limit && !capacity && uncappedGrandfatheredPlan()) {
return 'Unlimited';
}
- return getMonitoredSystemLimitRemainingCapacity(limit);
+ return getMonitoredSystemLimitCapacityStatusSummary(limit, capacity);
});
+ const monitoredSystemCapacityPosture = createMemo(() =>
+ resolveMonitoredSystemCapacityStatus(monitoredSystemCapacity(), monitoredSystemLimitStatus()),
+ );
const monitoredSystemContinuity = createMemo(() => entitlements()?.monitored_system_continuity);
const monitoredSystemContinuityNotice = createMemo(() =>
getMonitoredSystemContinuityNotice(monitoredSystemContinuity(), monitoredSystemLimitStatus()),
);
+ const monitoredSystemCapacityNotice = createMemo(() => {
+ const posture = monitoredSystemCapacityPosture();
+ if (!posture?.current_available) {
+ return null;
+ }
+ switch (posture.mode) {
+ case 'at_limit_blocking_new':
+ return {
+ title: 'Monitored-system limit reached',
+ body: `This installation is using all ${posture.limit} included monitored systems. Existing monitoring continues, but new monitored systems are blocked until capacity is freed or the plan is upgraded.`,
+ tone: 'border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100',
+ };
+ case 'over_limit_frozen':
+ return {
+ title: 'Monitoring continues above the current plan limit',
+ body: `This installation is monitoring ${posture.current} systems while the current plan includes ${posture.limit}. Existing monitoring continues, but new monitored systems are blocked until usage is reduced or the plan is upgraded.`,
+ tone: 'border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100',
+ };
+ default:
+ return null;
+ }
+ });
+ const monitoredSystemCapacityContext = createMemo(() =>
+ getMonitoredSystemLimitContextSummary(monitoredSystemLimitStatus(), monitoredSystemCapacity()),
+ );
const continuityCapturedAt = createMemo(() => {
const capturedAt = monitoredSystemContinuity()?.captured_at;
return typeof capturedAt === 'number' && capturedAt > 0
@@ -287,9 +320,10 @@ export function useProLicensePanelState() {
const purchaseActivationNotice = createMemo(() => {
return getPurchaseActivationNotice(purchaseActivationResult());
});
- const purchaseActivationAction = createMemo<
- { label: string; destination: UpgradeDestination } | null
- >(() => {
+ const purchaseActivationAction = createMemo<{
+ label: string;
+ destination: UpgradeDestination;
+ } | null>(() => {
const purchase = purchaseActivationResult().trim().toLowerCase();
const intent = getSelfHostedBillingPlanIntent(location.search);
switch (purchase) {
@@ -356,7 +390,7 @@ export function useProLicensePanelState() {
expires: displayedExpiry(),
daysRemaining: displayedDaysRemaining() ?? 'Unknown',
monitoredSystemsSummary: monitoredSystemUsageSummary(),
- remainingSystemCapacity: remainingSystemCapacity(),
+ capacityStatusSummary: monitoredSystemCapacityStatusSummary(),
maxMonitoredSystems:
typeof limitStatus('max_monitored_systems')?.limit === 'number' &&
limitStatus('max_monitored_systems')!.limit > 0
@@ -426,6 +460,9 @@ export function useProLicensePanelState() {
clearing,
commercialMigrationNotice,
commercialPlanModel,
+ monitoredSystemCapacity,
+ monitoredSystemCapacityContext,
+ monitoredSystemCapacityNotice,
monitoredSystemContinuityNotice,
entitlements,
formattedFeatures,
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index d9fad7001f..ce8e95c120 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -663,6 +663,9 @@ describe('shared primitive guardrails', () => {
expect(monitoredSystemLimitWarningBannerStateSource).toContain('createEffect');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('createMemo');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('loadRuntimeCapabilities');
+ expect(monitoredSystemLimitWarningBannerStateSource).toContain(
+ 'getRuntimeMonitoredSystemCapacity',
+ );
expect(monitoredSystemLimitWarningBannerStateSource).toContain(
'presentationPolicyHidesCommercialSurfaces',
);
@@ -689,12 +692,20 @@ describe('shared primitive guardrails', () => {
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
'getMonitoredSystemLimitInstallCollectorsLabel',
);
+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(
+ 'type MonitoredSystemCapacityStatus',
+ );
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
'isMonitoredSystemLimitUsageAvailable',
);
+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(
+ 'formatMonitoredSystemLimitSummary',
+ );
expect(monitoredSystemLimitWarningBannerModelSource).not.toContain(
'current_available !== false',
);
+ expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('current / limit');
+ expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('0 remaining');
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
'SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF',
);
diff --git a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
index 80434b873e..c6a8c42238 100644
--- a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
@@ -22,6 +22,7 @@ type MockLimitRecord = {
const mockGetLimit = vi.hoisted(() =>
vi.fn<(key: string) => MockLimitRecord | undefined>(() => undefined),
);
+const mockGetMonitoredSystemCapacity = vi.hoisted(() => vi.fn(() => undefined));
const mockHasMigrationGap = vi.hoisted(() => vi.fn(() => false));
const mockLegacyConnections = vi.hoisted(() =>
vi.fn(() => ({
@@ -39,6 +40,7 @@ const mockGetUpgradeActionUrlOrFallback = vi.hoisted(() => vi.fn());
vi.mock('@/stores/license', () => ({
getRuntimeLimit: (key: string) => mockGetLimit(key),
+ getRuntimeMonitoredSystemCapacity: () => mockGetMonitoredSystemCapacity(),
loadRuntimeCapabilities: (force?: boolean) => mockLoadRuntimeLicenseStatus(force),
}));
@@ -72,6 +74,8 @@ describe('MonitoredSystemLimitWarningBanner', () => {
current: 0,
state: 'ok',
});
+ mockGetMonitoredSystemCapacity.mockReset();
+ mockGetMonitoredSystemCapacity.mockReturnValue(undefined);
mockHasMigrationGap.mockReturnValue(false);
mockLegacyConnections.mockReturnValue({
proxmox_nodes: 0,
@@ -207,7 +211,7 @@ describe('MonitoredSystemLimitWarningBanner', () => {
</Router>
));
- expect(screen.getByText('5 monitored systems currently counted')).toBeInTheDocument();
+ expect(screen.getByText('5 of 6 included monitored systems are in use.')).toBeInTheDocument();
expect(screen.getByText('Learn more')).toHaveAttribute(
'href',
'/settings/system/billing/usage?details=counting-rules',
@@ -264,7 +268,7 @@ describe('MonitoredSystemLimitWarningBanner', () => {
</Router>
));
- expect(screen.getByText('5 monitored systems currently counted')).toBeInTheDocument();
+ expect(screen.getByText('5 of 6 included monitored systems are in use.')).toBeInTheDocument();
expect(
screen.getByText(
/You also have 3 resources connected via API or legacy collectors \(2 Proxmox nodes, 1 Docker host\) that count once toward your monitored-system cap when the same top-level system is discovered canonically\./i,
@@ -305,7 +309,9 @@ describe('MonitoredSystemLimitWarningBanner', () => {
</Router>
));
- expect(screen.queryByText('5 monitored systems currently counted')).not.toBeInTheDocument();
+ expect(
+ screen.queryByText('5 of 6 included monitored systems are in use.'),
+ ).not.toBeInTheDocument();
expect(mockTrackUpgradeMetricEvent).not.toHaveBeenCalled();
});
});
diff --git a/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts b/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
index 72714b6280..7cb9c7fae7 100644
--- a/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
+++ b/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
@@ -8,6 +8,7 @@ import {
getMonitoredSystemLimitUpgradeLabel,
isMonitoredSystemLimitUrgent as isCanonicalMonitoredSystemLimitUrgent,
isMonitoredSystemLimitUsageAvailable as isCanonicalMonitoredSystemLimitUsageAvailable,
+ type MonitoredSystemCapacityStatus,
type MonitoredSystemLimitUsageStatus,
type MonitoredSystemLegacyConnectionCounts,
} from '@/utils/monitoredSystemPresentation';
@@ -32,17 +33,36 @@ export function isMonitoredSystemLimitUsageAvailable(limit: LimitState | undefin
return isCanonicalMonitoredSystemLimitUsageAvailable(limit);
}
-export function isMonitoredSystemLimitUrgent(limit: LimitState | undefined): boolean {
- return isCanonicalMonitoredSystemLimitUrgent(limit);
+export function isMonitoredSystemLimitUrgent(
+ limit: LimitState | undefined,
+ capacity?: MonitoredSystemCapacityStatus | null,
+): boolean {
+ return isCanonicalMonitoredSystemLimitUrgent(limit, capacity);
}
-export function shouldShowMonitoredSystemLimitBanner(limit: LimitState | undefined): boolean {
- return Boolean(limit) && isMonitoredSystemLimitUrgent(limit);
+export function shouldShowMonitoredSystemLimitBanner(
+ limit: LimitState | undefined,
+ capacity?: MonitoredSystemCapacityStatus | null,
+): boolean {
+ return Boolean(limit || capacity) && isMonitoredSystemLimitUrgent(limit, capacity);
}
-export function getMonitoredSystemSummary(limit: LimitState | undefined): string {
- if (!limit || !isMonitoredSystemLimitUsageAvailable(limit)) return '';
- return formatMonitoredSystemLimitSummary(limit);
+export function getMonitoredSystemSummary(
+ limit: LimitState | undefined,
+ capacity?: MonitoredSystemCapacityStatus | null,
+): string {
+ if (!limit && !capacity) return '';
+ if (limit && !isMonitoredSystemLimitUsageAvailable(limit)) return '';
+ return formatMonitoredSystemLimitSummary(
+ limit ?? {
+ current: capacity?.current ?? 0,
+ limit: capacity?.limit ?? 0,
+ current_available: capacity?.current_available ?? true,
+ current_unavailable_reason: capacity?.current_unavailable_reason,
+ state: capacity?.urgency ?? 'ok',
+ },
+ capacity,
+ );
}
export function getMonitoredSystemLegacyConnectionTotal(
diff --git a/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts b/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
index 1352062a21..ca38f5a693 100644
--- a/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
+++ b/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
@@ -1,6 +1,7 @@
import { createEffect, createMemo, onMount } from 'solid-js';
import { presentationPolicyHidesCommercialSurfaces } from '@/stores/sessionPresentationPolicy';
import {
+ getRuntimeMonitoredSystemCapacity,
getRuntimeLimit,
loadRuntimeCapabilities,
} from '@/stores/license';
@@ -39,27 +40,26 @@ export function useMonitoredSystemLimitWarningBannerState() {
});
const monitoredSystemLimit = createMemo(() => getRuntimeLimit(MONITORED_SYSTEM_LIMIT_KEY));
- const isUrgent = createMemo(() => isMonitoredSystemLimitUrgent(monitoredSystemLimit()));
+ const monitoredSystemCapacity = createMemo(() => getRuntimeMonitoredSystemCapacity());
+ const isUrgent = createMemo(() =>
+ isMonitoredSystemLimitUrgent(monitoredSystemLimit(), monitoredSystemCapacity()),
+ );
const showBanner = createMemo(
() =>
!presentationPolicyHidesCommercialSurfaces() &&
- shouldShowMonitoredSystemLimitBanner(monitoredSystemLimit()),
+ shouldShowMonitoredSystemLimitBanner(monitoredSystemLimit(), monitoredSystemCapacity()),
);
const migrationGap = createMemo(() => hasMigrationGap());
const migrationCounts = createMemo(() => legacyConnections());
const monitoredSystemSummary = createMemo(() =>
- getMonitoredSystemSummary(monitoredSystemLimit()),
- );
- const migrationMessage = createMemo(() =>
- getMonitoredSystemMigrationMessage(migrationCounts()),
+ getMonitoredSystemSummary(monitoredSystemLimit(), monitoredSystemCapacity()),
);
+ const migrationMessage = createMemo(() => getMonitoredSystemMigrationMessage(migrationCounts()));
const overflowSummary = createMemo(() =>
getMonitoredSystemOverflowSummary(commercialOverflowDaysRemaining()),
);
const toneClass = createMemo(() => getMonitoredSystemBannerToneClass(isUrgent()));
- const migrationTextClass = createMemo(() =>
- getMonitoredSystemMigrationTextClass(isUrgent()),
- );
+ const migrationTextClass = createMemo(() => getMonitoredSystemMigrationTextClass(isUrgent()));
const learnMoreDestination = createMemo(() =>
resolveUpgradeDestination(MONITORED_SYSTEM_LIMIT_LEARN_MORE_HREF),
);
diff --git a/frontend-modern/src/stores/license.ts b/frontend-modern/src/stores/license.ts
index 52e2e36e9b..e2aad4e605 100644
--- a/frontend-modern/src/stores/license.ts
+++ b/frontend-modern/src/stores/license.ts
@@ -1,5 +1,9 @@
import { createSignal } from 'solid-js';
-import { LicenseAPI, type LicenseRuntimeCapabilities } from '@/api/license';
+import {
+ LicenseAPI,
+ type LicenseRuntimeCapabilities,
+ type MonitoredSystemCapacityStatus,
+} from '@/api/license';
import { eventBus } from '@/stores/events';
import { logger } from '@/utils/logger';
@@ -66,6 +70,10 @@ export function getRuntimeLimit(key: string) {
return current.limits.find((limit) => limit.key === key);
}
+export function getRuntimeMonitoredSystemCapacity(): MonitoredSystemCapacityStatus | undefined {
+ return runtimeCapabilities()?.monitored_system_capacity;
+}
+
/** Default max history days when runtime capabilities aren't loaded yet. */
const DEFAULT_MAX_HISTORY_DAYS = 7;
diff --git a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
index aacbdbfe88..e8c8178229 100644
--- a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
@@ -25,6 +25,8 @@ import {
getMonitoredSystemDisclosureDefinition,
getMonitoredSystemDisclosureToggleLabel,
getMonitoredSystemExplanationFallbackSummary,
+ getMonitoredSystemLimitCapacityStatusSummary,
+ getMonitoredSystemLimitContextSummary,
getMonitoredSystemLedgerDescription,
getMonitoredSystemLedgerErrorState,
getMonitoredSystemLedgerHiddenState,
@@ -33,12 +35,12 @@ import {
getMonitoredSystemLedgerPolicyLoadingState,
getMonitoredSystemLedgerUnavailableState,
getMonitoredSystemLimitInstallCollectorsLabel,
- getMonitoredSystemLimitRemainingCapacity,
getMonitoredSystemLimitLearnMoreLabel,
getMonitoredSystemLimitUnavailableReason,
getMonitoredSystemLimitUpgradeLabel,
getMonitoredSystemLimitUsageSummary,
getMonitoredSystemSourceLabel,
+ resolveMonitoredSystemCapacityStatus,
getMonitoredSystemStatusFallbackSummary,
getMonitoredSystemSurfaceTypeLabel,
isMonitoredSystemAdmissionPreviewResolvedSafely,
@@ -207,7 +209,10 @@ describe('monitoredSystemPresentation', () => {
'export function getMonitoredSystemLimitUsageSummary',
);
expect(monitoredSystemPresentationSource).toContain(
- 'export function getMonitoredSystemLimitRemainingCapacity',
+ 'export function getMonitoredSystemLimitCapacityStatusSummary',
+ );
+ expect(monitoredSystemPresentationSource).toContain(
+ 'export function resolveMonitoredSystemCapacityStatus',
);
for (const source of [
@@ -227,7 +232,10 @@ describe('monitoredSystemPresentation', () => {
expect(getMonitoredSystemLimitInstallCollectorsLabel()).toBe('Install v6 collectors');
expect(getMonitoredSystemLimitUpgradeLabel()).toBe('Upgrade to add more');
expect(formatMonitoredSystemLimitSummary({ current: 5, limit: 6 })).toBe(
- '5 monitored systems currently counted',
+ '5 of 6 included monitored systems are in use.',
+ );
+ expect(formatMonitoredSystemLimitSummary({ current: 16, limit: 5, state: 'enforced' })).toBe(
+ '16 monitored systems active. Plan includes 5, and you are over plan by 11. Existing monitoring continues, but new monitored systems are blocked until usage is reduced or the plan is upgraded.',
);
expect(
formatMonitoredSystemLegacyConnectionBreakdown({
@@ -265,7 +273,10 @@ describe('monitoredSystemPresentation', () => {
'supplemental_inventory_unsettled',
);
expect(getMonitoredSystemLimitUsageSummary(unavailableLimit)).toBe('Verifying…');
- expect(getMonitoredSystemLimitRemainingCapacity(unavailableLimit)).toBe('Unavailable');
+ expect(getMonitoredSystemLimitCapacityStatusSummary(unavailableLimit)).toBe('Unavailable');
+ expect(getMonitoredSystemLimitContextSummary(unavailableLimit)).toBe(
+ 'Pulse is still collecting the first provider-owned inventory baseline. The monitored-system ledger will appear after that baseline completes.',
+ );
expect(isMonitoredSystemLimitUrgent(unavailableLimit)).toBe(false);
expect(
formatMonitoredSystemUsageUnavailableMessage(unavailableLimit.current_unavailable_reason),
@@ -279,21 +290,41 @@ describe('monitoredSystemPresentation', () => {
limit: 10,
current_available: true,
}),
- ).toBe('7 / 10');
+ ).toBe('7 monitored systems');
expect(
- getMonitoredSystemLimitRemainingCapacity({
+ getMonitoredSystemLimitCapacityStatusSummary({
current: 7,
limit: 10,
current_available: true,
}),
- ).toBe(3);
+ ).toBe('3 remaining');
expect(
- getMonitoredSystemLimitRemainingCapacity({
+ getMonitoredSystemLimitCapacityStatusSummary({
current: 7,
limit: 0,
current_available: true,
}),
).toBe('Unlimited');
+ expect(
+ getMonitoredSystemLimitContextSummary({
+ current: 10,
+ limit: 10,
+ current_available: true,
+ state: 'enforced',
+ }),
+ ).toBe(
+ 'Plan includes 10. Existing monitoring continues, but new monitored systems are blocked until capacity is freed or the plan is upgraded.',
+ );
+ expect(
+ getMonitoredSystemLimitContextSummary({
+ current: 16,
+ limit: 5,
+ current_available: true,
+ state: 'enforced',
+ }),
+ ).toBe(
+ 'Plan includes 5. Over plan by 11. Existing monitoring continues, but new monitored systems are blocked until usage is reduced or the plan is upgraded.',
+ );
expect(
isMonitoredSystemLimitUrgent({
current: 9,
@@ -302,6 +333,19 @@ describe('monitoredSystemPresentation', () => {
state: 'warning',
}),
).toBe(true);
+ expect(
+ resolveMonitoredSystemCapacityStatus(undefined, {
+ current: 16,
+ limit: 5,
+ current_available: true,
+ state: 'enforced',
+ }),
+ ).toMatchObject({
+ mode: 'over_limit_frozen',
+ overage: 11,
+ blocks_new_systems: true,
+ existing_monitoring_continues: true,
+ });
});
it('returns canonical monitored-system admission unavailable copy', () => {
diff --git a/frontend-modern/src/utils/commercialBillingModel.ts b/frontend-modern/src/utils/commercialBillingModel.ts
index 368518f298..27c01321b0 100644
--- a/frontend-modern/src/utils/commercialBillingModel.ts
+++ b/frontend-modern/src/utils/commercialBillingModel.ts
@@ -30,7 +30,7 @@ export interface SelfHostedCommercialModelInput {
expires: string;
daysRemaining: string | number;
monitoredSystemsSummary: string | number;
- remainingSystemCapacity: string | number;
+ capacityStatusSummary: string | number;
maxMonitoredSystems: string | number;
maxGuests: string | number;
monitoredSystemContinuity?: MonitoredSystemContinuityStatus | null;
@@ -63,8 +63,8 @@ export const buildSelfHostedCommercialPlanModel = (
value: input.monitoredSystemsSummary,
},
{
- label: 'Remaining System Capacity',
- value: input.remainingSystemCapacity,
+ label: 'Capacity Status',
+ value: input.capacityStatusSummary,
},
{
label: 'Plan Status',
diff --git a/frontend-modern/src/utils/monitoredSystemPresentation.ts b/frontend-modern/src/utils/monitoredSystemPresentation.ts
index ed3c50420a..56b4bbfed7 100644
--- a/frontend-modern/src/utils/monitoredSystemPresentation.ts
+++ b/frontend-modern/src/utils/monitoredSystemPresentation.ts
@@ -83,7 +83,8 @@ const MONITORED_SYSTEM_LEDGER_PRESENTATION = {
learnMoreLabel: 'Learn more',
installCollectorsLabel: 'Install v6 collectors',
upgradeLabel: 'Upgrade to add more',
- overflowSummaryPrefix: 'Community includes 5 monitored systems. 1 temporary setup slot is active',
+ overflowSummaryPrefix:
+ 'Community includes 5 monitored systems. 1 temporary setup slot is active',
legacyConnectionSuffix:
'that count once toward your monitored-system cap when the same top-level system is discovered canonically.',
},
@@ -119,6 +120,32 @@ export type MonitoredSystemLimitUsageStatus = {
state?: string | null;
};
+export type MonitoredSystemCapacityStatus = {
+ mode?: string | null;
+ urgency?: string | null;
+ current?: number | null;
+ limit?: number | null;
+ current_available?: boolean | null;
+ current_unavailable_reason?: string | null;
+ available_slots?: number | null;
+ overage?: number | null;
+ blocks_new_systems?: boolean | null;
+ existing_monitoring_continues?: boolean | null;
+};
+
+type ResolvedMonitoredSystemCapacityStatus = {
+ mode: string;
+ urgency: string;
+ current: number;
+ limit: number;
+ current_available: boolean;
+ current_unavailable_reason?: string;
+ available_slots: number;
+ overage: number;
+ blocks_new_systems: boolean;
+ existing_monitoring_continues: boolean;
+};
+
export type MonitoredSystemAdmissionPreviewUnavailableState = {
reason: string | null;
title: string;
@@ -197,46 +224,225 @@ export function isMonitoredSystemLimitUsageAvailable(
export function getMonitoredSystemLimitUnavailableReason(
limit?: MonitoredSystemLimitUsageStatus | null,
+ capacity?: MonitoredSystemCapacityStatus | null,
): string | undefined {
- if (isMonitoredSystemLimitUsageAvailable(limit)) return undefined;
- return limit?.current_unavailable_reason?.trim() || undefined;
+ const resolved = resolveMonitoredSystemCapacityStatus(capacity, limit);
+ if (resolved?.current_available) return undefined;
+ return resolved?.current_unavailable_reason?.trim() || undefined;
+}
+
+function deriveMonitoredSystemLimitUrgency(current: number, limit: number): string {
+ if (limit <= 0) return 'ok';
+ if (current >= limit) return 'enforced';
+ if (limit > 1 && limit <= 10) {
+ return current >= limit - 1 ? 'warning' : 'ok';
+ }
+ return current * 10 >= limit * 9 ? 'warning' : 'ok';
+}
+
+function deriveMonitoredSystemCapacityStatus(
+ limit?: MonitoredSystemLimitUsageStatus | null,
+): ResolvedMonitoredSystemCapacityStatus | undefined {
+ if (!limit) return undefined;
+
+ const currentAvailable = isMonitoredSystemLimitUsageAvailable(limit);
+ const current = typeof limit.current === 'number' ? limit.current : 0;
+ const planLimit = typeof limit.limit === 'number' ? limit.limit : 0;
+ const urgency =
+ normalizeMonitoredSystemValue(limit.state ?? undefined) ||
+ deriveMonitoredSystemLimitUrgency(current, planLimit);
+
+ if (!currentAvailable) {
+ return {
+ mode: 'usage_unavailable',
+ urgency: 'ok',
+ current: 0,
+ limit: planLimit,
+ current_available: false,
+ current_unavailable_reason: limit.current_unavailable_reason?.trim() || undefined,
+ available_slots: 0,
+ overage: 0,
+ blocks_new_systems: false,
+ existing_monitoring_continues: false,
+ };
+ }
+
+ if (planLimit <= 0) {
+ return {
+ mode: 'unlimited',
+ urgency: 'ok',
+ current,
+ limit: 0,
+ current_available: true,
+ available_slots: 0,
+ overage: 0,
+ blocks_new_systems: false,
+ existing_monitoring_continues: true,
+ };
+ }
+
+ if (current > planLimit) {
+ return {
+ mode: 'over_limit_frozen',
+ urgency: 'enforced',
+ current,
+ limit: planLimit,
+ current_available: true,
+ available_slots: 0,
+ overage: current - planLimit,
+ blocks_new_systems: true,
+ existing_monitoring_continues: true,
+ };
+ }
+
+ if (current === planLimit) {
+ return {
+ mode: 'at_limit_blocking_new',
+ urgency: 'enforced',
+ current,
+ limit: planLimit,
+ current_available: true,
+ available_slots: 0,
+ overage: 0,
+ blocks_new_systems: true,
+ existing_monitoring_continues: true,
+ };
+ }
+
+ return {
+ mode: 'within_limit',
+ urgency,
+ current,
+ limit: planLimit,
+ current_available: true,
+ available_slots: planLimit - current,
+ overage: 0,
+ blocks_new_systems: false,
+ existing_monitoring_continues: true,
+ };
+}
+
+export function resolveMonitoredSystemCapacityStatus(
+ capacity?: MonitoredSystemCapacityStatus | null,
+ limit?: MonitoredSystemLimitUsageStatus | null,
+): ResolvedMonitoredSystemCapacityStatus | undefined {
+ const fallback = deriveMonitoredSystemCapacityStatus(limit);
+ if (!capacity) {
+ return fallback;
+ }
+
+ const current =
+ typeof capacity.current === 'number' ? capacity.current : (fallback?.current ?? 0);
+ const planLimit = typeof capacity.limit === 'number' ? capacity.limit : (fallback?.limit ?? 0);
+ const currentAvailable =
+ typeof capacity.current_available === 'boolean'
+ ? capacity.current_available
+ : (fallback?.current_available ?? true);
+ const mode =
+ normalizeMonitoredSystemValue(capacity.mode ?? undefined) ||
+ fallback?.mode ||
+ 'usage_unavailable';
+ const urgency =
+ normalizeMonitoredSystemValue(capacity.urgency ?? undefined) ||
+ fallback?.urgency ||
+ deriveMonitoredSystemLimitUrgency(current, planLimit);
+
+ return {
+ mode,
+ urgency,
+ current,
+ limit: planLimit,
+ current_available: currentAvailable,
+ current_unavailable_reason:
+ capacity.current_unavailable_reason?.trim() ||
+ fallback?.current_unavailable_reason ||
+ undefined,
+ available_slots:
+ typeof capacity.available_slots === 'number'
+ ? capacity.available_slots
+ : (fallback?.available_slots ?? Math.max(planLimit - current, 0)),
+ overage:
+ typeof capacity.overage === 'number'
+ ? capacity.overage
+ : (fallback?.overage ?? Math.max(current - planLimit, 0)),
+ blocks_new_systems:
+ typeof capacity.blocks_new_systems === 'boolean'
+ ? capacity.blocks_new_systems
+ : (fallback?.blocks_new_systems ?? false),
+ existing_monitoring_continues:
+ typeof capacity.existing_monitoring_continues === 'boolean'
+ ? capacity.existing_monitoring_continues
+ : (fallback?.existing_monitoring_continues ?? currentAvailable),
+ };
+}
+
+function formatMonitoredSystemCount(value: number): string {
+ return `${value} monitored system${value === 1 ? '' : 's'}`;
}
export function getMonitoredSystemLimitUsageSummary(
limit?: MonitoredSystemLimitUsageStatus | null,
-): string | number {
- if (!isMonitoredSystemLimitUsageAvailable(limit)) {
+ capacity?: MonitoredSystemCapacityStatus | null,
+): string {
+ const resolved = resolveMonitoredSystemCapacityStatus(capacity, limit);
+ if (!resolved || !resolved.current_available) {
return MONITORED_SYSTEM_LEDGER_PRESENTATION.usageVerifyingLabel;
}
+ return formatMonitoredSystemCount(resolved.current);
+}
- const current = typeof limit?.current === 'number' ? limit.current : 0;
- const planLimit = typeof limit?.limit === 'number' ? limit.limit : 0;
- if (planLimit > 0) {
- return `${current} / ${planLimit}`;
+export function getMonitoredSystemLimitCapacityStatusSummary(
+ limit?: MonitoredSystemLimitUsageStatus | null,
+ capacity?: MonitoredSystemCapacityStatus | null,
+): string {
+ const resolved = resolveMonitoredSystemCapacityStatus(capacity, limit);
+ if (!resolved || !resolved.current_available) {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.remainingCapacityUnavailableLabel;
+ }
+
+ switch (resolved.mode) {
+ case 'unlimited':
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.unlimitedLimitLabel;
+ case 'over_limit_frozen':
+ return `Over plan by ${resolved.overage}`;
+ case 'at_limit_blocking_new':
+ return 'At plan limit';
+ default:
+ return `${resolved.available_slots} remaining`;
}
- return current;
}
-export function getMonitoredSystemLimitRemainingCapacity(
+export function getMonitoredSystemLimitContextSummary(
limit?: MonitoredSystemLimitUsageStatus | null,
-): string | number {
- if (!isMonitoredSystemLimitUsageAvailable(limit)) {
- return MONITORED_SYSTEM_LEDGER_PRESENTATION.remainingCapacityUnavailableLabel;
+ capacity?: MonitoredSystemCapacityStatus | null,
+): string {
+ const resolved = resolveMonitoredSystemCapacityStatus(capacity, limit);
+ if (!resolved) {
+ return '';
+ }
+ if (!resolved.current_available) {
+ return formatMonitoredSystemUsageUnavailableMessage(resolved.current_unavailable_reason);
}
- const current = typeof limit?.current === 'number' ? limit.current : 0;
- const planLimit = typeof limit?.limit === 'number' ? limit.limit : 0;
- if (planLimit <= 0) {
- return MONITORED_SYSTEM_LEDGER_PRESENTATION.unlimitedLimitLabel;
+ switch (resolved.mode) {
+ case 'unlimited':
+ return 'This plan does not cap monitored systems.';
+ case 'over_limit_frozen':
+ return `Plan includes ${resolved.limit}. Over plan by ${resolved.overage}. Existing monitoring continues, but new monitored systems are blocked until usage is reduced or the plan is upgraded.`;
+ case 'at_limit_blocking_new':
+ return `Plan includes ${resolved.limit}. Existing monitoring continues, but new monitored systems are blocked until capacity is freed or the plan is upgraded.`;
+ default:
+ return `${resolved.available_slots} remaining before new monitored systems are blocked.`;
}
- return Math.max(planLimit - current, 0);
}
export function isMonitoredSystemLimitUrgent(
limit?: MonitoredSystemLimitUsageStatus | null,
+ capacity?: MonitoredSystemCapacityStatus | null,
): boolean {
- if (!limit || !isMonitoredSystemLimitUsageAvailable(limit)) return false;
- const state = normalizeMonitoredSystemValue(limit.state ?? undefined);
+ const resolved = resolveMonitoredSystemCapacityStatus(capacity, limit);
+ if (!resolved?.current_available) return false;
+ const state = normalizeMonitoredSystemValue(resolved.urgency);
return state === 'warning' || state === 'enforced';
}
@@ -346,11 +552,33 @@ export function getMonitoredSystemAdmissionPreviewSaveBlockedMessage(
return MONITORED_SYSTEM_LEDGER_PRESENTATION.admissionPreview.requiredMessage;
}
-export function formatMonitoredSystemLimitSummary(limit: {
- current: number;
- limit: number;
-}): string {
- return `${limit.current} monitored systems currently counted`;
+export function formatMonitoredSystemLimitSummary(
+ limit: {
+ current: number;
+ limit: number;
+ current_available?: boolean | null;
+ current_unavailable_reason?: string | null;
+ state?: string | null;
+ },
+ capacity?: MonitoredSystemCapacityStatus | null,
+): string {
+ const resolved = resolveMonitoredSystemCapacityStatus(capacity, limit);
+ if (!resolved || !resolved.current_available) {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.usageVerifyingLabel;
+ }
+
+ switch (resolved.mode) {
+ case 'over_limit_frozen':
+ return `${formatMonitoredSystemCount(resolved.current)} active. Plan includes ${
+ resolved.limit
+ }, and you are over plan by ${resolved.overage}. Existing monitoring continues, but new monitored systems are blocked until usage is reduced or the plan is upgraded.`;
+ case 'at_limit_blocking_new':
+ return `All ${resolved.limit} included monitored systems are in use. Existing monitoring continues, but new monitored systems are now blocked until capacity is freed or the plan is upgraded.`;
+ case 'unlimited':
+ return `${formatMonitoredSystemCount(resolved.current)} active.`;
+ default:
+ return `${resolved.current} of ${resolved.limit} included monitored systems are in use.`;
+ }
}
export function formatMonitoredSystemLegacyConnectionBreakdown(
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index dd703055ff..ae9b1d2267 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -5352,7 +5352,8 @@ func TestContract_EntitlementPayloadMonitoredSystemUsageJSONSnapshot(t *testing.
"trial_eligible":false,
"max_history_days":90,
"legacy_connections":{"proxmox_nodes":2,"docker_hosts":1,"kubernetes_clusters":1},
- "has_migration_gap":false
+ "has_migration_gap":false,
+ "monitored_system_capacity":{"mode":"within_limit","urgency":"ok","current":7,"limit":15,"current_available":true,"available_slots":8,"overage":0,"blocks_new_systems":false,"existing_monitoring_continues":true}
}`
assertJSONSnapshot(t, got, want)
@@ -5392,7 +5393,8 @@ func TestContract_EntitlementPayloadMonitoredSystemUsageUnavailableJSONSnapshot(
"max_history_days":90,
"legacy_connections":{"proxmox_nodes":0,"docker_hosts":0,"kubernetes_clusters":0},
"has_migration_gap":false,
- "monitored_system_continuity":{"plan_limit":15,"effective_limit":15,"capture_pending":true}
+ "monitored_system_continuity":{"plan_limit":15,"effective_limit":15,"capture_pending":true},
+ "monitored_system_capacity":{"mode":"usage_unavailable","urgency":"ok","current":0,"limit":15,"current_available":false,"current_unavailable_reason":"supplemental_inventory_unsettled","available_slots":0,"overage":0,"blocks_new_systems":false,"existing_monitoring_continues":false}
}`
assertJSONSnapshot(t, got, want)
@@ -5435,7 +5437,8 @@ func TestContract_EntitlementPayloadLifetimeJSONSnapshot(t *testing.T) {
"trial_eligible":false,
"max_history_days":90,
"legacy_connections":{"proxmox_nodes":1,"docker_hosts":1,"kubernetes_clusters":0},
- "has_migration_gap":false
+ "has_migration_gap":false,
+ "monitored_system_capacity":{"mode":"unlimited","urgency":"ok","current":15,"limit":0,"current_available":true,"available_slots":0,"overage":0,"blocks_new_systems":false,"existing_monitoring_continues":true}
}`
assertJSONSnapshot(t, got, want)
@@ -5604,6 +5607,7 @@ func TestContract_LegacyMigrationGrandfatherFloorFallbackJSONSnapshot(t *testing
SubscriptionState string `json:"subscription_state"`
Limits []pkglicensing.LimitStatus `json:"limits"`
MonitoredSystemContinuity *pkglicensing.MonitoredSystemContinuityStatus `json:"monitored_system_continuity,omitempty"`
+ MonitoredSystemCapacity *pkglicensing.MonitoredSystemCapacityStatus `json:"monitored_system_capacity,omitempty"`
} `json:"entitlements"`
}{
Status: struct {
@@ -5625,12 +5629,14 @@ func TestContract_LegacyMigrationGrandfatherFloorFallbackJSONSnapshot(t *testing
SubscriptionState string `json:"subscription_state"`
Limits []pkglicensing.LimitStatus `json:"limits"`
MonitoredSystemContinuity *pkglicensing.MonitoredSystemContinuityStatus `json:"monitored_system_continuity,omitempty"`
+ MonitoredSystemCapacity *pkglicensing.MonitoredSystemCapacityStatus `json:"monitored_system_capacity,omitempty"`
}{
Tier: payload.Tier,
PlanVersion: payload.PlanVersion,
SubscriptionState: payload.SubscriptionState,
Limits: payload.Limits,
MonitoredSystemContinuity: payloadContinuity,
+ MonitoredSystemCapacity: payload.MonitoredSystemCapacity,
},
})
if err != nil {
@@ -5650,7 +5656,8 @@ func TestContract_LegacyMigrationGrandfatherFloorFallbackJSONSnapshot(t *testing
"plan_version":"legacy_migration_fallback",
"subscription_state":"active",
"limits":[{"key":"max_monitored_systems","limit":23,"current":23,"current_available":true,"state":"enforced"}],
- "monitored_system_continuity":{"plan_limit":10,"grandfathered_floor":23,"effective_limit":23,"capture_pending":false,"captured_at":123}
+ "monitored_system_continuity":{"plan_limit":10,"grandfathered_floor":23,"effective_limit":23,"capture_pending":false,"captured_at":123},
+ "monitored_system_capacity":{"mode":"at_limit_blocking_new","urgency":"enforced","current":23,"limit":23,"current_available":true,"available_slots":0,"overage":0,"blocks_new_systems":true,"existing_monitoring_continues":true}
}
}`
diff --git a/internal/api/demo_mode_commercial.go b/internal/api/demo_mode_commercial.go
index 043b6b7f70..e58b3bc04f 100644
--- a/internal/api/demo_mode_commercial.go
+++ b/internal/api/demo_mode_commercial.go
@@ -164,6 +164,7 @@ func sanitizeRuntimeCapabilitiesPayloadForPublicDemo(
) RuntimeCapabilitiesPayload {
sanitized := payload
sanitized.Limits = sanitizeLimitStatusesForPublicDemo(payload.Limits)
+ sanitized.MonitoredSystemCapacity = nil
if sanitized.Capabilities == nil {
sanitized.Capabilities = []string{}
}
diff --git a/internal/api/demo_mode_commercial_test.go b/internal/api/demo_mode_commercial_test.go
index 6a0817d17f..7823d953f9 100644
--- a/internal/api/demo_mode_commercial_test.go
+++ b/internal/api/demo_mode_commercial_test.go
@@ -5,6 +5,8 @@ import (
"net/http/httptest"
"strings"
"testing"
+
+ pkglicensing "github.com/rcourtman/pulse-go-rewrite/pkg/licensing"
)
func TestPublicDemoCommercialRouteInventoryCoverage(t *testing.T) {
@@ -51,6 +53,17 @@ func TestSanitizeRuntimeCapabilitiesPayloadForPublicDemo(t *testing.T) {
},
HostedMode: true,
MaxHistoryDays: 90,
+ MonitoredSystemCapacity: &pkglicensing.MonitoredSystemCapacityStatus{
+ Mode: "over_limit_frozen",
+ Urgency: "enforced",
+ Current: 16,
+ Limit: 5,
+ CurrentAvailable: true,
+ AvailableSlots: 0,
+ Overage: 11,
+ BlocksNewSystems: true,
+ ExistingMonitoringContinues: true,
+ },
})
if len(sanitized.Capabilities) != 2 {
@@ -65,6 +78,9 @@ func TestSanitizeRuntimeCapabilitiesPayloadForPublicDemo(t *testing.T) {
if sanitized.MaxHistoryDays != 90 || !sanitized.HostedMode {
t.Fatalf("non-commercial runtime capability fields should be preserved, got max_history_days=%d hosted_mode=%v", sanitized.MaxHistoryDays, sanitized.HostedMode)
}
+ if sanitized.MonitoredSystemCapacity != nil {
+ t.Fatalf("monitored_system_capacity=%+v, want nil after public demo sanitization", sanitized.MonitoredSystemCapacity)
+ }
}
func TestPublicDemoCommercialPolicyForRequestHidesUsagePreviewRoutes(t *testing.T) {
diff --git a/pkg/licensing/entitlement_payload.go b/pkg/licensing/entitlement_payload.go
index ba9b133612..4587424208 100644
--- a/pkg/licensing/entitlement_payload.go
+++ b/pkg/licensing/entitlement_payload.go
@@ -86,6 +86,12 @@ type EntitlementPayload struct {
// MonitoredSystemContinuity exposes migrated monitored-system continuity
// state for billing and support-grade plan-limit presentation.
MonitoredSystemContinuity *MonitoredSystemContinuityStatus `json:"monitored_system_continuity,omitempty"`
+
+ // MonitoredSystemCapacity exposes the canonical monitored-system
+ // admission posture so the frontend can distinguish between a hard cap,
+ // an admission freeze, and uncapped continuity without inferring that
+ // behavior from raw current/limit math.
+ MonitoredSystemCapacity *MonitoredSystemCapacityStatus `json:"monitored_system_capacity,omitempty"`
}
// CommercialPosturePayload is the canonical non-billing commercial contract
@@ -129,6 +135,10 @@ type CommercialPosturePayload struct {
// CommercialMigration reports unresolved paid-license migration work entering
// from v5-era commercial state.
CommercialMigration *CommercialMigrationStatus `json:"commercial_migration,omitempty"`
+
+ // MonitoredSystemCapacity exposes the canonical monitored-system admission
+ // posture without exposing billing identity or plan-term internals.
+ MonitoredSystemCapacity *MonitoredSystemCapacityStatus `json:"monitored_system_capacity,omitempty"`
}
// RuntimeCapabilitiesPayload is the canonical non-commercial license contract
@@ -145,6 +155,10 @@ type RuntimeCapabilitiesPayload struct {
// MaxHistoryDays is the maximum metrics history retention in days for the current tier.
MaxHistoryDays int `json:"max_history_days"`
+
+ // MonitoredSystemCapacity exposes the canonical monitored-system runtime
+ // posture for warning banners and admission-freeze UX.
+ MonitoredSystemCapacity *MonitoredSystemCapacityStatus `json:"monitored_system_capacity,omitempty"`
}
// LimitStatus represents a quantitative limit with current usage state.
@@ -171,6 +185,51 @@ type LimitStatus struct {
State string `json:"state"`
}
+// MonitoredSystemCapacityStatus describes the canonical monitored-system
+// admission posture. It makes explicit that Pulse blocks net-new monitored
+// systems at or above the plan limit while keeping already-counted systems
+// visible and reporting.
+type MonitoredSystemCapacityStatus struct {
+ // Mode is the canonical monitored-system capacity posture.
+ // Values: "usage_unavailable", "unlimited", "within_limit",
+ // "at_limit_blocking_new", "over_limit_frozen"
+ Mode string `json:"mode"`
+
+ // Urgency mirrors the user-facing severity of the current posture.
+ // Values: "ok", "warning", "enforced"
+ Urgency string `json:"urgency"`
+
+ // Current is the observed current monitored-system usage.
+ Current int64 `json:"current"`
+
+ // Limit is the plan limit for monitored systems (0 = unlimited).
+ Limit int64 `json:"limit"`
+
+ // CurrentAvailable reports whether Current reflects a resolved runtime
+ // usage value rather than an unavailable best-effort fallback.
+ CurrentAvailable bool `json:"current_available"`
+
+ // CurrentUnavailableReason explains why Current is unavailable when
+ // CurrentAvailable is false.
+ CurrentUnavailableReason string `json:"current_unavailable_reason,omitempty"`
+
+ // AvailableSlots reports how many net-new monitored systems can be added
+ // before the plan blocks additional admissions.
+ AvailableSlots int64 `json:"available_slots"`
+
+ // Overage reports how far above the current plan limit this installation
+ // is while existing monitoring continues.
+ Overage int64 `json:"overage"`
+
+ // BlocksNewSystems indicates that Pulse will reject net-new monitored
+ // systems until capacity is freed or the plan changes.
+ BlocksNewSystems bool `json:"blocks_new_systems"`
+
+ // ExistingMonitoringContinues indicates that already-counted monitored
+ // systems remain visible and reporting under the current posture.
+ ExistingMonitoringContinues bool `json:"existing_monitoring_continues"`
+}
+
// UpgradeReason provides context for why a user should upgrade.
type UpgradeReason struct {
// Key is the capability or limit this reason relates to.
@@ -264,6 +323,9 @@ func BuildRuntimeCapabilitiesPayloadWithUsage(
Limits: append([]LimitStatus(nil), entitlementPayload.Limits...),
HostedMode: entitlementPayload.HostedMode,
MaxHistoryDays: entitlementPayload.MaxHistoryDays,
+ MonitoredSystemCapacity: cloneMonitoredSystemCapacityStatus(
+ entitlementPayload.MonitoredSystemCapacity,
+ ),
}
}
@@ -300,6 +362,11 @@ func CommercialPosturePayloadFromEntitlementPayload(
if payload.CommercialMigration != nil {
sanitized.CommercialMigration = CloneCommercialMigrationStatus(payload.CommercialMigration)
}
+ if payload.MonitoredSystemCapacity != nil {
+ sanitized.MonitoredSystemCapacity = cloneMonitoredSystemCapacityStatus(
+ payload.MonitoredSystemCapacity,
+ )
+ }
if sanitized.UpgradeReasons == nil {
sanitized.UpgradeReasons = []UpgradeReason{}
}
@@ -350,6 +417,10 @@ func BuildEntitlementPayloadWithUsage(
continuity := *status.MonitoredSystemContinuity
payload.MonitoredSystemContinuity = &continuity
}
+ payload.MonitoredSystemCapacity = buildMonitoredSystemCapacityStatus(
+ int64(status.MaxMonitoredSystems),
+ usage,
+ )
if payload.Capabilities == nil {
payload.Capabilities = []string{}
@@ -451,6 +522,80 @@ func boolPointer(value bool) *bool {
return &v
}
+func buildMonitoredSystemCapacityStatus(
+ limit int64,
+ usage EntitlementUsageSnapshot,
+) *MonitoredSystemCapacityStatus {
+ currentAvailable := usage.monitoredSystemCountAvailable()
+ if !currentAvailable {
+ return &MonitoredSystemCapacityStatus{
+ Mode: "usage_unavailable",
+ Urgency: "ok",
+ Current: 0,
+ Limit: limit,
+ CurrentAvailable: false,
+ CurrentUnavailableReason: usage.monitoredSystemCountUnavailableReason(),
+ AvailableSlots: 0,
+ Overage: 0,
+ BlocksNewSystems: false,
+ ExistingMonitoringContinues: false,
+ }
+ }
+
+ current := usage.monitoredSystemCount()
+ if limit <= 0 {
+ return &MonitoredSystemCapacityStatus{
+ Mode: "unlimited",
+ Urgency: "ok",
+ Current: current,
+ Limit: 0,
+ CurrentAvailable: true,
+ AvailableSlots: 0,
+ Overage: 0,
+ BlocksNewSystems: false,
+ ExistingMonitoringContinues: true,
+ }
+ }
+
+ status := &MonitoredSystemCapacityStatus{
+ Current: current,
+ Limit: limit,
+ CurrentAvailable: true,
+ AvailableSlots: 0,
+ Overage: 0,
+ BlocksNewSystems: false,
+ ExistingMonitoringContinues: true,
+ Urgency: LimitState(current, limit),
+ }
+
+ switch {
+ case current < limit:
+ status.Mode = "within_limit"
+ status.AvailableSlots = limit - current
+ case current == limit:
+ status.Mode = "at_limit_blocking_new"
+ status.BlocksNewSystems = true
+ case current > limit:
+ status.Mode = "over_limit_frozen"
+ status.BlocksNewSystems = true
+ status.Overage = current - limit
+ default:
+ status.Mode = "within_limit"
+ }
+
+ return status
+}
+
+func cloneMonitoredSystemCapacityStatus(
+ status *MonitoredSystemCapacityStatus,
+) *MonitoredSystemCapacityStatus {
+ if status == nil {
+ return nil
+ }
+ cloned := *status
+ return &cloned
+}
+
// LimitState returns the over-limit UX state string.
func LimitState(current, limit int64) string {
if limit <= 0 {
diff --git a/pkg/licensing/entitlement_payload_test.go b/pkg/licensing/entitlement_payload_test.go
index 6638cf94f0..5610058b07 100644
--- a/pkg/licensing/entitlement_payload_test.go
+++ b/pkg/licensing/entitlement_payload_test.go
@@ -154,6 +154,15 @@ func TestBuildEntitlementPayloadWithUsage_CurrentValues(t *testing.T) {
if payload.HasMigrationGap {
t.Fatal("expected has_migration_gap=false under monitored-system counting")
}
+ if payload.MonitoredSystemCapacity == nil {
+ t.Fatal("expected monitored-system capacity posture")
+ }
+ if payload.MonitoredSystemCapacity.Mode != "within_limit" {
+ t.Fatalf("Mode=%q, want within_limit", payload.MonitoredSystemCapacity.Mode)
+ }
+ if payload.MonitoredSystemCapacity.AvailableSlots != 38 {
+ t.Fatalf("AvailableSlots=%d, want 38", payload.MonitoredSystemCapacity.AvailableSlots)
+ }
}
func TestBuildEntitlementPayload_TrialState(t *testing.T) {
@@ -232,6 +241,15 @@ func TestBuildEntitlementPayloadWithUsage_MonitoredSystemUsageUnavailable(t *tes
if payload.Limits[0].CurrentUnavailableReason != "supplemental_inventory_unsettled" {
t.Fatalf("CurrentUnavailableReason=%q, want %q", payload.Limits[0].CurrentUnavailableReason, "supplemental_inventory_unsettled")
}
+ if payload.MonitoredSystemCapacity == nil {
+ t.Fatal("expected monitored-system capacity posture")
+ }
+ if payload.MonitoredSystemCapacity.Mode != "usage_unavailable" {
+ t.Fatalf("Mode=%q, want usage_unavailable", payload.MonitoredSystemCapacity.Mode)
+ }
+ if payload.MonitoredSystemCapacity.CurrentAvailable {
+ t.Fatalf("CurrentAvailable=%v, want false", payload.MonitoredSystemCapacity.CurrentAvailable)
+ }
}
func TestBuildEntitlementPayloadWithUsage_CopiesMonitoredSystemContinuity(t *testing.T) {
@@ -269,6 +287,15 @@ func TestBuildEntitlementPayloadWithUsage_CopiesMonitoredSystemContinuity(t *tes
if payload.MonitoredSystemContinuity.CapturePending {
t.Fatal("expected continuity capture to be settled")
}
+ if payload.MonitoredSystemCapacity == nil {
+ t.Fatal("expected monitored-system capacity posture")
+ }
+ if payload.MonitoredSystemCapacity.Mode != "at_limit_blocking_new" {
+ t.Fatalf("Mode=%q, want at_limit_blocking_new", payload.MonitoredSystemCapacity.Mode)
+ }
+ if !payload.MonitoredSystemCapacity.BlocksNewSystems {
+ t.Fatal("expected at-limit posture to block new monitored systems")
+ }
}
func TestBuildEntitlementPayload_CopiesStatusDisplayFields(t *testing.T) {
@@ -343,6 +370,12 @@ func TestBuildEntitlementPayload_LifetimeOmitsCommercialCaps(t *testing.T) {
if len(payload.Limits) != 0 {
t.Fatalf("expected lifetime entitlements to omit commercial caps, got %+v", payload.Limits)
}
+ if payload.MonitoredSystemCapacity == nil {
+ t.Fatal("expected lifetime payload to include monitored-system capacity posture")
+ }
+ if payload.MonitoredSystemCapacity.Mode != "unlimited" {
+ t.Fatalf("Mode=%q, want unlimited", payload.MonitoredSystemCapacity.Mode)
+ }
}
func TestBuildEntitlementPayload_MaxHistoryDays(t *testing.T) {
@@ -420,6 +453,15 @@ func TestBuildCommercialPosturePayloadWithUsage_CurrentValues(t *testing.T) {
if payload.HasMigrationGap {
t.Fatal("expected has_migration_gap=false under canonical monitored-system counting")
}
+ if payload.MonitoredSystemCapacity == nil {
+ t.Fatal("expected commercial posture to preserve monitored-system capacity")
+ }
+ if payload.MonitoredSystemCapacity.Mode != "over_limit_frozen" {
+ t.Fatalf("Mode=%q, want over_limit_frozen", payload.MonitoredSystemCapacity.Mode)
+ }
+ if payload.MonitoredSystemCapacity.Overage != 2 {
+ t.Fatalf("Overage=%d, want 2", payload.MonitoredSystemCapacity.Overage)
+ }
}
func TestCommercialPosturePayloadFromEntitlementPayload_StripsBillingIdentityFields(t *testing.T) {
@@ -453,6 +495,12 @@ func TestCommercialPosturePayloadFromEntitlementPayload_StripsBillingIdentityFie
if posture.LegacyConnections.ProxmoxNodes != 1 {
t.Fatalf("expected proxmox_nodes=1, got %+v", posture.LegacyConnections)
}
+ if posture.MonitoredSystemCapacity == nil {
+ t.Fatal("expected commercial posture to preserve monitored-system capacity posture")
+ }
+ if posture.MonitoredSystemCapacity.Mode != "within_limit" {
+ t.Fatalf("Mode=%q, want within_limit", posture.MonitoredSystemCapacity.Mode)
+ }
body, err := json.Marshal(posture)
if err != nil {
@@ -505,6 +553,12 @@ func TestBuildRuntimeCapabilitiesPayloadWithUsage_CurrentValues(t *testing.T) {
if payload.Limits[0].CurrentAvailable == nil || !*payload.Limits[0].CurrentAvailable {
t.Fatalf("expected runtime current availability true, got %+v", payload.Limits[0].CurrentAvailable)
}
+ if payload.MonitoredSystemCapacity == nil {
+ t.Fatal("expected runtime capabilities to include monitored-system capacity posture")
+ }
+ if payload.MonitoredSystemCapacity.Mode != "within_limit" {
+ t.Fatalf("Mode=%q, want within_limit", payload.MonitoredSystemCapacity.Mode)
+ }
}
func TestBuildRuntimeCapabilitiesPayloadWithUsage_StripsInternalOnlyCapabilities(t *testing.T) {
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 4f011d66ba..bbcbed98e7 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -4792,12 +4792,12 @@ class SubsystemLookupTest(unittest.TestCase):
),
_contract_reference(
"docs/release-control/v6/internal/subsystems/api-contracts.md",
- "21. Keep hosted AI settings bootstrap on the shared API contract",
+ "22. Keep hosted AI settings bootstrap on the shared API contract",
"internal/api/ai_handler.go",
),
_contract_reference(
"docs/release-control/v6/internal/subsystems/api-contracts.md",
- "22. Keep post-boot AI enablement contract-backed on the shared AI/mobile approval surface",
+ "23. Keep post-boot AI enablement contract-backed on the shared AI/mobile approval surface",
"internal/api/ai_handler.go",
),
]
@@ -4836,12 +4836,12 @@ class SubsystemLookupTest(unittest.TestCase):
)["line"],
_contract_reference(
"docs/release-control/v6/internal/subsystems/api-contracts.md",
- "21. Keep hosted AI settings bootstrap on the shared API contract",
+ "22. Keep hosted AI settings bootstrap on the shared API contract",
"internal/api/ai_handler.go",
)["line"],
_contract_reference(
"docs/release-control/v6/internal/subsystems/api-contracts.md",
- "22. Keep post-boot AI enablement contract-backed on the shared AI/mobile approval surface",
+ "23. Keep post-boot AI enablement contract-backed on the shared AI/mobile approval surface",
"internal/api/ai_handler.go",
)["line"],
],
diff --git a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
index d82a75eba9..8092802456 100644
--- a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
+++ b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
@@ -1,15 +1,26 @@
-import { test, expect, type Page } from '@playwright/test';
+import { test, expect, type Page } from "@playwright/test";
-const DEV_SERVER_URL = 'http://127.0.0.1:5173';
+const DEV_SERVER_URL = "http://127.0.0.1:5173";
const MONITORED_SYSTEM_ENTITLEMENTS = {
capabilities: [],
limits: [
- { key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' },
+ { key: "max_monitored_systems", limit: 5, current: 16, state: "enforced" },
],
- subscription_state: 'expired',
+ monitored_system_capacity: {
+ mode: "over_limit_frozen",
+ urgency: "enforced",
+ current: 16,
+ limit: 5,
+ current_available: true,
+ available_slots: 0,
+ overage: 11,
+ blocks_new_systems: true,
+ existing_monitoring_continues: true,
+ },
+ subscription_state: "expired",
upgrade_reasons: [],
- tier: 'free',
+ tier: "free",
trial_eligible: false,
hosted_mode: false,
legacy_connections: {
@@ -24,36 +35,82 @@ const MONITORED_SYSTEM_ENTITLEMENTS = {
const MONITORED_SYSTEM_RUNTIME_CAPABILITIES = {
capabilities: [],
limits: [
- { key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' },
+ { key: "max_monitored_systems", limit: 5, current: 16, state: "enforced" },
],
+ monitored_system_capacity: {
+ mode: "over_limit_frozen",
+ urgency: "enforced",
+ current: 16,
+ limit: 5,
+ current_available: true,
+ available_slots: 0,
+ overage: 11,
+ blocks_new_systems: true,
+ existing_monitoring_continues: true,
+ },
hosted_mode: false,
max_history_days: 90,
};
const UNAVAILABLE_MONITORED_SYSTEM_LIMIT = {
- key: 'max_monitored_systems',
+ key: "max_monitored_systems",
limit: 5,
current: 0,
current_available: false,
- current_unavailable_reason: 'supplemental_inventory_unsettled',
- state: 'enforced',
+ current_unavailable_reason: "supplemental_inventory_unsettled",
+ state: "enforced",
};
const UNAVAILABLE_MONITORED_SYSTEM_ENTITLEMENTS = {
...MONITORED_SYSTEM_ENTITLEMENTS,
limits: [UNAVAILABLE_MONITORED_SYSTEM_LIMIT],
+ monitored_system_capacity: {
+ mode: "usage_unavailable",
+ urgency: "ok",
+ current: 0,
+ limit: 5,
+ current_available: false,
+ current_unavailable_reason: "supplemental_inventory_unsettled",
+ available_slots: 0,
+ overage: 0,
+ blocks_new_systems: false,
+ existing_monitoring_continues: false,
+ },
};
const UNAVAILABLE_MONITORED_SYSTEM_RUNTIME_CAPABILITIES = {
...MONITORED_SYSTEM_RUNTIME_CAPABILITIES,
limits: [UNAVAILABLE_MONITORED_SYSTEM_LIMIT],
+ monitored_system_capacity: {
+ mode: "usage_unavailable",
+ urgency: "ok",
+ current: 0,
+ limit: 5,
+ current_available: false,
+ current_unavailable_reason: "supplemental_inventory_unsettled",
+ available_slots: 0,
+ overage: 0,
+ blocks_new_systems: false,
+ existing_monitoring_continues: false,
+ },
};
const MONITORED_SYSTEM_COMMERCIAL_POSTURE = {
- subscription_state: 'expired',
+ subscription_state: "expired",
upgrade_reasons: [],
- tier: 'free',
+ tier: "free",
trial_eligible: false,
+ monitored_system_capacity: {
+ mode: "over_limit_frozen",
+ urgency: "enforced",
+ current: 16,
+ limit: 5,
+ current_available: true,
+ available_slots: 0,
+ overage: 11,
+ blocks_new_systems: true,
+ existing_monitoring_continues: true,
+ },
legacy_connections: {
proxmox_nodes: 0,
docker_hosts: 0,
@@ -66,27 +123,27 @@ const MONITORED_SYSTEM_COMMERCIAL_POSTURE = {
const MONITORED_SYSTEM_LEDGER = {
systems: [
{
- name: 'edge-cluster',
- type: 'cluster',
- status: 'warning',
+ name: "edge-cluster",
+ type: "cluster",
+ status: "warning",
status_explanation: {
summary:
- 'At least one included source has a warning state, so Pulse keeps this monitored system under review.',
+ "At least one included source has a warning state, so Pulse keeps this monitored system under review.",
reasons: [],
},
latest_included_signal: {
- name: 'edge-cluster',
- type: 'cluster',
- source: 'kubernetes',
- at: '2026-04-07T09:00:00Z',
+ name: "edge-cluster",
+ type: "cluster",
+ source: "kubernetes",
+ at: "2026-04-07T09:00:00Z",
},
- source: 'kubernetes',
+ source: "kubernetes",
explanation: {
summary:
- 'Counts as one monitored system because Pulse merged multiple top-level views into one canonical cluster.',
+ "Counts as one monitored system because Pulse merged multiple top-level views into one canonical cluster.",
reasons: [],
surfaces: [
- { name: 'edge-cluster', type: 'cluster', source: 'kubernetes' },
+ { name: "edge-cluster", type: "cluster", source: "kubernetes" },
],
},
},
@@ -114,13 +171,13 @@ async function configureMonitoredSystemBillingFixtures(
fixtures.runtimeCapabilities ?? MONITORED_SYSTEM_RUNTIME_CAPABILITIES;
await page.addInitScript(() => {
- localStorage.setItem('pulse_whats_new_v2_shown', 'true');
+ localStorage.setItem("pulse_whats_new_v2_shown", "true");
});
- await page.route('**/api/security/status', async (route) => {
+ await page.route("**/api/security/status", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
hasAuthentication: true,
hideLocalLogin: false,
@@ -130,58 +187,58 @@ async function configureMonitoredSystemBillingFixtures(
});
});
- await page.route('**/api/state', async (route) => {
+ await page.route("**/api/state", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({ ok: true }),
});
});
- await page.route('**/api/system/settings', async (route) => {
+ await page.route("**/api/system/settings", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify({
- theme: 'system',
+ theme: "system",
fullWidthMode: false,
}),
});
});
- await page.route('**/api/license/runtime-capabilities', async (route) => {
+ await page.route("**/api/license/runtime-capabilities", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify(runtimeCapabilities),
});
});
- await page.route('**/api/license/entitlements', async (route) => {
+ await page.route("**/api/license/entitlements", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify(entitlements),
});
});
- await page.route('**/api/license/commercial-posture', async (route) => {
+ await page.route("**/api/license/commercial-posture", async (route) => {
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify(commercialPosture),
});
});
await page.route(
- '**/api/license/monitored-system-ledger**',
+ "**/api/license/monitored-system-ledger**",
async (route) => {
- const payload = route.request().url().endsWith('/explain')
+ const payload = route.request().url().endsWith("/explain")
? { ledger, preview: null }
: ledger;
await route.fulfill({
status: 200,
- contentType: 'application/json',
+ contentType: "application/json",
body: JSON.stringify(payload),
});
},
@@ -190,84 +247,82 @@ async function configureMonitoredSystemBillingFixtures(
async function openPageWithUrgentMonitoredSystemBanner(page: Page) {
await page.goto(`${DEV_SERVER_URL}/settings/system-general`, {
- waitUntil: 'domcontentloaded',
+ waitUntil: "domcontentloaded",
});
await expect(
- page
- .getByRole('status')
- .filter({ hasText: '16 monitored systems currently counted' }),
+ page.getByRole("status").filter({ hasText: "over plan by 11" }),
).toBeVisible();
}
-test.describe('Monitored-system billing focus', () => {
- test('keeps Learn more and Upgrade arrivals distinct on the billing surface', async ({
+test.describe("Monitored-system billing focus", () => {
+ test("keeps Learn more and Upgrade arrivals distinct on the billing surface", async ({
page,
}, testInfo) => {
test.skip(
- testInfo.project.name.startsWith('mobile-'),
- 'Desktop-only billing navigation',
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop-only billing navigation",
);
await configureMonitoredSystemBillingFixtures(page);
await openPageWithUrgentMonitoredSystemBanner(page);
const banner = page
- .getByRole('status')
- .filter({ hasText: '16 monitored systems currently counted' });
+ .getByRole("status")
+ .filter({ hasText: "over plan by 11" });
- await banner.getByRole('link', { name: 'Learn more' }).click();
+ await banner.getByRole("link", { name: "Learn more" }).click();
await page.waitForURL(
- '**/settings/system/billing/usage?details=counting-rules',
+ "**/settings/system/billing/usage?details=counting-rules",
);
- await expect(page.getByRole('tab', { name: 'Usage' })).toHaveAttribute(
- 'aria-selected',
- 'true',
+ await expect(page.getByRole("tab", { name: "Usage" })).toHaveAttribute(
+ "aria-selected",
+ "true",
);
await expect(
- page.getByRole('button', { name: 'Hide counting rules' }),
+ page.getByRole("button", { name: "Hide counting rules" }),
).toBeVisible();
- await expect(page.getByText('Counts as 1 monitored system')).toBeVisible();
- await expect(page.getByText('1 grouped source')).toBeVisible();
+ await expect(page.getByText("Counts as 1 monitored system")).toBeVisible();
+ await expect(page.getByText("1 grouped source")).toBeVisible();
await expect(
page
.getByText(
- 'Counts as one monitored system because Pulse merged multiple top-level views into one canonical cluster.',
+ "Counts as one monitored system because Pulse merged multiple top-level views into one canonical cluster.",
)
.first(),
).toBeVisible();
await expect(
- page.getByText('edge-cluster (Cluster via Kubernetes)').first(),
+ page.getByText("edge-cluster (Cluster via Kubernetes)").first(),
).toBeVisible();
await openPageWithUrgentMonitoredSystemBanner(page);
- await banner.getByRole('link', { name: 'Upgrade to add more' }).click();
+ await banner.getByRole("link", { name: "Upgrade to add more" }).click();
await page.waitForURL(
- '**/settings/system/billing/plan?intent=max_monitored_systems',
+ "**/settings/system/billing/plan?intent=max_monitored_systems",
);
- await expect(page.getByRole('tab', { name: 'Plan' })).toHaveAttribute(
- 'aria-selected',
- 'true',
+ await expect(page.getByRole("tab", { name: "Plan" })).toHaveAttribute(
+ "aria-selected",
+ "true",
);
await expect(
- page.getByText('Need a higher monitored-system cap?'),
+ page.getByText("Need a higher monitored-system cap?"),
).toBeVisible();
- await expect(page.getByText('Redeem existing key')).toBeVisible();
- await expect(page.getByLabel('Pulse Pro Key')).toBeHidden();
+ await expect(page.getByText("Redeem existing key")).toBeVisible();
+ await expect(page.getByLabel("Pulse Pro Key")).toBeHidden();
await expect(
- page.getByRole('link', { name: 'Compare plans' }),
+ page.getByRole("link", { name: "Compare plans" }),
).toHaveAttribute(
- 'href',
- '/auth/license-purchase-start?feature=max_monitored_systems',
+ "href",
+ "/auth/license-purchase-start?feature=max_monitored_systems",
);
});
- test('does not show upgrade pressure while monitored-system usage is unavailable', async ({
+ test("does not show upgrade pressure while monitored-system usage is unavailable", async ({
page,
}, testInfo) => {
test.skip(
- testInfo.project.name.startsWith('mobile-'),
- 'Desktop-only billing navigation',
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop-only billing navigation",
);
await configureMonitoredSystemBillingFixtures(page, {
@@ -276,16 +331,14 @@ test.describe('Monitored-system billing focus', () => {
});
await page.goto(`${DEV_SERVER_URL}/settings/system-general`, {
- waitUntil: 'domcontentloaded',
+ waitUntil: "domcontentloaded",
});
await expect(
- page
- .getByRole('status')
- .filter({ hasText: 'monitored systems currently counted' }),
+ page.getByRole("status").filter({ hasText: "over plan by 11" }),
).toHaveCount(0);
await expect(
- page.getByRole('link', { name: 'Upgrade to add more' }),
+ page.getByRole("link", { name: "Upgrade to add more" }),
).toHaveCount(0);
});
});