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.

Hide monitored-system explanation surfaces in demo mode

rcourtmanc76b4c209469
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 4c67a0c7a7..836e6db704 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -341,7 +341,9 @@ That same adjacent `internal/api/` boundary now also keeps public demos from
leaking commercial state through lifecycle-adjacent surfaces. Agent install,
reporting, and setup flows may share backend helpers with billing or license
transport, but `DEMO_MODE` must continue to 404 commercial read surfaces
-instead of teaching lifecycle or mock-mode paths to bypass licensing. Public
+instead of teaching lifecycle or mock-mode paths to bypass licensing. That
+same boundary also hides monitored-system explanation and provider preview
+routes used by lifecycle-adjacent platform connections. Public
demo readiness therefore comes from hiding commercial presentation on the
shared API boundary, not from introducing a second fake-entitlement path into
lifecycle-owned install or reporting flows. Browser-facing lifecycle surfaces
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 12abf13628..a2e464dca4 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -75,7 +75,7 @@ Own canonical runtime payload shapes between backend and frontend.
50. `internal/cloudcp/portal/frontend_sync_test.go`
51. `internal/api/recovery_handlers.go`
52. `internal/api/config_setup_handlers.go`
-53. `internal/api/demo_mode_commercial.go`
+53. `internal/api/demo_mode_commercial.go`: the canonical public-demo commercial route policy, including monitored-system ledger, explanation, and provider preview surfaces.
54. `internal/api/security_status_capabilities.go`
55. `internal/api/demo_middleware.go`
56. `frontend-modern/src/stores/aiRuntimeState.ts`
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 95403ce9bc..54c8f9d299 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -344,9 +344,10 @@ an empty estate.
That same adjacent `internal/api/` boundary now also governs public-demo
commercial redaction for storage and recovery viewers. Shared storage/recovery
surfaces may run beside a demo runtime that has real internal entitlements,
-but `DEMO_MODE` must still 404 license-status, billing-state, and monitored-
-system-ledger reads so adjacent recovery or storage pages do not leak
-commercial identity or upgrade posture into a public demo. Storage/recovery
+but `DEMO_MODE` must still 404 license-status, billing-state, monitored-
+system-ledger reads, and monitored-system explanation/provider preview routes
+so adjacent recovery or storage pages do not leak commercial identity or
+upgrade posture into a public demo. Storage/recovery
must consume that redacted boundary as presentation truth rather than
reintroducing mock-only license bypasses or page-local commercial fallbacks.
Browser-facing storage/recovery surfaces must also treat
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 91983adeae..0eee90500e 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -3346,6 +3346,301 @@ func TestContract_MonitoredSystemLedgerJSONSnapshot(t *testing.T) {
assertJSONSnapshot(t, got, want)
}
+func TestContract_MonitoredSystemLedgerPreviewJSONSnapshot(t *testing.T) {
+ payload := MonitoredSystemLedgerPreviewResponse{
+ CurrentCount: 1,
+ ProjectedCount: 1,
+ AdditionalCount: 0,
+ Limit: 5,
+ WouldExceedLimit: false,
+ Effect: "attaches_existing",
+ CurrentSystems: []MonitoredSystemLedgerEntry{
+ {
+ Name: "Tower",
+ Type: "host",
+ Status: "online",
+ StatusExplanation: MonitoredSystemLedgerStatusExplanation{
+ Summary: "All included top-level collection paths currently report online status.",
+ Reasons: []MonitoredSystemLedgerStatusReason{},
+ },
+ LatestIncludedSignal: MonitoredSystemLedgerLatestSignal{
+ Name: "Tower",
+ Type: "host",
+ Source: "agent",
+ At: "2026-03-18T17:30:00Z",
+ },
+ Source: "agent",
+ Explanation: MonitoredSystemLedgerExplanation{
+ Summary: "Counts as one monitored system because Pulse sees one top-level host view from agent.",
+ Reasons: []MonitoredSystemLedgerExplanationReason{
+ {
+ Kind: "standalone",
+ Signal: "single-top-level-view",
+ Summary: "No overlapping top-level source matched this system.",
+ },
+ },
+ Surfaces: []MonitoredSystemLedgerExplanationSurface{
+ {Name: "Tower", Type: "host", Source: "agent"},
+ },
+ },
+ },
+ },
+ ProjectedSystems: []MonitoredSystemLedgerEntry{
+ {
+ Name: "tower",
+ Type: "proxmox-node",
+ Status: "online",
+ StatusExplanation: MonitoredSystemLedgerStatusExplanation{
+ Summary: "All included top-level collection paths currently report online status.",
+ Reasons: []MonitoredSystemLedgerStatusReason{},
+ },
+ LatestIncludedSignal: MonitoredSystemLedgerLatestSignal{
+ Name: "tower",
+ Type: "proxmox-node",
+ Source: "proxmox",
+ At: "2026-03-18T17:35:00Z",
+ },
+ Source: "multiple",
+ Explanation: MonitoredSystemLedgerExplanation{
+ Summary: "Counts as one monitored system because Pulse merged 2 top-level views into one canonical system using shared machine identity.",
+ Reasons: []MonitoredSystemLedgerExplanationReason{
+ {
+ Kind: "grouped",
+ Signal: "identity-match",
+ Summary: "Pulse matched these top-level views by shared canonical machine identity.",
+ },
+ },
+ Surfaces: []MonitoredSystemLedgerExplanationSurface{
+ {Name: "Tower", Type: "host", Source: "agent"},
+ {Name: "tower", Type: "proxmox-node", Source: "proxmox"},
+ },
+ },
+ },
+ },
+ CurrentSystem: &MonitoredSystemLedgerEntry{
+ Name: "Tower",
+ Type: "host",
+ Status: "online",
+ StatusExplanation: MonitoredSystemLedgerStatusExplanation{
+ Summary: "All included top-level collection paths currently report online status.",
+ Reasons: []MonitoredSystemLedgerStatusReason{},
+ },
+ LatestIncludedSignal: MonitoredSystemLedgerLatestSignal{
+ Name: "Tower",
+ Type: "host",
+ Source: "agent",
+ At: "2026-03-18T17:30:00Z",
+ },
+ Source: "agent",
+ Explanation: MonitoredSystemLedgerExplanation{
+ Summary: "Counts as one monitored system because Pulse sees one top-level host view from agent.",
+ Reasons: []MonitoredSystemLedgerExplanationReason{
+ {
+ Kind: "standalone",
+ Signal: "single-top-level-view",
+ Summary: "No overlapping top-level source matched this system.",
+ },
+ },
+ Surfaces: []MonitoredSystemLedgerExplanationSurface{
+ {Name: "Tower", Type: "host", Source: "agent"},
+ },
+ },
+ },
+ ProjectedSystem: &MonitoredSystemLedgerEntry{
+ Name: "tower",
+ Type: "proxmox-node",
+ Status: "online",
+ StatusExplanation: MonitoredSystemLedgerStatusExplanation{
+ Summary: "All included top-level collection paths currently report online status.",
+ Reasons: []MonitoredSystemLedgerStatusReason{},
+ },
+ LatestIncludedSignal: MonitoredSystemLedgerLatestSignal{
+ Name: "tower",
+ Type: "proxmox-node",
+ Source: "proxmox",
+ At: "2026-03-18T17:35:00Z",
+ },
+ Source: "multiple",
+ Explanation: MonitoredSystemLedgerExplanation{
+ Summary: "Counts as one monitored system because Pulse merged 2 top-level views into one canonical system using shared machine identity.",
+ Reasons: []MonitoredSystemLedgerExplanationReason{
+ {
+ Kind: "grouped",
+ Signal: "identity-match",
+ Summary: "Pulse matched these top-level views by shared canonical machine identity.",
+ },
+ },
+ Surfaces: []MonitoredSystemLedgerExplanationSurface{
+ {Name: "Tower", Type: "host", Source: "agent"},
+ {Name: "tower", Type: "proxmox-node", Source: "proxmox"},
+ },
+ },
+ },
+ }
+
+ got, err := json.Marshal(payload.NormalizeCollections())
+ if err != nil {
+ t.Fatalf("marshal monitored system ledger preview response: %v", err)
+ }
+
+ const want = `{
+ "current_count":1,
+ "projected_count":1,
+ "additional_count":0,
+ "limit":5,
+ "would_exceed_limit":false,
+ "effect":"attaches_existing",
+ "current_systems":[
+ {
+ "name":"Tower",
+ "type":"host",
+ "status":"online",
+ "status_explanation":{
+ "summary":"All included top-level collection paths currently report online status.",
+ "reasons":[]
+ },
+ "latest_included_signal":{
+ "name":"Tower",
+ "type":"host",
+ "source":"agent",
+ "at":"2026-03-18T17:30:00Z"
+ },
+ "source":"agent",
+ "explanation":{
+ "summary":"Counts as one monitored system because Pulse sees one top-level host view from agent.",
+ "reasons":[
+ {
+ "kind":"standalone",
+ "signal":"single-top-level-view",
+ "summary":"No overlapping top-level source matched this system."
+ }
+ ],
+ "surfaces":[
+ {
+ "name":"Tower",
+ "type":"host",
+ "source":"agent"
+ }
+ ]
+ }
+ }
+ ],
+ "projected_systems":[
+ {
+ "name":"tower",
+ "type":"proxmox-node",
+ "status":"online",
+ "status_explanation":{
+ "summary":"All included top-level collection paths currently report online status.",
+ "reasons":[]
+ },
+ "latest_included_signal":{
+ "name":"tower",
+ "type":"proxmox-node",
+ "source":"proxmox",
+ "at":"2026-03-18T17:35:00Z"
+ },
+ "source":"multiple",
+ "explanation":{
+ "summary":"Counts as one monitored system because Pulse merged 2 top-level views into one canonical system using shared machine identity.",
+ "reasons":[
+ {
+ "kind":"grouped",
+ "signal":"identity-match",
+ "summary":"Pulse matched these top-level views by shared canonical machine identity."
+ }
+ ],
+ "surfaces":[
+ {
+ "name":"Tower",
+ "type":"host",
+ "source":"agent"
+ },
+ {
+ "name":"tower",
+ "type":"proxmox-node",
+ "source":"proxmox"
+ }
+ ]
+ }
+ }
+ ],
+ "current_system":{
+ "name":"Tower",
+ "type":"host",
+ "status":"online",
+ "status_explanation":{
+ "summary":"All included top-level collection paths currently report online status.",
+ "reasons":[]
+ },
+ "latest_included_signal":{
+ "name":"Tower",
+ "type":"host",
+ "source":"agent",
+ "at":"2026-03-18T17:30:00Z"
+ },
+ "source":"agent",
+ "explanation":{
+ "summary":"Counts as one monitored system because Pulse sees one top-level host view from agent.",
+ "reasons":[
+ {
+ "kind":"standalone",
+ "signal":"single-top-level-view",
+ "summary":"No overlapping top-level source matched this system."
+ }
+ ],
+ "surfaces":[
+ {
+ "name":"Tower",
+ "type":"host",
+ "source":"agent"
+ }
+ ]
+ }
+ },
+ "projected_system":{
+ "name":"tower",
+ "type":"proxmox-node",
+ "status":"online",
+ "status_explanation":{
+ "summary":"All included top-level collection paths currently report online status.",
+ "reasons":[]
+ },
+ "latest_included_signal":{
+ "name":"tower",
+ "type":"proxmox-node",
+ "source":"proxmox",
+ "at":"2026-03-18T17:35:00Z"
+ },
+ "source":"multiple",
+ "explanation":{
+ "summary":"Counts as one monitored system because Pulse merged 2 top-level views into one canonical system using shared machine identity.",
+ "reasons":[
+ {
+ "kind":"grouped",
+ "signal":"identity-match",
+ "summary":"Pulse matched these top-level views by shared canonical machine identity."
+ }
+ ],
+ "surfaces":[
+ {
+ "name":"Tower",
+ "type":"host",
+ "source":"agent"
+ },
+ {
+ "name":"tower",
+ "type":"proxmox-node",
+ "source":"proxmox"
+ }
+ ]
+ }
+ }
+ }`
+
+ assertJSONSnapshot(t, got, want)
+}
+
func TestContract_MonitoredSystemLedgerDoesNotEmitCompatibilityAliases(t *testing.T) {
entry := monitoredSystemLedgerEntry(unifiedresources.MonitoredSystemRecord{
Name: "Tower",
@@ -5124,6 +5419,12 @@ func TestContract_DemoModeCommercialSurfacePolicy(t *testing.T) {
{method: http.MethodPost, path: "/api/license/clear"},
{method: http.MethodPost, path: "/api/license/trial/start"},
{method: http.MethodGet, path: "/api/license/monitored-system-ledger"},
+ {method: http.MethodPost, path: "/api/license/monitored-system-ledger/explain"},
+ {method: http.MethodPost, path: "/api/license/monitored-system-ledger/preview"},
+ {method: http.MethodPost, path: "/api/truenas/connections/preview"},
+ {method: http.MethodPost, path: "/api/truenas/connections/conn-1/preview"},
+ {method: http.MethodPost, path: "/api/vmware/connections/preview"},
+ {method: http.MethodPost, path: "/api/vmware/connections/conn-1/preview"},
{method: http.MethodGet, path: "/api/admin/orgs/t-tenant/billing-state"},
{method: http.MethodPut, path: "/api/admin/orgs/t-tenant/billing-state"},
{method: http.MethodGet, path: "/api/upgrade-metrics/stats"},
diff --git a/internal/api/demo_mode_commercial.go b/internal/api/demo_mode_commercial.go
index 76ceac334f..043b6b7f70 100644
--- a/internal/api/demo_mode_commercial.go
+++ b/internal/api/demo_mode_commercial.go
@@ -63,6 +63,36 @@ var publicDemoCommercialPolicies = []publicDemoCommercialRoutePolicy{
exposure: publicDemoCommercialExposureHidden,
matches: exactDemoCommercialMethodPath(http.MethodGet, "/api/license/monitored-system-ledger"),
},
+ {
+ route: "POST /api/license/monitored-system-ledger/explain",
+ exposure: publicDemoCommercialExposureHidden,
+ matches: exactDemoCommercialMethodPath(http.MethodPost, "/api/license/monitored-system-ledger/explain"),
+ },
+ {
+ route: "POST /api/license/monitored-system-ledger/preview",
+ exposure: publicDemoCommercialExposureHidden,
+ matches: exactDemoCommercialMethodPath(http.MethodPost, "/api/license/monitored-system-ledger/preview"),
+ },
+ {
+ route: "POST /api/truenas/connections/preview",
+ exposure: publicDemoCommercialExposureHidden,
+ matches: exactDemoCommercialMethodPath(http.MethodPost, "/api/truenas/connections/preview"),
+ },
+ {
+ route: "POST /api/truenas/connections/{id}/preview",
+ exposure: publicDemoCommercialExposureHidden,
+ matches: exactDemoCommercialConnectionActionPath(http.MethodPost, "/api/truenas/connections/", "preview"),
+ },
+ {
+ route: "POST /api/vmware/connections/preview",
+ exposure: publicDemoCommercialExposureHidden,
+ matches: exactDemoCommercialMethodPath(http.MethodPost, "/api/vmware/connections/preview"),
+ },
+ {
+ route: "POST /api/vmware/connections/{id}/preview",
+ exposure: publicDemoCommercialExposureHidden,
+ matches: exactDemoCommercialConnectionActionPath(http.MethodPost, "/api/vmware/connections/", "preview"),
+ },
{
route: "POST /api/upgrade-metrics/events",
exposure: publicDemoCommercialExposureHidden,
@@ -194,6 +224,28 @@ func exactDemoCommercialOrgBillingStatePath(method string) func(*http.Request) b
}
}
+func exactDemoCommercialConnectionActionPath(
+ method string,
+ prefix string,
+ action string,
+) func(*http.Request) bool {
+ return func(r *http.Request) bool {
+ if r == nil || r.Method != method || r.URL == nil {
+ return false
+ }
+ path := normalizeDemoCommercialPath(r.URL.Path)
+ if !strings.HasPrefix(path, prefix) {
+ return false
+ }
+ trimmed := strings.Trim(strings.TrimPrefix(path, prefix), "/")
+ if !strings.HasSuffix(trimmed, "/"+action) {
+ return false
+ }
+ id := strings.TrimSuffix(trimmed, "/"+action)
+ return strings.TrimSpace(id) != "" && !strings.Contains(id, "/")
+ }
+}
+
func normalizeDemoCommercialPath(path string) string {
path = strings.TrimSpace(path)
if path == "" {