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.

Preserve uncapped self-hosted commercial continuity

rcourtmand36f465b7c97
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 0239ba99f3..819e180784 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -212,7 +212,8 @@ quickstart use, resolve the strongest server-verified runtime authority in
this order, and refuse bootstrap entirely when neither exists: installation
identity from installation-scoped `activation.enc` for activated self-hosted
installs, then signed entitlement-lease identity from the effective
-entitlement-backed billing state for hosted or trial-backed runtimes. Tenant-
+entitlement-backed billing state for hosted entitlement-backed runtimes,
+including hosted trial leases. Tenant-
local Patrol persistence must therefore reuse installation-scoped activation
state where it exists and must fall back to the shared entitlement lease
without inventing shadow activation files or anonymous client identity.
@@ -246,9 +247,9 @@ that inventory is known, rather than forcing the runtime to infer exhaustion
from absent fields or resetting credits to zero after transient upstream
errors.
Public-facing copy that reflects those runtime fields must therefore speak in
-Patrol quickstart runs on activated or trial-backed installs and Patrol-only
-no-key activation, not in generic AI credits, anonymous Community bootstrap,
-or a promise of full hosted chat.
+Patrol quickstart runs on activated Pulse Account installs or effective hosted
+entitlements and Patrol-only no-key activation, not in generic AI credits,
+anonymous Community bootstrap, trial CTAs, or a promise of full hosted chat.
That same runtime-backed contract now governs AI settings enablement too:
quickstart-ready installs may enable Patrol directly without opening provider
setup, while activation-required or offline quickstart states must surface one
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index c60779ad19..6fd0b18233 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -321,7 +321,7 @@ the canonical monitored-system blocked payload.
treated as global command authority.
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`.
+ That same hosted bootstrap surface must also preserve the secure quickstart-identity contract: hosted entitlement-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`.
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.
@@ -514,7 +514,7 @@ the canonical monitored-system blocked payload.
client-authored commercial identity or synthetic credits when the quickstart
server is unavailable
and the activation-gated availability rule, so missing installation
- activation/trial identity must surface as the canonical activation-required
+ activation or entitlement identity must surface as the canonical activation-required
quickstart block reason for Patrol and AI settings enablement rather than
silently attempting anonymous bootstrap
and the Pulse-owned hosted model alias rule, so persisted legacy hosted
@@ -527,9 +527,9 @@ the canonical monitored-system blocked payload.
Patrol and must clear that field when a provider-backed path is active or
quickstart is genuinely usable
and the public interpretation rule, so those fields describe Patrol-only
- quickstart inventory and active runtime source on activated or trial-backed
- installs rather than a generic hosted AI quota, anonymous Community
- entitlement, or full-chat entitlement
+ quickstart inventory and active runtime source on activated Pulse Account
+ installs or effective hosted entitlements rather than a generic hosted AI
+ quota, anonymous Community entitlement, trial CTA, or full-chat entitlement
and the Patrol execution billing rule, so shared runtime bridges such as
`internal/api/chat_service_adapter.go` must preserve the stable Patrol
execution identifier that the hosted quickstart contract uses to charge
@@ -2620,9 +2620,9 @@ force a blocked or exhausted operator presentation while Patrol is active on a
configured non-quickstart provider path.
Those same transport fields now also define the only public quickstart promise:
when pricing, README, or Patrol header copy references them, it must describe
-Patrol-only quickstart runs and no-key Patrol activation on activated or
-trial-backed installs rather than generic AI credits, anonymous bootstrap, or
-hosted-chat access.
+Patrol-only quickstart runs and no-key Patrol activation on activated Pulse
+Account installs or effective hosted entitlements rather than generic AI
+credits, anonymous bootstrap, trial CTAs, or hosted-chat access.
Hosted billing-state payloads now also carry the canonical quickstart grant
metadata used by hosted bootstrap and refresh flows. Billing reads and contract
proofs must preserve `quickstart_credits_granted`,
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index eb9b4e75f8..a9cd76fd9c 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -751,16 +751,17 @@ quickstart token plus the authoritative quickstart credit snapshot. The Pulse
runtime must authenticate that bootstrap with one of the server-verified
commercial authorities owned by the shared commercial boundary: an
installation token from installation-scoped activation state for activated
-self-hosted installs, or a signed hosted entitlement lease for entitlement-
-backed trial/cloud runtimes. There is no anonymous `client_installation_id`
-fallback in the v6 runtime contract, and hosted/trial quickstart must not fake
-self-hosted `activation.enc` just to satisfy the bootstrap path. Local runtime
-cache files may memoize the returned token and counts but may not treat those
-cached counts as commercial authority. The transport must also remain
-mixed-version compatible while quickstart rolls out: Pulse may send optional
-binding metadata such as `instance_name` and `use_case=patrol`, and the server
-must not reject that additive metadata or rely on one expiry field spelling
-only when returning the quickstart token snapshot.
+self-hosted installs, or a signed hosted entitlement lease for hosted
+entitlement-backed runtimes, including hosted trial leases. There is no
+anonymous `client_installation_id` fallback in the v6 runtime contract, and
+hosted quickstart must not fake self-hosted `activation.enc` just to satisfy
+the bootstrap path. Local runtime cache files may memoize the returned token
+and counts but may not treat those cached counts as commercial authority. The
+transport must also remain mixed-version compatible while quickstart rolls out:
+Pulse may send optional binding metadata such as `instance_name` and
+`use_case=patrol`, and the server must not reject that additive metadata or
+rely on one expiry field spelling only when returning the quickstart token
+snapshot.
`POST /v1/quickstart/patrol` also owns the Patrol-run billing boundary: the
runtime may send an execution identifier for one higher-level Patrol run, and
the license server must treat repeated proxy calls that share that execution
@@ -774,9 +775,10 @@ route is commercial activation support, not an ungoverned external prompt
relay.
That quickstart allowance is therefore activation support, not the main
commercial pitch: self-hosted pricing and docs may promise Patrol-only
-quickstart runs with no API key for activated or trial-backed installs, but
-they must not market that bootstrap as anonymous Community entitlement or a
-general hosted chat plan while Relay and Pro carry the paid story.
+quickstart runs with no API key for activated Pulse Account installs or
+effective hosted entitlements, but they must not market that bootstrap as
+anonymous Community entitlement, a trial CTA, or a general hosted chat plan
+while Relay and Pro carry the paid story.
The self-hosted commercial counted unit is now also locked to monitored
systems rather than agent installs. `max_monitored_systems` is the live
runtime and UI contract, while legacy `max_agents` / `max_nodes` aliases are
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 7ff4f86252..0adda200f1 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -78,8 +78,8 @@ Patrol-specific presentation helpers.
4. Keep Patrol header quickstart copy Patrol-scoped and runtime-backed: the
Patrol header may promise only the server-authoritative quickstart
inventory, phrase availability as Patrol runs with no API key on activated
- or trial-backed installs, and avoid implying broader hosted chat, generic
- AI credits, or anonymous Community entitlement.
+ Pulse Account installs or effective hosted entitlements, and avoid implying
+ broader hosted chat, generic AI credits, or anonymous Community entitlement.
5. Keep customer-facing Patrol naming product-first: page titles, route chrome,
summary copy, actions, and empty states should lead with `Patrol` or
`Pulse Patrol` rather than generic `AI` branding. Reserve `AI` terminology
@@ -485,7 +485,8 @@ exhaustion, not merely because the stored credit counter reached zero while a
configured provider path keeps Patrol active.
That same header copy must stay Patrol-only in operator-facing language:
available inventory should read as free Patrol quickstart runs with no API
-key for Patrol on the current activated or trial-backed install, and
+key for Patrol on the current activated Pulse Account install or effective
+hosted entitlement, and
activation-required states must trust the canonical blocked reason instead of
relabeling stale counters as exhausted. Exhaustion should direct the operator
toward BYOK for Patrol rather than implying a broader hosted AI allowance.
diff --git a/frontend-modern/src/api/__tests__/patrol.test.ts b/frontend-modern/src/api/__tests__/patrol.test.ts
index a3b4dab49d..8d19812bcf 100644
--- a/frontend-modern/src/api/__tests__/patrol.test.ts
+++ b/frontend-modern/src/api/__tests__/patrol.test.ts
@@ -76,19 +76,21 @@ describe('patrol api', () => {
});
it('preserves the activation-required quickstart blocked reason payload', async () => {
+ const activationRequiredReason =
+ 'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.';
+
apiFetchJSONMock.mockResolvedValueOnce({
runtime_state: 'blocked',
- blocked_reason:
- 'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.',
+ blocked_reason: activationRequiredReason,
healthy: false,
} as any);
await expect(getPatrolStatus()).resolves.toMatchObject({
runtime_state: 'blocked',
- blocked_reason:
- 'Connect your API key to use AI Patrol on this install. Hosted quickstart requires an activated entitlement.',
+ blocked_reason: activationRequiredReason,
healthy: false,
});
+ expect(activationRequiredReason.toLowerCase()).not.toContain('trial');
});
it('preserves activation-gated quickstart status without inventing inventory', async () => {
diff --git a/frontend-modern/src/api/patrol.ts b/frontend-modern/src/api/patrol.ts
index c948edfafd..1beb33f931 100644
--- a/frontend-modern/src/api/patrol.ts
+++ b/frontend-modern/src/api/patrol.ts
@@ -171,7 +171,7 @@ export interface PatrolStatus {
license_status?: LicenseStatus;
upgrade_url?: string;
summary: FindingsSummary;
- // Server-authoritative Patrol quickstart inventory and runtime source for activated or trial-backed installs only.
+ // Server-authoritative Patrol quickstart inventory and runtime source for activated installs only.
quickstart_credits_remaining?: number;
quickstart_credits_total?: number;
using_quickstart?: boolean;
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index 5ea9f08c48..e543051c28 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -904,7 +904,7 @@ describe('AIIntelligence entitlement gating', () => {
expect(getPatrolStatusMock).toHaveBeenCalled();
expect(
screen.getByTitle(
- '12 of 25 Patrol quickstart runs remaining on this activated or trial-backed install. No API key needed for initial Patrol quickstart.',
+ '12 of 25 Patrol quickstart runs remaining on this activated Pulse Account install. No API key needed for initial Patrol quickstart.',
),
).toBeInTheDocument();
});
diff --git a/frontend-modern/src/stores/licenseCommercial.ts b/frontend-modern/src/stores/licenseCommercial.ts
index a112d25152..1a70503d34 100644
--- a/frontend-modern/src/stores/licenseCommercial.ts
+++ b/frontend-modern/src/stores/licenseCommercial.ts
@@ -222,7 +222,7 @@ export function canOfferCommercialTrial(): boolean {
/**
* Used by explicit commercial surfaces that should only offer trial start when
- * the current commercial posture is loaded and not already active/trial-backed.
+ * the current commercial posture is loaded and not already active or trialing.
*/
export function canStartCommercialTrial(): boolean {
if (presentationPolicyHidesUpgradePrompts()) return false;
diff --git a/frontend-modern/src/types/ai.ts b/frontend-modern/src/types/ai.ts
index dd85b93900..178e2fce0b 100644
--- a/frontend-modern/src/types/ai.ts
+++ b/frontend-modern/src/types/ai.ts
@@ -55,12 +55,12 @@ export interface AISettings {
discovery_enabled?: boolean;
discovery_interval_hours?: number;
- // Server-authoritative Patrol quickstart inventory surfaced in AI settings for activated or trial-backed installs.
+ // Server-authoritative Patrol quickstart inventory surfaced in AI settings for activated installs.
quickstart_credits_total?: number;
quickstart_credits_used?: number;
quickstart_credits_remaining?: number;
quickstart_credits_available?: boolean; // true when this install can currently use Patrol quickstart without BYOK
- using_quickstart?: boolean; // true when Patrol is currently using the quickstart provider on an activated or trial-backed install
+ using_quickstart?: boolean; // true when Patrol is currently using the quickstart provider on an activated install
quickstart_blocked_reason?: string; // canonical reason when quickstart is not currently available
}
diff --git a/frontend-modern/src/utils/__tests__/aiQuickstartPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiQuickstartPresentation.test.ts
index 320a34fc20..d0bd98958c 100644
--- a/frontend-modern/src/utils/__tests__/aiQuickstartPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiQuickstartPresentation.test.ts
@@ -8,7 +8,7 @@ describe('getAIQuickstartCreditsPresentation', () => {
'bg-blue-50 dark:bg-blue-950 border-blue-200 dark:border-blue-800 text-blue-700 dark:text-blue-300',
summary: 'Patrol quickstart: 3/10 runs left',
title:
- '3 of 10 Patrol quickstart runs remaining on this activated or trial-backed install. No API key needed for initial Patrol quickstart.',
+ '3 of 10 Patrol quickstart runs remaining on this activated Pulse Account install. No API key needed for initial Patrol quickstart.',
});
});
@@ -18,7 +18,7 @@ describe('getAIQuickstartCreditsPresentation', () => {
'bg-amber-50 dark:bg-amber-950 border-amber-200 dark:border-amber-800 text-amber-700 dark:text-amber-300',
summary: 'Patrol quickstart exhausted',
title:
- 'Patrol quickstart on this activated or trial-backed install is exhausted. Connect your API key to continue using Patrol.',
+ 'Patrol quickstart on this activated Pulse Account install is exhausted. Connect your API key to continue using Patrol.',
});
});
});
diff --git a/frontend-modern/src/utils/__tests__/quickstartCopyContract.test.ts b/frontend-modern/src/utils/__tests__/quickstartCopyContract.test.ts
index c3a3719b8f..fb47188704 100644
--- a/frontend-modern/src/utils/__tests__/quickstartCopyContract.test.ts
+++ b/frontend-modern/src/utils/__tests__/quickstartCopyContract.test.ts
@@ -24,17 +24,17 @@ describe('quickstart copy contract', () => {
const pulsePro = readRepoFile('docs/PULSE_PRO.md');
const pricingSpec = readRepoFile('docs/architecture/v6-pricing-and-tiering.md');
- expect(readme).toContain('Activated or trial-backed installs can use 25 Patrol quickstart runs');
- expect(readme).toMatch(
- /Unactivated Community installs should activate, start\s+a trial, or use BYOK\./,
+ expect(readme).toContain(
+ 'optional managed quickstart runs are available only after explicit Pulse Account activation',
);
+ expect(readme).toContain('if you explicitly activate through Pulse Account, Pulse can use 25');
expect(pulsePro).toContain(
- 'Activated or trial-backed installs can use 25 Patrol quickstart runs with no API key for first-run activation.',
+ 'Optional Patrol quickstart after explicit Pulse Account activation: 25 Patrol runs with no API key on a server-verified install.',
);
expect(pricingSpec).toMatch(
- /Activated or trial-backed\s+installs with the server-verified installation identity get 25 hosted Patrol runs/,
+ /optional Patrol-only quickstart allowance after explicit Pulse Account\s+activation/,
);
- expect(pricingSpec).toMatch(/it is not a general hosted\s+chat entitlement/);
+ expect(pricingSpec).toMatch(/it is not a general\s+hosted chat entitlement/);
});
it('keeps hosted quickstart privacy copy aligned with resource-policy redaction', () => {
diff --git a/frontend-modern/src/utils/aiQuickstartPresentation.ts b/frontend-modern/src/utils/aiQuickstartPresentation.ts
index 2faa36cc09..5cd912bbad 100644
--- a/frontend-modern/src/utils/aiQuickstartPresentation.ts
+++ b/frontend-modern/src/utils/aiQuickstartPresentation.ts
@@ -20,7 +20,7 @@ export function getAIQuickstartCreditsPresentation(
className:
'bg-blue-50 dark:bg-blue-950 border-blue-200 dark:border-blue-800 text-blue-700 dark:text-blue-300',
summary: `Patrol quickstart: ${remaining}/${total} runs left`,
- title: `${remaining} of ${total} Patrol quickstart runs remaining on this activated or trial-backed install. No API key needed for initial Patrol quickstart.`,
+ title: `${remaining} of ${total} Patrol quickstart runs remaining on this activated Pulse Account install. No API key needed for initial Patrol quickstart.`,
};
}
@@ -29,6 +29,6 @@ export function getAIQuickstartCreditsPresentation(
'bg-amber-50 dark:bg-amber-950 border-amber-200 dark:border-amber-800 text-amber-700 dark:text-amber-300',
summary: 'Patrol quickstart exhausted',
title:
- 'Patrol quickstart on this activated or trial-backed install is exhausted. Connect your API key to continue using Patrol.',
+ 'Patrol quickstart on this activated Pulse Account install is exhausted. Connect your API key to continue using Patrol.',
};
}
diff --git a/internal/ai/quickstart.go b/internal/ai/quickstart.go
index 0d607d2fa7..3588ea3d19 100644
--- a/internal/ai/quickstart.go
+++ b/internal/ai/quickstart.go
@@ -514,7 +514,7 @@ func QuickstartUnavailableReason() string {
}
// QuickstartActivationRequiredReason returns the canonical Patrol quickstart
-// availability message shown when the install is not activated or trial-backed.
+// availability message shown when the install is not activated.
func QuickstartActivationRequiredReason() string {
return patrolQuickstartActivationRequiredReason
}
@@ -523,7 +523,7 @@ func quickstartActivationRequiredError() error {
return &pkglicensing.LicenseServerError{
StatusCode: http.StatusUnauthorized,
Code: "activation_required",
- Message: "Quickstart bootstrap requires an activated or trial-backed installation",
+ Message: "Quickstart bootstrap requires Pulse Account activation",
Retryable: false,
}
}
diff --git a/internal/ai/quickstart_test.go b/internal/ai/quickstart_test.go
index b559bfcd1f..fe654cfd97 100644
--- a/internal/ai/quickstart_test.go
+++ b/internal/ai/quickstart_test.go
@@ -149,6 +149,11 @@ func TestQuickstartReasonExportsRemainCanonical(t *testing.T) {
if strings.Contains(strings.ToLower(QuickstartActivationRequiredReason()), "trial") {
t.Fatalf("activation-required quickstart reason must stay BYOK-first, got %q", QuickstartActivationRequiredReason())
}
+ if err := quickstartActivationRequiredError(); strings.Contains(strings.ToLower(err.Error()), "trial") {
+ t.Fatalf("activation-required quickstart error must not mention trials, got %q", err.Error())
+ } else if !strings.Contains(err.Error(), "Pulse Account activation") {
+ t.Fatalf("activation-required quickstart error = %q, want Pulse Account activation guidance", err.Error())
+ }
}
func TestPersistentQuickstartCreditManager_LoadsPersistedTokenWithoutBootstrap(t *testing.T) {
diff --git a/internal/config/billing_state_test.go b/internal/config/billing_state_test.go
index c55cb545c5..55c1b9731d 100644
--- a/internal/config/billing_state_test.go
+++ b/internal/config/billing_state_test.go
@@ -383,6 +383,44 @@ func TestBillingState_SaveCanonicalizesCloudPlanContract(t *testing.T) {
assert.False(t, hasOld)
}
+func TestBillingState_GrandfatheredRecurringSelfHostedPlanStaysUncapped(t *testing.T) {
+ dir := t.TempDir()
+ t.Setenv("PULSE_LEGACY_KEY_PATH", filepath.Join(t.TempDir(), ".encryption.key"))
+ writeTestEncryptionKey(t, dir)
+
+ store := NewFileBillingStore(dir)
+ state := &entitlements.BillingState{
+ PlanVersion: "v5_pro_monthly_grandfathered",
+ SubscriptionState: entitlements.SubStateActive,
+ Limits: map[string]int64{
+ pkglicensing.MaxMonitoredSystemsLicenseGateKey: 10,
+ "max_guests": 5,
+ "max_nodes": 99,
+ },
+ }
+
+ require.NoError(t, store.SaveBillingState("default", state))
+
+ loaded, err := store.GetBillingState("default")
+ require.NoError(t, err)
+ require.NotNil(t, loaded)
+ assert.Equal(t, "v5_pro_monthly_grandfathered", loaded.PlanVersion)
+ assert.NotContains(t, loaded.Limits, pkglicensing.MaxMonitoredSystemsLicenseGateKey)
+ assert.NotContains(t, loaded.Limits, "max_guests")
+ assert.NotContains(t, loaded.Limits, "max_nodes")
+
+ data, err := os.ReadFile(filepath.Join(dir, "billing.json"))
+ require.NoError(t, err)
+
+ var raw map[string]any
+ require.NoError(t, json.Unmarshal(data, &raw))
+ rawLimits, ok := raw["limits"].(map[string]any)
+ require.True(t, ok)
+ assert.NotContains(t, rawLimits, pkglicensing.MaxMonitoredSystemsLicenseGateKey)
+ assert.NotContains(t, rawLimits, "max_guests")
+ assert.NotContains(t, rawLimits, "max_nodes")
+}
+
func TestBillingState_CapabilityOrderIndependent(t *testing.T) {
dir := t.TempDir()
t.Setenv("PULSE_LEGACY_KEY_PATH", filepath.Join(t.TempDir(), ".encryption.key"))
diff --git a/pkg/licensing/billing_state_normalization.go b/pkg/licensing/billing_state_normalization.go
index 6b2bfdf484..9c0aef4eff 100644
--- a/pkg/licensing/billing_state_normalization.go
+++ b/pkg/licensing/billing_state_normalization.go
@@ -48,7 +48,7 @@ func NormalizeBillingState(state *BillingState) *BillingState {
normalized.CommercialMigration = NormalizeCommercialMigrationStatus(normalized.CommercialMigration)
normalized.Limits = NormalizeMonitoredSystemLimits(normalized.Limits)
- if IsSelfHostedCommunityPlanVersion(normalized.PlanVersion) {
+ if IsSelfHostedCoreMonitoringUncappedPlanVersion(normalized.PlanVersion) {
stripLegacyCommercialCaps(normalized.Limits)
}
@@ -81,12 +81,9 @@ func NormalizeBillingState(state *BillingState) *BillingState {
func billingStateStoredMonitoredSystemLimit(planVersion string) (int, bool) {
planVersion = CanonicalizePlanVersion(planVersion)
- if IsSelfHostedCommunityPlanVersion(planVersion) {
+ if IsSelfHostedCoreMonitoringUncappedPlanVersion(planVersion) {
return 0, false
}
- if IsGrandfatheredRecurringV5PlanVersion(planVersion) {
- return UnknownPlanDefaultMonitoredSystemLimit, true
- }
limit, known := CloudPlanMonitoredSystemLimits[planVersion]
if !known || limit <= 0 {
return 0, false
diff --git a/pkg/licensing/billing_state_normalization_test.go b/pkg/licensing/billing_state_normalization_test.go
index fdd9c8ba6e..ea7c5f1876 100644
--- a/pkg/licensing/billing_state_normalization_test.go
+++ b/pkg/licensing/billing_state_normalization_test.go
@@ -306,7 +306,7 @@ func TestNormalizeBillingState_CanonicalizesCloudPlanVersionAndLimits(t *testing
}
}
-func TestNormalizeBillingState_GrandfatheredRecurringPlanUsesStoredBillingBaseline(t *testing.T) {
+func TestNormalizeBillingState_GrandfatheredRecurringPlanStripsLegacyCommercialCaps(t *testing.T) {
state := &BillingState{
PlanVersion: " v5_pro_monthly_grandfathered ",
Limits: map[string]int64{
@@ -321,11 +321,11 @@ func TestNormalizeBillingState_GrandfatheredRecurringPlanUsesStoredBillingBaseli
if normalized.PlanVersion != "v5_pro_monthly_grandfathered" {
t.Fatalf("plan_version=%q, want %q", normalized.PlanVersion, "v5_pro_monthly_grandfathered")
}
- if got := normalized.Limits["max_monitored_systems"]; got != UnknownPlanDefaultMonitoredSystemLimit {
- t.Fatalf("limits[max_monitored_systems]=%d, want %d", got, UnknownPlanDefaultMonitoredSystemLimit)
+ if _, ok := normalized.Limits["max_monitored_systems"]; ok {
+ t.Fatalf("expected max_monitored_systems to be scrubbed, got %v", normalized.Limits)
}
- if got := normalized.Limits["max_guests"]; got != 50 {
- t.Fatalf("limits[max_guests]=%d, want %d", got, 50)
+ if _, ok := normalized.Limits["max_guests"]; ok {
+ t.Fatalf("expected max_guests to be scrubbed, got %v", normalized.Limits)
}
if _, hasOld := normalized.Limits["max_nodes"]; hasOld {
t.Fatal("expected max_nodes to be deleted during normalization")
diff --git a/pkg/licensing/database_source.go b/pkg/licensing/database_source.go
index 716a2622d1..fcfeee0c16 100644
--- a/pkg/licensing/database_source.go
+++ b/pkg/licensing/database_source.go
@@ -243,8 +243,7 @@ func normalizeDatabaseSourceState(state BillingState) BillingState {
normalized.CommercialMigration = NormalizeCommercialMigrationStatus(normalized.CommercialMigration)
normalized.Limits = NormalizeMonitoredSystemLimits(normalized.Limits)
- if IsSelfHostedCommunityPlanVersion(normalized.PlanVersion) ||
- IsGrandfatheredRecurringV5PlanVersion(normalized.PlanVersion) {
+ if IsSelfHostedCoreMonitoringUncappedPlanVersion(normalized.PlanVersion) {
stripLegacyCommercialCaps(normalized.Limits)
}
diff --git a/pkg/licensing/features.go b/pkg/licensing/features.go
index b6654ab568..ad998f7376 100644
--- a/pkg/licensing/features.go
+++ b/pkg/licensing/features.go
@@ -175,6 +175,11 @@ func IsSelfHostedCommunityPlanVersion(planVersion string) bool {
}
}
+func IsSelfHostedCoreMonitoringUncappedPlanVersion(planVersion string) bool {
+ return IsSelfHostedCommunityPlanVersion(planVersion) ||
+ IsGrandfatheredRecurringV5PlanVersion(planVersion)
+}
+
func stripLegacyCommercialCaps(limits map[string]int64) {
delete(limits, MaxMonitoredSystemsLicenseGateKey)
delete(limits, "max_guests")
diff --git a/pkg/licensing/features_test.go b/pkg/licensing/features_test.go
index 89b0394327..9aa2f42852 100644
--- a/pkg/licensing/features_test.go
+++ b/pkg/licensing/features_test.go
@@ -677,6 +677,30 @@ func TestIsSelfHostedCommunityPlanVersion(t *testing.T) {
}
}
+func TestIsSelfHostedCoreMonitoringUncappedPlanVersion(t *testing.T) {
+ tests := []struct {
+ plan string
+ want bool
+ }{
+ {plan: "community", want: true},
+ {plan: "free", want: true},
+ {plan: "v5_pro_monthly_grandfathered", want: true},
+ {plan: "v5_pro_annual_grandfathered", want: true},
+ {plan: "cloud_starter", want: false},
+ {plan: "msp_starter", want: false},
+ {plan: "pro-v2", want: false},
+ {plan: "", want: false},
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.plan, func(t *testing.T) {
+ if got := IsSelfHostedCoreMonitoringUncappedPlanVersion(tt.plan); got != tt.want {
+ t.Fatalf("IsSelfHostedCoreMonitoringUncappedPlanVersion(%q) = %v, want %v", tt.plan, got, tt.want)
+ }
+ })
+ }
+}
+
// TestPriceIDToPlanVersion_AllMapToKnownPlans ensures every plan version in the
// price→plan map is recognized by LimitsForCloudPlan (fail-closed safety net).
func TestPriceIDToPlanVersion_AllMapToKnownPlans(t *testing.T) {
diff --git a/pkg/licensing/models.go b/pkg/licensing/models.go
index a64f71555a..f424c6934e 100644
--- a/pkg/licensing/models.go
+++ b/pkg/licensing/models.go
@@ -81,10 +81,7 @@ func (c Claims) shouldScrubLegacyCommercialCaps() bool {
if c.Tier == TierLifetime {
return true
}
- if IsSelfHostedCommunityPlanVersion(c.PlanVersion) {
- return true
- }
- if IsGrandfatheredRecurringV5PlanVersion(c.PlanVersion) {
+ if IsSelfHostedCoreMonitoringUncappedPlanVersion(c.PlanVersion) {
return true
}
return false
diff --git a/pkg/licensing/models_test.go b/pkg/licensing/models_test.go
index c4a304a1e8..1a48ed7222 100644
--- a/pkg/licensing/models_test.go
+++ b/pkg/licensing/models_test.go
@@ -117,6 +117,17 @@ func TestClaims_EffectiveLimits(t *testing.T) {
},
expected: map[string]int64{},
},
+ {
+ name: "grandfathered_monthly_v5_strips_new_v6_caps",
+ claims: Claims{
+ Tier: TierPro,
+ PlanVersion: "v5_pro_monthly_grandfathered",
+ Limits: map[string]int64{"max_monitored_systems": 15, "max_guests": 5},
+ MaxMonitoredSystems: 15,
+ MaxGuests: 5,
+ },
+ expected: map[string]int64{},
+ },
{
name: "community_plan_strips_legacy_v5_cap_after_upgrade",
claims: Claims{