Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Require canonical monitored-system usage availability
rcourtman46a262f19ddc
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex ecf3845cf9..3412bff344 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -673,6 +673,11 @@ When canonical usage is not safe to read yet and the backend returns`monitored_system_usage_unavailable` or entitlements mark the monitored-systemcurrent count unavailable, the usage surface must render helper-ownedverification copy instead of a synthetic `0 / limit` ledger total.+The entitlement payload builder must only mark monitored-system usage available+from an explicit canonical `MonitoredSystemsAvailable` signal supplied by the+runtime usage boundary. Deprecated compatibility aliases such as `Nodes`, or a+non-zero raw monitored-system count without that availability signal, must not+drive current usage, limit state, or customer-facing cap warnings.The same usage view must also render monitored-system continuity context fromthe entitlement payload, including the base plan limit, effective limit,grandfathered floor, and capture state, so migration protection is visiblediff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 3c3567c152..36484aa1b3 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -5081,7 +5081,8 @@ func TestContract_EntitlementPayloadMonitoredSystemUsageJSONSnapshot(t *testing.Features: append([]string(nil), pkglicensing.TierFeatures[pkglicensing.TierPro]...),MaxMonitoredSystems: 15,}, string(pkglicensing.SubStateActive), entitlementUsageSnapshot{- MonitoredSystems: 7,+ MonitoredSystems: 7,+ MonitoredSystemsAvailable: true,LegacyConnections: legacyConnectionCountsModel{ProxmoxNodes: 2,DockerHosts: 1,diff --git a/internal/api/entitlement_handlers_test.go b/internal/api/entitlement_handlers_test.goindex c13d138767..b3d5ff3d29 100644--- a/internal/api/entitlement_handlers_test.go+++ b/internal/api/entitlement_handlers_test.go@@ -91,8 +91,9 @@ func TestBuildEntitlementPayloadWithUsage_CurrentValues(t *testing.T) {}payload := buildEntitlementPayloadWithUsage(status, "", entitlementUsageSnapshot{- MonitoredSystems: 12,- Guests: 44,+ MonitoredSystems: 12,+ MonitoredSystemsAvailable: true,+ Guests: 44,LegacyConnections: pkglicensing.LegacyConnectionCounts{ProxmoxNodes: 2,DockerHosts: 1,@@ -201,7 +202,8 @@ func TestBuildCommercialPosturePayloadWithUsage_CurrentValues(t *testing.T) {}payload := buildCommercialPosturePayloadWithUsage(status, "", entitlementUsageSnapshot{- MonitoredSystems: 7,+ MonitoredSystems: 7,+ MonitoredSystemsAvailable: true,LegacyConnections: pkglicensing.LegacyConnectionCounts{ProxmoxNodes: 2,DockerHosts: 1,diff --git a/pkg/licensing/entitlement_payload.go b/pkg/licensing/entitlement_payload.goindex d9b14f82f2..8e57f3feb0 100644--- a/pkg/licensing/entitlement_payload.go+++ b/pkg/licensing/entitlement_payload.go@@ -197,23 +197,22 @@ type EntitlementUsageSnapshot struct {MonitoredSystems int64MonitoredSystemsAvailable boolMonitoredSystemsUnavailableReason string- Nodes int64 // legacy compatibility alias for monitored systems- Guests int64- LegacyConnections LegacyConnectionCounts+ // Nodes is retained only as a deprecated compatibility field. V6 monitored-+ // system billing must be backed by an explicit canonical availability signal.+ Nodes int64+ Guests int64+ LegacyConnections LegacyConnectionCounts}func (s EntitlementUsageSnapshot) monitoredSystemCount() int64 {- if s.MonitoredSystems > 0 {- return s.MonitoredSystems+ if !s.MonitoredSystemsAvailable || s.MonitoredSystems < 0 {+ return 0}- return s.Nodes+ return s.MonitoredSystems}func (s EntitlementUsageSnapshot) monitoredSystemCountAvailable() bool {- if s.MonitoredSystemsAvailable {- return true- }- return s.MonitoredSystems > 0 || s.Nodes > 0+ return s.MonitoredSystemsAvailable}func (s EntitlementUsageSnapshot) monitoredSystemCountUnavailableReason() string {diff --git a/pkg/licensing/entitlement_payload_test.go b/pkg/licensing/entitlement_payload_test.goindex 212a16c343..3602f612fb 100644--- a/pkg/licensing/entitlement_payload_test.go+++ b/pkg/licensing/entitlement_payload_test.go@@ -71,8 +71,9 @@ func TestBuildEntitlementPayloadWithUsage_CurrentValues(t *testing.T) {}payload := BuildEntitlementPayloadWithUsage(status, "", EntitlementUsageSnapshot{- MonitoredSystems: 12,- Guests: 44,+ MonitoredSystems: 12,+ MonitoredSystemsAvailable: true,+ Guests: 44,LegacyConnections: LegacyConnectionCounts{ProxmoxNodes: 2,DockerHosts: 1,@@ -148,6 +149,34 @@ func TestBuildEntitlementPayload_TrialState(t *testing.T) {}}+func TestBuildEntitlementPayloadWithUsage_RequiresCanonicalMonitoredSystemAvailability(t *testing.T) {+ status := &LicenseStatus{+ Valid: true,+ Tier: TierPro,+ Features: append([]string(nil), TierFeatures[TierPro]...),+ MaxMonitoredSystems: 50,+ }++ payload := BuildEntitlementPayloadWithUsage(status, "", EntitlementUsageSnapshot{+ MonitoredSystems: 12,+ Nodes: 99,+ MonitoredSystemsUnavailableReason: "canonical_usage_unavailable",+ }, nil)++ if len(payload.Limits) != 1 {+ t.Fatalf("expected one limit, got %d", len(payload.Limits))+ }+ if payload.Limits[0].Current != 0 {+ t.Fatalf("expected unavailable canonical usage to remain 0, got %d", payload.Limits[0].Current)+ }+ if payload.Limits[0].CurrentAvailable == nil || *payload.Limits[0].CurrentAvailable {+ t.Fatalf("expected canonical usage availability to be false, got %+v", payload.Limits[0].CurrentAvailable)+ }+ if payload.Limits[0].CurrentUnavailableReason != "canonical_usage_unavailable" {+ t.Fatalf("CurrentUnavailableReason=%q, want %q", payload.Limits[0].CurrentUnavailableReason, "canonical_usage_unavailable")+ }+}+func TestBuildEntitlementPayloadWithUsage_MonitoredSystemUsageUnavailable(t *testing.T) {status := &LicenseStatus{Valid: true,@@ -316,7 +345,8 @@ func TestBuildCommercialPosturePayloadWithUsage_CurrentValues(t *testing.T) {}payload := BuildCommercialPosturePayloadWithUsage(status, "", EntitlementUsageSnapshot{- MonitoredSystems: 7,+ MonitoredSystems: 7,+ MonitoredSystemsAvailable: true,LegacyConnections: LegacyConnectionCounts{ProxmoxNodes: 2,DockerHosts: 1,@@ -353,7 +383,8 @@ func TestCommercialPosturePayloadFromEntitlementPayload_StripsBillingIdentityFieFeatures: append([]string(nil), TierFeatures[TierPro]...),MaxMonitoredSystems: 50,}, string(SubStateActive), EntitlementUsageSnapshot{- MonitoredSystems: 12,+ MonitoredSystems: 12,+ MonitoredSystemsAvailable: true,LegacyConnections: LegacyConnectionCounts{ProxmoxNodes: 1,},@@ -400,7 +431,8 @@ func TestBuildRuntimeCapabilitiesPayloadWithUsage_CurrentValues(t *testing.T) {}payload := BuildRuntimeCapabilitiesPayloadWithUsage(status, "", EntitlementUsageSnapshot{- MonitoredSystems: 5,+ MonitoredSystems: 5,+ MonitoredSystemsAvailable: true,})if !reflect.DeepEqual(payload.Capabilities, status.Features) {