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.

Enforce installation-scoped license invalidation

rcourtmanae4162f8f257
diff --git a/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md b/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
index 9b905211c2..bebc6f89fe 100644
--- a/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
+++ b/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md
@@ -186,10 +186,11 @@ Companion drill:
grace, downgrade history timing, report entitlement denial, and safe artifact
purge. Relay proof now also covers mandatory operator-feed configuration,
synchronous startup drain, readiness staleness, active stale-session
- teardown, and reconnect-token invalidation. The remaining duplicate/reversed/
- missing external-event matrix, exact Stripe-to-Relay exercise, and customer-
- safe installation-scoped Pulse invalidation require the governed rehearsal;
- until that evidence is registered, the gate remains blocked.
+ teardown, and reconnect-token invalidation. Local test proof now covers the
+ customer-safe installation-scoped Pulse status/refresh/clear path without the
+ operator feed credential. The remaining duplicate/reversed/missing external-
+ event matrix and exact Stripe-to-Relay-and-Pulse exercise require the governed
+ rehearsal; until that evidence is registered, the gate remains blocked.
- Manual scenario:
1. In Stripe test mode, create fresh Community-to-Relay and Community-to-Pro
acquisitions for monthly and annual plans.
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index 3009f3944e..1a7a9a2d48 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -4713,12 +4713,24 @@
"path": "docs/release-control/v6/internal/subsystems/relay-runtime.md",
"kind": "file"
},
+ {
+ "repo": "pulse",
+ "path": "internal/api/contract_test.go",
+ "kind": "file",
+ "evidence_tier": "test-proof"
+ },
{
"repo": "pulse",
"path": "internal/api/report_schedules_test.go",
"kind": "file",
"evidence_tier": "test-proof"
},
+ {
+ "repo": "pulse",
+ "path": "pkg/licensing/installation_status_poll_test.go",
+ "kind": "file",
+ "evidence_tier": "test-proof"
+ },
{
"repo": "pulse",
"path": "pkg/licensing/subscription_test.go",
@@ -4731,6 +4743,12 @@
"kind": "file",
"evidence_tier": "test-proof"
},
+ {
+ "repo": "pulse-pro",
+ "path": "license-server/v6_status_test.go",
+ "kind": "file",
+ "evidence_tier": "test-proof"
+ },
{
"repo": "pulse-pro",
"path": "relay-server/bridge_v6_grant_test.go",
@@ -7973,12 +7991,24 @@
"path": "docs/release-control/v6/internal/records/commercial-offer-lifecycle-contract-2026-07-14.md",
"kind": "file"
},
+ {
+ "repo": "pulse",
+ "path": "internal/api/contract_test.go",
+ "kind": "file",
+ "evidence_tier": "test-proof"
+ },
{
"repo": "pulse",
"path": "internal/api/report_schedules_test.go",
"kind": "file",
"evidence_tier": "test-proof"
},
+ {
+ "repo": "pulse",
+ "path": "pkg/licensing/installation_status_poll_test.go",
+ "kind": "file",
+ "evidence_tier": "test-proof"
+ },
{
"repo": "pulse",
"path": "pkg/licensing/subscription_test.go",
@@ -7991,6 +8021,12 @@
"kind": "file",
"evidence_tier": "test-proof"
},
+ {
+ "repo": "pulse-pro",
+ "path": "license-server/v6_status_test.go",
+ "kind": "file",
+ "evidence_tier": "test-proof"
+ },
{
"repo": "pulse-pro",
"path": "relay-server/bridge_v6_grant_test.go",
@@ -8751,7 +8787,21 @@
]
}
],
- "work_claims": [],
+ "work_claims": [
+ {
+ "id": "commercial-invalidation-release-gate-self-hosted-commercial-transition-coherence",
+ "agent_id": "commercial-invalidation",
+ "summary": "Replace customer global revocation feed polling with installation-authenticated license status invalidation across Pulse and license server.",
+ "target_id": "v6-product-lane-expansion",
+ "claimed_at": "2026-07-14T14:40:43Z",
+ "heartbeat_at": "2026-07-14T14:40:43Z",
+ "expires_at": "2026-07-14T18:40:43Z",
+ "work_item": {
+ "kind": "release-gate",
+ "id": "self-hosted-commercial-transition-coherence"
+ }
+ }
+ ],
"open_decisions": [],
"source_of_truth_file": "docs/release-control/v6/internal/SOURCE_OF_TRUTH.md",
"resolved_decisions": [
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index ea39a423ea..518c257c46 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -153,6 +153,17 @@ Browser API types and presentation helpers must treat `exchange_stale_key` plus
`allow_license_egress` as explicit migration states rather than inferring them
from HTTP status alone.
+Customer license invalidation is also a shared API/cloud-paid contract.
+Customer Pulse may call `POST /v1/grants/status` only with its encrypted
+installation token and installation/fingerprint binding; it must never receive
+or use the operator-wide Relay revocation-feed credential. The successful
+response carries authoritative license version, refresh-required state, and
+bounded cadence hints but no grant or cross-customer event data. Pulse refreshes
+through the signed-grant endpoint only for a newer version, clears activation
+only for explicit token/installation/license revocation codes, removes paid
+entitlements but preserves scoped recovery authority for explicit suspension,
+and exposes only non-secret synchronization health in `/api/license/status`.
+
`GET /api/connections` consumes the agent desired-config contract for fleet
governance. When it derives `fleet.commandPolicy`, `fleet.configDrift`, and
rollout state, it must compare the agent-applied report with the effective
@@ -1551,9 +1562,10 @@ payload shape change when the portal presents compact client rows.
must hand the canonical process `serverVersion` and normalized runtime
identity into `internal/api/licensing_handlers.go`, and the shared
licensing runtime must carry those exact values through `/v1/activate`,
- `/v1/licenses/exchange`, and `/v1/grants/refresh` so migrated installs can
- be attributed to exact builds and public-vs-Pro runtime status without
- inventing a second version source or trusting browser-supplied hints.
+ `/v1/licenses/exchange`, `/v1/grants/status`, and `/v1/grants/refresh` so
+ migrated installs can be attributed to exact builds and public-vs-Pro
+ runtime status without inventing a second version source or trusting
+ browser-supplied hints.
That same shared licensing boundary also owns self-hosted purchase-return
framing. `/auth/license-purchase-start` and
`/auth/license-purchase-activate` may return operators only to the
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 4d3c537f7f..c15994a599 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -147,7 +147,7 @@ avoids a cloud-control-plane report data path across clients.
10. `pkg/licensing/dev_mode_features.go`
11. `pkg/licensing/service.go`
12. `pkg/licensing/grant_refresh.go`
-13. `pkg/licensing/revocation_poll.go`
+13. `pkg/licensing/installation_status_poll.go`
14. `pkg/licensing/license_server_client.go`
15. `pkg/licensing/persistence.go`
16. `pkg/licensing/activation_store.go`
@@ -253,9 +253,9 @@ avoids a cloud-control-plane report data path across clients.
and `internal/api/licensing_handlers.go` must hand the canonical process
version and runtime identity into `pkg/licensing/service.go` and
`pkg/licensing/grant_refresh.go`, and cloud-paid transport must send those
- values on activate, legacy exchange, and grant refresh instead of inferring
- install version or paid-runtime status from browser state, dev build
- metadata, public image tags, or outbound usage telemetry.
+ values on activate, legacy exchange, installation status, and grant refresh
+ instead of inferring install version or paid-runtime status from browser
+ state, dev build metadata, public image tags, or outbound usage telemetry.
Active self-hosted paid entitlements must also treat runtime identity as a
first-class product state. A paid Pro, Pro Annual, Pro+, lifetime, or
enterprise entitlement on a non-Pro or missing runtime identity must render
@@ -804,7 +804,7 @@ the App/AppLayout, routing, and desktop Actions journey tests.
source may provision only when the plan is otherwise unresolved for staging
compatibility, and self-hosted v5/v6 checkout metadata must be ignored by
the Cloud control-plane webhook even if Stripe delivers the event there.
-8. Add or change activation/grant lifecycle, release build helper gating, or dev-mode capability widening through `pkg/licensing/dev_mode_features.go`, `pkg/licensing/service.go`, `pkg/licensing/testing_helpers.go`, `pkg/licensing/grant_refresh.go`, and `pkg/licensing/revocation_poll.go`
+8. Add or change activation/grant lifecycle, release build helper gating, or dev-mode capability widening through `pkg/licensing/dev_mode_features.go`, `pkg/licensing/service.go`, `pkg/licensing/testing_helpers.go`, `pkg/licensing/grant_refresh.go`, and `pkg/licensing/installation_status_poll.go`
9. Add or change license-server transport through `pkg/licensing/license_server_client.go`
That transport boundary must use HTTPS for non-loopback commercial endpoints,
may allow plaintext only on direct loopback development targets, and must
@@ -1140,6 +1140,16 @@ hands-on Patrol modes, issue investigation, verified fixes, and longer history`.
must fail closed without the authenticated feed, drain it before serving,
report stale feed state through readiness, and disconnect already-connected
v6 sessions whose grant falls below an applied version floor.
+29. Add or change customer Pulse commercial invalidation only through
+ `pkg/licensing/installation_status_poll.go`,
+ `pkg/licensing/license_server_client.go`, and the installation-authenticated
+ `pulse-pro:license-server/admin_ui.go`,
+ `pulse-pro:license-server/v6_handlers.go`,
+ `pulse-pro:license-server/v6_grants.go`, and
+ `pulse-pro:license-server/v6_store.go` boundary. The status response may
+ expose only the caller's authoritative license version and bounded cadence
+ hints; it must never expose a grant, the global Relay feed credential, or
+ another commercial subject's event data.
## Forbidden Paths
@@ -1330,11 +1340,16 @@ MSP remains an assisted preview.
The Relay side now fails closed on missing feed authority, drains the feed
before serving, exposes feed staleness through readiness, and tears down stale
-already-connected v6 sessions while clearing their reconnect tokens. The
-remaining restrictive-transition gap is the customer Pulse runtime: its
-existing optional poller depends on a global operator credential that must not
-be distributed. A scoped installation-authenticated invalidation authority and
-real external Stripe-to-runtime proof remain release-gated.
+already-connected v6 sessions while clearing their reconnect tokens. Customer
+Pulse now uses an immediate, installation-authenticated `POST
+/v1/grants/status` check followed by the existing signed-grant refresh path
+only when the authoritative license version advances. Explicit token,
+installation, or license revocation clears encrypted activation state. An
+authoritative suspension removes paid entitlements immediately while retaining
+the scoped installation credential for automatic recovery; other authorization
+or transport failures retain the last signed grant and surface non-secret
+synchronization health through `/api/license/status`. The global operator feed
+remains Relay-only. Real external Stripe-to-runtime proof remains release-gated.
Hosted handoff target paths are normalized by the shared host-local redirect
validator at token minting, exchange, and provider-proof boundaries. Absolute,
@@ -2761,7 +2776,7 @@ each ID resolves to an active live recurring Stripe price object.
Activation service runtime, license-server transport, encrypted activation
persistence, and hosted entitlement lease signing now follow the same ratchet. Changes
to `pkg/licensing/service.go`, `pkg/licensing/grant_refresh.go`,
-`pkg/licensing/revocation_poll.go`, `pkg/licensing/license_server_client.go`,
+`pkg/licensing/installation_status_poll.go`, `pkg/licensing/license_server_client.go`,
`pkg/licensing/persistence.go`, `pkg/licensing/activation_store.go`, and
`pkg/licensing/trial_activation.go` should carry their dedicated proof files
instead of relying only on the generic cloud runtime policy.
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 749365d53c..6e7edf77ae 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -2816,12 +2816,15 @@
"internal/cloudcp/stripe/provisioner.go",
"internal/hosted/provisioner.go",
"pulse-pro:landing-page/thanks.html",
+ "pulse-pro:license-server/admin_ui.go",
"pulse-pro:license-server/grandfathering.go",
"pulse-pro:license-server/intelligence_value.go",
"pulse-pro:license-server/main.go",
"pulse-pro:license-server/self_hosted_feature_catalog.generated.go",
"pulse-pro:license-server/v6_checkout.go",
+ "pulse-pro:license-server/v6_grants.go",
"pulse-pro:license-server/v6_handlers.go",
+ "pulse-pro:license-server/v6_store.go",
"pulse-pro:relay-server/main.go",
"pulse-pro:relay-server/registry.go",
"pulse-pro:relay-server/revocation_feed.go",
@@ -2930,6 +2933,7 @@
"test_prefixes": [],
"exact_files": [
"pkg/licensing/cloud_paid_guardrails_test.go",
+ "pkg/licensing/installation_status_poll_test.go",
"pkg/licensing/models_test.go",
"pkg/licensing/service_activate_test.go"
]
@@ -2946,6 +2950,7 @@
"exact_files": [
"pkg/licensing/activation_types_test.go",
"pkg/licensing/grant_claims_contract_test.go",
+ "pkg/licensing/installation_status_poll_test.go",
"pkg/licensing/service_activate_test.go"
]
},
@@ -3116,7 +3121,7 @@
"match_files": [
"pkg/licensing/dev_mode_features.go",
"pkg/licensing/grant_refresh.go",
- "pkg/licensing/revocation_poll.go",
+ "pkg/licensing/installation_status_poll.go",
"pkg/licensing/service.go",
"pkg/licensing/testing_helpers.go"
],
@@ -3125,7 +3130,7 @@
"exact_files": [
"pkg/licensing/cloud_paid_guardrails_test.go",
"pkg/licensing/grant_refresh_test.go",
- "pkg/licensing/revocation_poll_test.go",
+ "pkg/licensing/installation_status_poll_test.go",
"pkg/licensing/service_activate_test.go"
]
},
@@ -3155,8 +3160,8 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "pkg/licensing/license_server_client_test.go",
- "pkg/licensing/revocation_poll_test.go"
+ "pkg/licensing/installation_status_poll_test.go",
+ "pkg/licensing/license_server_client_test.go"
]
},
{
@@ -3510,6 +3515,32 @@
"frontend-modern/src/pages/__tests__/RuntimeHome.test.tsx"
]
},
+ {
+ "id": "customer-license-invalidation",
+ "label": "customer installation-scoped license invalidation proof",
+ "match_prefixes": [],
+ "match_files": [
+ "pkg/licensing/activation_types.go",
+ "pkg/licensing/grant_refresh.go",
+ "pkg/licensing/installation_status_poll.go",
+ "pkg/licensing/license_server_client.go",
+ "pkg/licensing/models.go",
+ "pkg/licensing/service.go",
+ "pulse-pro:license-server/admin_ui.go",
+ "pulse-pro:license-server/v6_grants.go",
+ "pulse-pro:license-server/v6_handlers.go",
+ "pulse-pro:license-server/v6_store.go"
+ ],
+ "allow_same_subsystem_tests": false,
+ "test_prefixes": [],
+ "exact_files": [
+ "internal/api/contract_test.go",
+ "pkg/licensing/activation_store_test.go",
+ "pkg/licensing/grant_refresh_test.go",
+ "pkg/licensing/installation_status_poll_test.go",
+ "pulse-pro:license-server/v6_status_test.go"
+ ]
+ },
{
"id": "relay-commercial-invalidation",
"label": "Relay commercial invalidation proof",
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 760aeeaae1..d7b97d8802 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -7559,19 +7559,65 @@ func TestContract_MissingLicensePublicKeyActivationErrorGuidesLocalBuilds(t *tes
}
}
+func TestContract_CustomerLicenseInvalidationUsesInstallationAuthority(t *testing.T) {
+ files := []string{
+ "licensing_handlers.go",
+ "licensing_legacy_retry.go",
+ filepath.Join("..", "..", "pkg", "licensing", "service.go"),
+ filepath.Join("..", "..", "pkg", "licensing", "license_server_client.go"),
+ filepath.Join("..", "..", "pkg", "licensing", "installation_status_poll.go"),
+ }
+ var combined strings.Builder
+ for _, file := range files {
+ body, err := os.ReadFile(file)
+ if err != nil {
+ t.Fatalf("read %s: %v", file, err)
+ }
+ combined.Write(body)
+ }
+ source := combined.String()
+ for _, forbidden := range []string{
+ "PULSE_REVOCATION_FEED_TOKEN",
+ "StartRevocationPoll",
+ "StopRevocationPoll",
+ "FetchRevocations",
+ "revocationPollLoop",
+ "/v1/revocations",
+ } {
+ if strings.Contains(source, forbidden) {
+ t.Fatalf("customer licensing runtime retains retired global-feed symbol %q", forbidden)
+ }
+ }
+ for _, required := range []string{
+ "/v1/grants/status",
+ "CheckInstallationStatus",
+ "StartInstallationStatusPoll",
+ "CurrentLicenseVersion",
+ "isRevokedActivationError",
+ "isSuspendedActivationError",
+ "suspendPaidEntitlements",
+ "PaidAccessSuspended",
+ } {
+ if !strings.Contains(source, required) {
+ t.Fatalf("customer licensing runtime missing installation-scoped contract symbol %q", required)
+ }
+ }
+}
+
func TestContract_LegacyMigrationFallbackStaysUncappedJSONSnapshot(t *testing.T) {
t.Setenv("PULSE_LICENSE_DEV_MODE", "false")
const expectedClientVersion = "6.0.0-rc.1"
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_contract_floor",
- Tier: "pro",
- PlanKey: "legacy_migration_fallback",
- State: "active",
- Features: []string{"relay"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_contract_floor",
+ LicenseVersion: 1,
+ Tier: "pro",
+ PlanKey: "legacy_migration_fallback",
+ State: "active",
+ Features: []string{"relay"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -7580,6 +7626,9 @@ func TestContract_LegacyMigrationFallbackStaysUncappedJSONSnapshot(t *testing.T)
t.Cleanup(func() { pkglicensing.SetPublicKey(nil) })
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
if r.URL.Path != "/v1/licenses/exchange" {
t.Fatalf("path = %q, want /v1/licenses/exchange", r.URL.Path)
}
diff --git a/internal/api/license_handlers_test.go b/internal/api/license_handlers_test.go
index 58687a15b4..a1f13792d1 100644
--- a/internal/api/license_handlers_test.go
+++ b/internal/api/license_handlers_test.go
@@ -66,13 +66,14 @@ func issueCheckoutActivationGrant(t *testing.T) string {
t.Helper()
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_checkout_success",
- Tier: "pro_plus",
- State: "active",
- Features: []string{"relay", "ai_alerts"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_checkout_success",
+ LicenseVersion: 1,
+ Tier: "pro_plus",
+ State: "active",
+ Features: []string{"relay", "ai_alerts"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -401,14 +402,15 @@ func TestHandleActivateLicense_ExchangesLegacyJWTInStrictV6(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_exchanged",
- Tier: "pro",
- PlanKey: tc.planKey,
- State: "active",
- Features: []string{"relay"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_exchanged",
+ LicenseVersion: 1,
+ Tier: "pro",
+ PlanKey: tc.planKey,
+ State: "active",
+ Features: []string{"relay"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -417,6 +419,9 @@ func TestHandleActivateLicense_ExchangesLegacyJWTInStrictV6(t *testing.T) {
t.Cleanup(func() { license.SetPublicKey(nil) })
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
if r.URL.Path != "/v1/licenses/exchange" {
t.Fatalf("path = %q, want /v1/licenses/exchange", r.URL.Path)
}
@@ -499,13 +504,14 @@ func TestHandleActivateLicense_ClearsCommercialMigrationStateOnNativeActivation(
t.Setenv("PULSE_LICENSE_DEV_MODE", "false")
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_v6_native",
- Tier: "pro",
- State: "active",
- Features: []string{"relay"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_v6_native",
+ LicenseVersion: 1,
+ Tier: "pro",
+ State: "active",
+ Features: []string{"relay"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -514,6 +520,9 @@ func TestHandleActivateLicense_ClearsCommercialMigrationStateOnNativeActivation(
t.Cleanup(func() { license.SetPublicKey(nil) })
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
if r.URL.Path != "/v1/activate" {
t.Fatalf("path = %q, want /v1/activate", r.URL.Path)
}
@@ -584,13 +593,14 @@ func TestHandleActivateLicense_ActivationKeyClearsStaleLegacyPersistence(t *test
t.Setenv("PULSE_LICENSE_DEV_MODE", "false")
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_v6_native",
- Tier: "pro",
- State: "active",
- Features: []string{"relay"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_v6_native",
+ LicenseVersion: 1,
+ Tier: "pro",
+ State: "active",
+ Features: []string{"relay"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -599,6 +609,9 @@ func TestHandleActivateLicense_ActivationKeyClearsStaleLegacyPersistence(t *test
t.Cleanup(func() { license.SetPublicKey(nil) })
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
if r.URL.Path != "/v1/activate" {
t.Fatalf("path = %q, want /v1/activate", r.URL.Path)
}
@@ -906,6 +919,9 @@ func TestHandleCheckoutActivation_RedeemsCompletedCheckoutAndWritesSuccessBridge
grantJWT := issueCheckoutActivationGrant(t)
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
switch r.URL.Path {
case "/v1/checkout/session":
if r.Method != http.MethodGet {
@@ -990,6 +1006,9 @@ func TestHandleCheckoutActivation_BlocksDuplicateRedemptionAfterSuccess(t *testi
activateCalls := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
switch r.URL.Path {
case "/v1/checkout/session":
w.Header().Set("Content-Type", "application/json")
@@ -1062,6 +1081,9 @@ func TestHandleCheckoutActivation_AllowsRetryAfterActivationFailure(t *testing.T
activateCalls := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
switch r.URL.Path {
case "/v1/checkout/session":
w.Header().Set("Content-Type", "application/json")
diff --git a/internal/api/licensing_handlers.go b/internal/api/licensing_handlers.go
index d6440fcb7b..1fc91df680 100644
--- a/internal/api/licensing_handlers.go
+++ b/internal/api/licensing_handlers.go
@@ -42,12 +42,6 @@ const (
purchaseReturnKeyPurpose = "pulse-license-purchase-return"
)
-// revocationFeedToken returns the relay feed token for revocation polling.
-// Empty string means revocation polling is disabled.
-func revocationFeedToken() string {
- return os.Getenv("PULSE_REVOCATION_FEED_TOKEN")
-}
-
func wantsMockFixturesFromEnv() bool {
return strings.EqualFold(strings.TrimSpace(os.Getenv("PULSE_MOCK_MODE")), "true")
}
@@ -153,7 +147,7 @@ func (h *LicenseHandlers) StopAllBackgroundLoops() {
h.services.Range(func(_, value any) bool {
if svc, ok := value.(*licenseService); ok {
svc.StopGrantRefresh()
- svc.StopRevocationPoll()
+ svc.StopInstallationStatusPoll()
}
return true
})
@@ -574,10 +568,7 @@ func (h *LicenseHandlers) getTenantComponents(ctx context.Context) (*licenseServ
}
// Start the background refresh loop for the restored grant.
service.StartGrantRefresh(context.Background())
- // Start revocation polling if a feed token is configured.
- if feedToken := revocationFeedToken(); feedToken != "" {
- service.StartRevocationPoll(context.Background(), feedToken)
- }
+ service.StartInstallationStatusPoll(context.Background())
log.Info().Str("org_id", orgID).Str("license_id", activationState.LicenseID).Msg("Restored license activation")
}
}
@@ -612,9 +603,7 @@ func (h *LicenseHandlers) getTenantComponents(ctx context.Context) (*licenseServ
log.Warn().Str("org_id", orgID).Err(clearErr).Msg("Failed to clear commercial migration state after successful auto-exchange")
}
service.StartGrantRefresh(context.Background())
- if feedToken := revocationFeedToken(); feedToken != "" {
- service.StartRevocationPoll(context.Background(), feedToken)
- }
+ service.StartInstallationStatusPoll(context.Background())
if current := service.Current(); current != nil {
log.Info().
Str("org_id", orgID).
@@ -629,8 +618,8 @@ func (h *LicenseHandlers) getTenantComponents(ctx context.Context) (*licenseServ
// If another goroutine stored first, use its service and let ours be GC'd.
actual, loaded := h.services.LoadOrStore(orgID, service)
if loaded {
- service.StopGrantRefresh() // stop our orphaned refresh loop if started
- service.StopRevocationPoll() // stop our orphaned revocation poller if started
+ service.StopGrantRefresh() // stop our orphaned refresh loop if started
+ service.StopInstallationStatusPoll() // stop our orphaned status poller if started
svc := actual.(*licenseService)
h.ensureHostedEntitlementRefreshForOrg(orgID, svc)
p, pErr := h.getPersistenceForOrg(orgID)
@@ -985,9 +974,7 @@ func (h *LicenseHandlers) activateLicenseKey(ctx context.Context, licenseKey str
}
// Activation state is already persisted by ActivateWithKey, but start the refresh loop.
service.StartGrantRefresh(context.Background())
- if feedToken := revocationFeedToken(); feedToken != "" {
- service.StartRevocationPoll(context.Background(), feedToken)
- }
+ service.StartInstallationStatusPoll(context.Background())
if persistence != nil {
if strings.HasPrefix(trimmedKey, activationKeyPrefixValue) {
_ = persistence.Delete()
diff --git a/internal/api/licensing_handlers_auto_migrate_test.go b/internal/api/licensing_handlers_auto_migrate_test.go
index fb0bbb421b..799c0baef3 100644
--- a/internal/api/licensing_handlers_auto_migrate_test.go
+++ b/internal/api/licensing_handlers_auto_migrate_test.go
@@ -370,14 +370,15 @@ func TestGetTenantComponents_AutoExchangeLeavesSelfHostedMonitoringUncapped(t *t
t.Setenv("PULSE_LICENSE_DEV_MODE", "false")
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_floor_auto",
- Tier: "pro",
- PlanKey: "legacy_migration_fallback",
- State: "active",
- Features: []string{"relay"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_floor_auto",
+ LicenseVersion: 1,
+ Tier: "pro",
+ PlanKey: "legacy_migration_fallback",
+ State: "active",
+ Features: []string{"relay"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -386,6 +387,9 @@ func TestGetTenantComponents_AutoExchangeLeavesSelfHostedMonitoringUncapped(t *t
t.Cleanup(func() { pkglicensing.SetPublicKey(nil) })
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
if r.URL.Path != "/v1/licenses/exchange" {
t.Fatalf("path = %q, want /v1/licenses/exchange", r.URL.Path)
}
@@ -577,14 +581,15 @@ func TestActivateLicenseKey_KeepsLegacySelfHostedMigrationUncapped(t *testing.T)
t.Setenv("PULSE_LICENSE_DEV_MODE", "false")
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_floor_manual",
- Tier: "pro",
- PlanKey: "legacy_migration_fallback",
- State: "active",
- Features: []string{"relay"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_floor_manual",
+ LicenseVersion: 1,
+ Tier: "pro",
+ PlanKey: "legacy_migration_fallback",
+ State: "active",
+ Features: []string{"relay"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -593,6 +598,9 @@ func TestActivateLicenseKey_KeepsLegacySelfHostedMigrationUncapped(t *testing.T)
t.Cleanup(func() { pkglicensing.SetPublicKey(nil) })
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
if r.URL.Path != "/v1/licenses/exchange" {
t.Fatalf("path = %q, want /v1/licenses/exchange", r.URL.Path)
}
@@ -647,14 +655,15 @@ func TestGetTenantComponents_DoesNotCaptureGrandfatherFloorWhenSupplementalInven
t.Setenv("PULSE_LICENSE_DEV_MODE", "false")
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_floor_supplemental",
- Tier: "pro",
- PlanKey: "legacy_migration_fallback",
- State: "active",
- Features: []string{"relay"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_floor_supplemental",
+ LicenseVersion: 1,
+ Tier: "pro",
+ PlanKey: "legacy_migration_fallback",
+ State: "active",
+ Features: []string{"relay"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -663,6 +672,9 @@ func TestGetTenantComponents_DoesNotCaptureGrandfatherFloorWhenSupplementalInven
t.Cleanup(func() { pkglicensing.SetPublicKey(nil) })
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
if r.URL.Path != "/v1/licenses/exchange" {
t.Fatalf("path = %q, want /v1/licenses/exchange", r.URL.Path)
}
diff --git a/internal/api/licensing_legacy_retry.go b/internal/api/licensing_legacy_retry.go
index 2a6f1021cc..1ceddb4c2d 100644
--- a/internal/api/licensing_legacy_retry.go
+++ b/internal/api/licensing_legacy_retry.go
@@ -87,9 +87,7 @@ func (h *LicenseHandlers) scheduleLegacyExchangeRetry(orgID, legacyJWT string) {
log.Warn().Str("org_id", orgID).Err(clearErr).Msg("Failed to clear commercial migration state after background legacy exchange")
}
service.StartGrantRefresh(context.Background())
- if feedToken := revocationFeedToken(); feedToken != "" {
- service.StartRevocationPoll(context.Background(), feedToken)
- }
+ service.StartInstallationStatusPoll(context.Background())
h.syncReleaseDemoFixtureRuntime(orgID, service)
if current := service.Current(); current != nil {
log.Info().
diff --git a/internal/api/licensing_legacy_retry_test.go b/internal/api/licensing_legacy_retry_test.go
index 6458a2c35f..e6521e6bac 100644
--- a/internal/api/licensing_legacy_retry_test.go
+++ b/internal/api/licensing_legacy_retry_test.go
@@ -24,13 +24,14 @@ func TestGetTenantComponents_RetriesFailedExchangeInBackground(t *testing.T) {
t.Setenv("PULSE_LICENSE_DEV_MODE", "false")
grantJWT, grantPublicKey, err := licensetestsupport.GenerateGrantJWTForTesting(pkglicensing.GrantClaims{
- LicenseID: "lic_retry",
- Tier: "pro",
- State: "active",
- Features: []string{"relay"},
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- Email: "[email protected]",
+ LicenseID: "lic_retry",
+ LicenseVersion: 1,
+ Tier: "pro",
+ State: "active",
+ Features: []string{"relay"},
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ Email: "[email protected]",
})
if err != nil {
t.Fatalf("generate grant jwt: %v", err)
@@ -42,6 +43,9 @@ func TestGetTenantComponents_RetriesFailedExchangeInBackground(t *testing.T) {
// succeed: boot fails, retry #1 fails, retry #2 migrates.
var exchangeCalls atomic.Int32
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if handleTestInstallationStatus(w, r, 1) {
+ return
+ }
if r.URL.Path != "/v1/licenses/exchange" {
t.Errorf("path = %q, want /v1/licenses/exchange", r.URL.Path)
w.WriteHeader(http.StatusNotFound)
diff --git a/internal/api/licensing_status_test_helpers_test.go b/internal/api/licensing_status_test_helpers_test.go
new file mode 100644
index 0000000000..0664c7274b
--- /dev/null
+++ b/internal/api/licensing_status_test_helpers_test.go
@@ -0,0 +1,26 @@
+package api
+
+import (
+ "encoding/json"
+ "net/http"
+
+ pkglicensing "github.com/rcourtman/pulse-go-rewrite/pkg/licensing"
+)
+
+func handleTestInstallationStatus(w http.ResponseWriter, r *http.Request, licenseVersion int64) bool {
+ if r.URL.Path != "/v1/grants/status" {
+ return false
+ }
+ if r.Method != http.MethodPost {
+ w.WriteHeader(http.StatusMethodNotAllowed)
+ return true
+ }
+ _ = json.NewEncoder(w).Encode(pkglicensing.InstallationStatusResponse{
+ LicenseVersion: licenseVersion,
+ StatusPolicy: pkglicensing.StatusHints{
+ IntervalSeconds: 300,
+ JitterPercent: 20,
+ },
+ })
+ return true
+}
diff --git a/internal/repoctl/canonical_development_protocol_test.go b/internal/repoctl/canonical_development_protocol_test.go
index f65fe0dd88..c9b34d9f3b 100644
--- a/internal/repoctl/canonical_development_protocol_test.go
+++ b/internal/repoctl/canonical_development_protocol_test.go
@@ -468,7 +468,7 @@ func TestSubsystemRegistryExistsAndReferencesContracts(t *testing.T) {
"pkg/licensing/activation_types.go",
"pkg/licensing/service.go",
"pkg/licensing/grant_refresh.go",
- "pkg/licensing/revocation_poll.go",
+ "pkg/licensing/installation_status_poll.go",
"pkg/licensing/license_server_client.go",
"pkg/licensing/persistence.go",
"pkg/licensing/activation_store.go",
@@ -480,6 +480,10 @@ func TestSubsystemRegistryExistsAndReferencesContracts(t *testing.T) {
"internal/cloudcp/entitlements/service.go",
"internal/cloudcp/registry/registry.go",
"internal/cloudcp/stripe/provisioner.go",
+ "pulse-pro:license-server/admin_ui.go",
+ "pulse-pro:license-server/v6_grants.go",
+ "pulse-pro:license-server/v6_handlers.go",
+ "pulse-pro:license-server/v6_store.go",
"docs/release-control/v6/internal/subsystems/alerts.md",
"docs/release-control/v6/internal/subsystems/api-contracts.md",
"docs/release-control/v6/internal/subsystems/cloud-paid.md",
diff --git a/pkg/licensing/activation_store_test.go b/pkg/licensing/activation_store_test.go
index bb6709c9be..fa22737615 100644
--- a/pkg/licensing/activation_store_test.go
+++ b/pkg/licensing/activation_store_test.go
@@ -27,6 +27,8 @@ func TestActivationStatePersistence(t *testing.T) {
GrantJWT: "header.payload.signature",
GrantJTI: "grant_xyz",
GrantExpiresAt: 1700000000,
+ LicenseVersion: 7,
+ PaidAccessSuspended: true,
InstanceFingerprint: "fp-uuid-1234",
LicenseServerURL: "https://license.example.com",
ActivatedAt: 1699000000,
@@ -64,6 +66,12 @@ func TestActivationStatePersistence(t *testing.T) {
if loaded.GrantExpiresAt != state.GrantExpiresAt {
t.Errorf("GrantExpiresAt = %d, want %d", loaded.GrantExpiresAt, state.GrantExpiresAt)
}
+ if loaded.LicenseVersion != state.LicenseVersion {
+ t.Errorf("LicenseVersion = %d, want %d", loaded.LicenseVersion, state.LicenseVersion)
+ }
+ if loaded.PaidAccessSuspended != state.PaidAccessSuspended {
+ t.Errorf("PaidAccessSuspended = %v, want %v", loaded.PaidAccessSuspended, state.PaidAccessSuspended)
+ }
if loaded.InstanceFingerprint != state.InstanceFingerprint {
t.Errorf("InstanceFingerprint = %q, want %q", loaded.InstanceFingerprint, state.InstanceFingerprint)
}
diff --git a/pkg/licensing/activation_types.go b/pkg/licensing/activation_types.go
index 0794db3ced..d9cd00a5a2 100644
--- a/pkg/licensing/activation_types.go
+++ b/pkg/licensing/activation_types.go
@@ -17,16 +17,18 @@ const DefaultLicenseServerURL = "https://license.pulserelay.pro"
// ActivationState holds the local state for an activation-key-based license.
// Persisted encrypted on disk via Persistence.SaveActivationState.
type ActivationState struct {
- InstallationID string `json:"installation_id"` // inst_...
- InstallationToken string `json:"installation_token"` // pit_live_... (secret)
- LicenseID string `json:"license_id"` // lic_...
- GrantJWT string `json:"grant_jwt"` // current relay grant JWT
- GrantJTI string `json:"grant_jti"` // grant ID for dedup
- GrantExpiresAt int64 `json:"grant_expires_at"` // Unix timestamp
- InstanceFingerprint string `json:"instance_fingerprint"` // stable UUID for this installation
- LicenseServerURL string `json:"license_server_url"` // base URL used for this activation
- ActivatedAt int64 `json:"activated_at"` // Unix timestamp of initial activation
- LastRefreshedAt int64 `json:"last_refreshed_at"` // Unix timestamp of last grant refresh
+ InstallationID string `json:"installation_id"` // inst_...
+ InstallationToken string `json:"installation_token"` // pit_live_... (secret)
+ LicenseID string `json:"license_id"` // lic_...
+ GrantJWT string `json:"grant_jwt"` // current relay grant JWT
+ GrantJTI string `json:"grant_jti"` // grant ID for dedup
+ GrantExpiresAt int64 `json:"grant_expires_at"` // Unix timestamp
+ LicenseVersion int64 `json:"license_version"` // signed grant license version
+ PaidAccessSuspended bool `json:"paid_access_suspended,omitempty"` // authoritative local suspension marker
+ InstanceFingerprint string `json:"instance_fingerprint"` // stable UUID for this installation
+ LicenseServerURL string `json:"license_server_url"` // base URL used for this activation
+ ActivatedAt int64 `json:"activated_at"` // Unix timestamp of initial activation
+ LastRefreshedAt int64 `json:"last_refreshed_at"` // Unix timestamp of last grant refresh
Continuity ActivationContinuity `json:"continuity,omitempty"`
}
@@ -286,25 +288,32 @@ type RefreshGrantResponse struct {
RefreshPolicy RefreshHints `json:"refresh_policy"`
}
-// RevocationEvent is a single event from the revocation feed.
-type RevocationEvent struct {
- Seq int64 `json:"seq"`
- Action string `json:"action"` // revoke_license|revoke_installation|bump_license_version
- LicenseID string `json:"license_id"`
- InstallationID string `json:"installation_id"`
- MinLicenseVersion int64 `json:"min_license_version"`
- ReasonCode string `json:"reason_code"`
- Reason string `json:"reason"`
- EffectiveAt string `json:"effective_at"` // ISO8601
+// InstallationStatusRequest is the lightweight installation-authenticated
+// request used to detect commercial state changes without issuing a new grant.
+type InstallationStatusRequest struct {
+ InstallationID string `json:"installation_id"`
+ InstanceFingerprint string `json:"instance_fingerprint"`
+ CurrentGrantJTI string `json:"current_grant_jti,omitempty"`
+ CurrentLicenseVersion int64 `json:"current_license_version"`
+ ClientVersion string `json:"client_version,omitempty"`
+ Runtime *RuntimeIdentity `json:"runtime,omitempty"`
+}
+
+// StatusHints contains the server's bounded installation status cadence.
+type StatusHints struct {
+ IntervalSeconds int `json:"recommended_check_after_sec"`
+ JitterPercent float64 `json:"jitter_percent"`
+ RetryBaseSeconds int `json:"retry_base_sec"`
+ RetryMaxSeconds int `json:"retry_max_sec"`
}
-// RevocationFeedResponse is the payload returned from GET /v1/revocations.
-type RevocationFeedResponse struct {
- FromSeq int64 `json:"from_seq"`
- NextSeq int64 `json:"next_seq"`
- LatestSeq int64 `json:"latest_seq"`
- HasMore bool `json:"has_more"`
- Events []RevocationEvent `json:"events"`
+// InstallationStatusResponse reports authoritative license version state.
+// It intentionally contains no grant and no cross-customer event data.
+type InstallationStatusResponse struct {
+ LicenseVersion int64 `json:"license_version"`
+ RefreshRequired bool `json:"refresh_required"`
+ StatusPolicy StatusHints `json:"status_policy"`
+ ServerTime string `json:"server_time"`
}
// ParseExpiresAt parses the RFC3339 expires_at string from a GrantEnvelope
diff --git a/pkg/licensing/grant_refresh.go b/pkg/licensing/grant_refresh.go
index 50b518d8aa..bb6f805b36 100644
--- a/pkg/licensing/grant_refresh.go
+++ b/pkg/licensing/grant_refresh.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"math/rand/v2"
+ "net/http"
"strings"
"sync"
"time"
@@ -155,8 +156,6 @@ func (s *Service) runGrantRefreshLoop(ctx context.Context) {
}
if err := s.refreshGrantOnce(ctx); err != nil {
- consecutiveFailures++
-
if isRevokedActivationError(err) {
// The server explicitly says this installation or licence is
// revoked. Clear activation state and revert to free tier.
@@ -164,6 +163,14 @@ func (s *Service) runGrantRefreshLoop(ctx context.Context) {
s.clearActivationState()
return
}
+ if isSuspendedActivationError(err) {
+ consecutiveFailures = 0
+ log.Warn().Msg("Grant refresh reports suspended paid access, preserving activation for recovery")
+ s.suspendPaidEntitlements()
+ continue
+ }
+
+ consecutiveFailures++
var apiErr *LicenseServerError
if errors.As(err, &apiErr) && apiErr.StatusCode == 401 {
@@ -190,9 +197,12 @@ func (s *Service) runGrantRefreshLoop(ctx context.Context) {
// refreshGrantOnce performs a single grant refresh attempt.
func (s *Service) refreshGrantOnce(ctx context.Context) error {
+ s.refreshMu.Lock()
+ defer s.refreshMu.Unlock()
+
s.mu.RLock()
client := s.serverClient
- state := s.activationState
+ state := cloneActivationState(s.activationState)
previousTier := TierFree
if s.license != nil {
previousTier = s.license.Claims.Tier
@@ -201,6 +211,11 @@ func (s *Service) refreshGrantOnce(ctx context.Context) error {
clientVersion := s.clientVersion
runtimeIdentity := NormalizeRuntimeIdentity(s.runtimeIdentity)
s.mu.RUnlock()
+ if previousTier == TierFree && state != nil && state.PaidAccessSuspended {
+ if priorClaims, err := verifyAndParseGrantJWT(state.GrantJWT); err == nil {
+ previousTier = Tier(priorClaims.Tier)
+ }
+ }
if client == nil {
return fmt.Errorf("license server client not configured")
@@ -255,6 +270,8 @@ func (s *Service) refreshGrantOnce(ctx context.Context) error {
s.activationState.GrantJWT = resp.Grant.JWT
s.activationState.GrantJTI = resp.Grant.JTI
s.activationState.GrantExpiresAt = resp.Grant.ParseExpiresAt()
+ s.activationState.LicenseVersion = gc.LicenseVersion
+ s.activationState.PaidAccessSuspended = false
s.activationState.LastRefreshedAt = time.Now().Unix()
s.activationState.Continuity = continuity
}
@@ -290,14 +307,14 @@ func (s *Service) refreshGrantOnce(ctx context.Context) error {
return nil
}
-// isRevokedActivationError reports whether err is a license-server 401 that
+// isRevokedActivationError reports whether err is a license-server response that
// explicitly indicates the installation or licence has been revoked. Only
// these codes justify wiping local activation state; any other 401 (token
// not found, token expired, malformed body) keeps the licence and relies on
// grant-expiry grace instead.
func isRevokedActivationError(err error) bool {
var apiErr *LicenseServerError
- if !errors.As(err, &apiErr) || apiErr.StatusCode != 401 {
+ if !errors.As(err, &apiErr) || (apiErr.StatusCode != 401 && apiErr.StatusCode != 403) {
return false
}
switch strings.ToUpper(strings.TrimSpace(apiErr.Code)) {
@@ -307,9 +324,53 @@ func isRevokedActivationError(err error) bool {
return false
}
+// isSuspendedActivationError reports an authoritative non-grantable state
+// that must remove paid capabilities without deleting the installation token.
+// Keeping the scoped credential allows automatic recovery after billing or
+// cancellation recovery returns the license to a grantable state.
+func isSuspendedActivationError(err error) bool {
+ var apiErr *LicenseServerError
+ return errors.As(err, &apiErr) && apiErr.StatusCode == http.StatusForbidden &&
+ strings.EqualFold(strings.TrimSpace(apiErr.Code), "LICENSE_SUSPENDED")
+}
+
+// suspendPaidEntitlements immediately returns the runtime to Community while
+// preserving activation state and its installation-scoped recovery authority.
+func (s *Service) suspendPaidEntitlements() {
+ s.mu.Lock()
+ if s.activationState == nil {
+ s.mu.Unlock()
+ return
+ }
+ changed := s.license != nil || s.evaluator != nil || !s.activationState.PaidAccessSuspended
+ s.activationState.PaidAccessSuspended = true
+ s.license = nil
+ s.evaluator = nil
+ cb := s.onLicenseChange
+ activationCB := s.onActivationStateChange
+ stateCopy := cloneActivationState(s.activationState)
+ persistence := s.persistence
+ s.mu.Unlock()
+ if !changed {
+ return
+ }
+ if persistence != nil {
+ if err := persistence.SaveActivationState(stateCopy); err != nil {
+ log.Warn().Err(err).Msg("Failed to persist suspended paid-access state")
+ }
+ }
+ if cb != nil {
+ cb(nil)
+ }
+ if activationCB != nil {
+ activationCB(stateCopy)
+ }
+}
+
// clearActivationState clears the activation state and reverts to free tier.
// Called when the license server indicates the installation is revoked.
func (s *Service) clearActivationState() {
+ s.cancelActivationLoops()
s.mu.Lock()
persistence := s.persistence
s.activationState = nil
@@ -333,6 +394,30 @@ func (s *Service) clearActivationState() {
}
}
+// cancelActivationLoops requests shutdown without waiting. It is safe to call
+// from either background loop and avoids cross-loop wait deadlocks during an
+// authoritative revocation clear.
+func (s *Service) cancelActivationLoops() {
+ s.mu.RLock()
+ refreshLoop := s.grantRefresh
+ statusLoop := s.installationStatus
+ s.mu.RUnlock()
+ if refreshLoop != nil {
+ refreshLoop.mu.Lock()
+ if refreshLoop.running && refreshLoop.cancel != nil {
+ refreshLoop.cancel()
+ }
+ refreshLoop.mu.Unlock()
+ }
+ if statusLoop != nil {
+ statusLoop.mu.Lock()
+ if statusLoop.running && statusLoop.cancel != nil {
+ statusLoop.cancel()
+ }
+ statusLoop.mu.Unlock()
+ }
+}
+
// nextRefreshInterval calculates the next refresh delay with jitter and backoff.
func (s *Service) nextRefreshInterval(consecutiveFailures int) time.Duration {
s.mu.RLock()
diff --git a/pkg/licensing/grant_refresh_test.go b/pkg/licensing/grant_refresh_test.go
index 7f03cefedd..a86a4bddc3 100644
--- a/pkg/licensing/grant_refresh_test.go
+++ b/pkg/licensing/grant_refresh_test.go
@@ -149,7 +149,8 @@ func TestIsRevokedActivationError(t *testing.T) {
{"expired token", &LicenseServerError{StatusCode: 401, Code: "TOKEN_EXPIRED"}, false},
{"token not found", &LicenseServerError{StatusCode: 401, Code: "INVALID_TOKEN"}, false},
{"401 without structured code", &LicenseServerError{StatusCode: 401, Code: "http_401"}, false},
- {"revocation code on non-401", &LicenseServerError{StatusCode: 403, Code: "TOKEN_REVOKED"}, false},
+ {"explicit revocation on 403", &LicenseServerError{StatusCode: 403, Code: "LICENSE_REVOKED"}, true},
+ {"suspension is not revocation", &LicenseServerError{StatusCode: 403, Code: "LICENSE_SUSPENDED"}, false},
{"plain error", fmt.Errorf("connection refused"), false},
{"nil error", nil, false},
}
@@ -163,6 +164,16 @@ func TestIsRevokedActivationError(t *testing.T) {
}
}
+func TestIsSuspendedActivationError(t *testing.T) {
+ if !isSuspendedActivationError(&LicenseServerError{StatusCode: http.StatusForbidden, Code: "license_suspended"}) {
+ t.Fatal("expected explicit suspension to be classified")
+ }
+ if isSuspendedActivationError(&LicenseServerError{StatusCode: http.StatusUnauthorized, Code: "LICENSE_SUSPENDED"}) ||
+ isSuspendedActivationError(&LicenseServerError{StatusCode: http.StatusForbidden, Code: "LICENSE_REVOKED"}) {
+ t.Fatal("only forbidden LICENSE_SUSPENDED may preserve activation while removing paid access")
+ }
+}
+
func TestGrantRefreshLoop_NonRevocation401KeepsActivation(t *testing.T) {
setupTestPublicKey(t)
diff --git a/pkg/licensing/installation_status_poll.go b/pkg/licensing/installation_status_poll.go
new file mode 100644
index 0000000000..b3ff54f615
--- /dev/null
+++ b/pkg/licensing/installation_status_poll.go
@@ -0,0 +1,302 @@
+package licensing
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "math/rand/v2"
+ "sync"
+ "time"
+
+ "github.com/rs/zerolog/log"
+)
+
+const (
+ defaultInstallationStatusInterval = 5 * time.Minute
+ defaultInstallationStatusJitter = 0.2
+ minInstallationStatusInterval = time.Minute
+ maxInstallationStatusInterval = 10 * time.Minute
+ defaultInstallationStatusBackoff = 30 * time.Second
+ maxInstallationStatusBackoff = 10 * time.Minute
+ installationStatusStaleAfter = 15 * time.Minute
+)
+
+var errNoActivationState = errors.New("no activation state")
+
+// installationStatusPollLoop owns customer-safe commercial invalidation.
+// It carries no operator credential and records only non-secret health state.
+type installationStatusPollLoop struct {
+ mu sync.Mutex
+ cancel context.CancelFunc
+ wg sync.WaitGroup
+ running bool
+ interval time.Duration
+ jitterPercent float64
+ retryBase time.Duration
+ retryMax time.Duration
+ lastAttemptAt time.Time
+ lastSuccessAt time.Time
+ nextCheckAt time.Time
+ consecutiveFailures int
+}
+
+func newInstallationStatusPollLoop() *installationStatusPollLoop {
+ return &installationStatusPollLoop{
+ interval: defaultInstallationStatusInterval,
+ jitterPercent: defaultInstallationStatusJitter,
+ retryBase: defaultInstallationStatusBackoff,
+ retryMax: maxInstallationStatusBackoff,
+ }
+}
+
+// StartInstallationStatusPoll starts the installation-authenticated status
+// loop. The first network check happens immediately in the goroutine before
+// any timer wait. Repeated starts are idempotent.
+func (s *Service) StartInstallationStatusPoll(ctx context.Context) {
+ s.mu.Lock()
+ if s.installationStatus == nil {
+ s.installationStatus = newInstallationStatusPollLoop()
+ }
+ loop := s.installationStatus
+ s.mu.Unlock()
+
+ loop.mu.Lock()
+ if loop.running {
+ loop.mu.Unlock()
+ return
+ }
+ pollCtx, cancel := context.WithCancel(ctx)
+ loop.cancel = cancel
+ loop.running = true
+ loop.nextCheckAt = time.Now()
+ loop.wg.Add(1)
+ loop.mu.Unlock()
+
+ go func() {
+ defer func() {
+ loop.mu.Lock()
+ loop.running = false
+ loop.nextCheckAt = time.Time{}
+ loop.mu.Unlock()
+ loop.wg.Done()
+ }()
+ s.runInstallationStatusLoop(pollCtx, loop)
+ }()
+ log.Info().Msg("Installation status poll loop started")
+}
+
+// StopInstallationStatusPoll stops the status loop and waits for exit.
+func (s *Service) StopInstallationStatusPoll() {
+ s.mu.RLock()
+ loop := s.installationStatus
+ s.mu.RUnlock()
+ if loop == nil {
+ return
+ }
+
+ loop.mu.Lock()
+ if !loop.running {
+ loop.mu.Unlock()
+ return
+ }
+ loop.cancel()
+ loop.mu.Unlock()
+ loop.wg.Wait()
+ log.Info().Msg("Installation status poll loop stopped")
+}
+
+func (s *Service) runInstallationStatusLoop(ctx context.Context, loop *installationStatusPollLoop) {
+ for {
+ loop.recordAttempt(time.Now())
+ err := s.checkInstallationStatusOnce(ctx)
+ if errors.Is(err, errNoActivationState) || errors.Is(err, context.Canceled) {
+ return
+ }
+ if err != nil {
+ if isRevokedActivationError(err) {
+ loop.recordFailure()
+ log.Warn().Msg("Installation status rejected as revoked, clearing activation")
+ s.clearActivationState()
+ return
+ }
+ if isSuspendedActivationError(err) {
+ loop.recordSuccess(time.Now())
+ log.Warn().Msg("Installation status reports suspended paid access, preserving activation for recovery")
+ s.suspendPaidEntitlements()
+ } else {
+ loop.recordFailure()
+ log.Warn().Err(err).Int("consecutive_failures", loop.failureCount()).Msg("Installation status check failed")
+ }
+ } else {
+ loop.recordSuccess(time.Now())
+ }
+
+ delay := loop.nextDelay()
+ loop.recordNextCheck(time.Now().Add(delay))
+ timer := time.NewTimer(delay)
+ select {
+ case <-ctx.Done():
+ if !timer.Stop() {
+ <-timer.C
+ }
+ return
+ case <-timer.C:
+ }
+ }
+}
+
+func (s *Service) checkInstallationStatusOnce(ctx context.Context) error {
+ s.mu.RLock()
+ client := s.serverClient
+ state := cloneActivationState(s.activationState)
+ clientVersion := s.clientVersion
+ runtimeIdentity := NormalizeRuntimeIdentity(s.runtimeIdentity)
+ s.mu.RUnlock()
+ if state == nil {
+ return errNoActivationState
+ }
+ if client == nil {
+ return fmt.Errorf("license server client not configured")
+ }
+
+ resp, err := client.CheckInstallationStatus(ctx, state.InstallationToken, InstallationStatusRequest{
+ InstallationID: state.InstallationID,
+ InstanceFingerprint: state.InstanceFingerprint,
+ CurrentGrantJTI: state.GrantJTI,
+ CurrentLicenseVersion: state.LicenseVersion,
+ ClientVersion: clientVersion,
+ Runtime: CloneRuntimeIdentity(runtimeIdentity),
+ })
+ if err != nil {
+ return fmt.Errorf("check installation status: %w", err)
+ }
+ s.SetInstallationStatusHints(resp.StatusPolicy)
+ if !resp.RefreshRequired && resp.LicenseVersion <= state.LicenseVersion {
+ return nil
+ }
+ if resp.LicenseVersion <= state.LicenseVersion {
+ return fmt.Errorf("status requested refresh without a newer license version")
+ }
+ if err := s.refreshGrantOnce(ctx); err != nil {
+ return fmt.Errorf("refresh changed grant: %w", err)
+ }
+ return nil
+}
+
+// SetInstallationStatusHints applies server hints within client-owned hard
+// bounds so server drift cannot disable timely invalidation or create a tight
+// request loop.
+func (s *Service) SetInstallationStatusHints(hints StatusHints) {
+ s.mu.Lock()
+ if s.installationStatus == nil {
+ s.installationStatus = newInstallationStatusPollLoop()
+ }
+ loop := s.installationStatus
+ s.mu.Unlock()
+
+ loop.mu.Lock()
+ defer loop.mu.Unlock()
+ if hints.IntervalSeconds > 0 {
+ loop.interval = clampStatusDuration(time.Duration(hints.IntervalSeconds)*time.Second, minInstallationStatusInterval, maxInstallationStatusInterval)
+ }
+ if hints.JitterPercent > 0 || (hints.JitterPercent == 0 && hints.IntervalSeconds > 0) {
+ jitter := hints.JitterPercent
+ if jitter >= 1 {
+ jitter /= 100
+ }
+ if jitter >= 0 && jitter <= 0.5 {
+ loop.jitterPercent = jitter
+ }
+ }
+ if hints.RetryBaseSeconds > 0 {
+ loop.retryBase = clampStatusDuration(time.Duration(hints.RetryBaseSeconds)*time.Second, 5*time.Second, time.Minute)
+ }
+ if hints.RetryMaxSeconds > 0 {
+ loop.retryMax = clampStatusDuration(time.Duration(hints.RetryMaxSeconds)*time.Second, loop.retryBase, maxInstallationStatusBackoff)
+ }
+}
+
+func clampStatusDuration(value, minValue, maxValue time.Duration) time.Duration {
+ if value < minValue {
+ return minValue
+ }
+ if value > maxValue {
+ return maxValue
+ }
+ return value
+}
+
+func (loop *installationStatusPollLoop) nextDelay() time.Duration {
+ loop.mu.Lock()
+ defer loop.mu.Unlock()
+ if loop.consecutiveFailures > 0 {
+ backoff := loop.retryBase * (1 << min(loop.consecutiveFailures-1, 10))
+ if backoff > loop.retryMax {
+ backoff = loop.retryMax
+ }
+ return backoff
+ }
+ jitterRange := float64(loop.interval) * loop.jitterPercent
+ offset := (rand.Float64()*2 - 1) * jitterRange
+ return loop.interval + time.Duration(offset)
+}
+
+func (loop *installationStatusPollLoop) recordAttempt(at time.Time) {
+ loop.mu.Lock()
+ loop.lastAttemptAt = at
+ loop.nextCheckAt = time.Time{}
+ loop.mu.Unlock()
+}
+
+func (loop *installationStatusPollLoop) recordFailure() {
+ loop.mu.Lock()
+ loop.consecutiveFailures++
+ loop.mu.Unlock()
+}
+
+func (loop *installationStatusPollLoop) recordSuccess(at time.Time) {
+ loop.mu.Lock()
+ loop.lastSuccessAt = at
+ loop.consecutiveFailures = 0
+ loop.mu.Unlock()
+}
+
+func (loop *installationStatusPollLoop) recordNextCheck(at time.Time) {
+ loop.mu.Lock()
+ loop.nextCheckAt = at
+ loop.mu.Unlock()
+}
+
+func (loop *installationStatusPollLoop) failureCount() int {
+ loop.mu.Lock()
+ defer loop.mu.Unlock()
+ return loop.consecutiveFailures
+}
+
+func (s *Service) installationStatusSnapshotLocked(now time.Time) *LicenseSynchronizationStatus {
+ if s.activationState == nil || s.installationStatus == nil {
+ return nil
+ }
+ loop := s.installationStatus
+ loop.mu.Lock()
+ defer loop.mu.Unlock()
+ stale := !loop.lastSuccessAt.IsZero() && now.Sub(loop.lastSuccessAt) > installationStatusStaleAfter
+ status := &LicenseSynchronizationStatus{
+ Running: loop.running,
+ Healthy: !loop.lastSuccessAt.IsZero() && loop.consecutiveFailures == 0 && !stale,
+ Stale: stale,
+ ConsecutiveFailures: loop.consecutiveFailures,
+ }
+ status.LastAttemptAt = formatStatusTime(loop.lastAttemptAt)
+ status.LastSuccessAt = formatStatusTime(loop.lastSuccessAt)
+ status.NextCheckAt = formatStatusTime(loop.nextCheckAt)
+ return status
+}
+
+func formatStatusTime(value time.Time) *string {
+ if value.IsZero() {
+ return nil
+ }
+ formatted := value.UTC().Format(time.RFC3339)
+ return &formatted
+}
diff --git a/pkg/licensing/installation_status_poll_test.go b/pkg/licensing/installation_status_poll_test.go
new file mode 100644
index 0000000000..40173e9025
--- /dev/null
+++ b/pkg/licensing/installation_status_poll_test.go
@@ -0,0 +1,580 @@
+package licensing
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "sync"
+ "sync/atomic"
+ "testing"
+ "time"
+)
+
+func testInstallationStatusState(version int64) *ActivationState {
+ return &ActivationState{
+ InstallationID: "inst_status",
+ InstallationToken: "pit_live_status",
+ LicenseID: "lic_status",
+ GrantJTI: "grt_status",
+ LicenseVersion: version,
+ InstanceFingerprint: "fp-status",
+ }
+}
+
+func waitForCondition(t *testing.T, timeout time.Duration, condition func() bool, message string) {
+ t.Helper()
+ deadline := time.Now().Add(timeout)
+ for time.Now().Before(deadline) {
+ if condition() {
+ return
+ }
+ time.Sleep(5 * time.Millisecond)
+ }
+ t.Fatal(message)
+}
+
+func TestInstallationStatusPollStartsImmediatelyAndIsIdempotent(t *testing.T) {
+ var calls atomic.Int32
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ calls.Add(1)
+ if r.URL.Path != "/v1/grants/status" || r.Method != http.MethodPost {
+ t.Fatalf("request=%s %s", r.Method, r.URL.Path)
+ }
+ if got := r.Header.Get("Authorization"); got != "Bearer pit_live_status" {
+ t.Fatalf("Authorization=%q", got)
+ }
+ var req InstallationStatusRequest
+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
+ t.Fatalf("Decode request: %v", err)
+ }
+ if req.InstallationID != "inst_status" || req.InstanceFingerprint != "fp-status" || req.CurrentLicenseVersion != 3 || req.CurrentGrantJTI != "grt_status" {
+ t.Fatalf("unexpected request: %+v", req)
+ }
+ json.NewEncoder(w).Encode(InstallationStatusResponse{
+ LicenseVersion: 3,
+ StatusPolicy: StatusHints{IntervalSeconds: 300, JitterPercent: 20, RetryBaseSeconds: 30, RetryMaxSeconds: 600},
+ })
+ }))
+ defer server.Close()
+
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.SetClientVersion("6.0.0")
+ svc.mu.Lock()
+ svc.activationState = testInstallationStatusState(3)
+ svc.mu.Unlock()
+ svc.StartInstallationStatusPoll(context.Background())
+ svc.StartInstallationStatusPoll(context.Background())
+ waitForCondition(t, time.Second, func() bool { return calls.Load() == 1 }, "immediate status request did not run")
+ svc.StopInstallationStatusPoll()
+ svc.StopInstallationStatusPoll()
+ if calls.Load() != 1 {
+ t.Fatalf("calls=%d want 1", calls.Load())
+ }
+
+ status := svc.Status().Synchronization
+ if status == nil || status.Running || !status.Healthy || status.LastAttemptAt == nil || status.LastSuccessAt == nil || status.ConsecutiveFailures != 0 {
+ t.Fatalf("unexpected synchronization status: %+v", status)
+ }
+}
+
+func TestInstallationStatusPollCanRestart(t *testing.T) {
+ var calls atomic.Int32
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ calls.Add(1)
+ json.NewEncoder(w).Encode(InstallationStatusResponse{LicenseVersion: 1})
+ }))
+ defer server.Close()
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.mu.Lock()
+ svc.activationState = testInstallationStatusState(1)
+ svc.mu.Unlock()
+
+ svc.StartInstallationStatusPoll(context.Background())
+ waitForCondition(t, time.Second, func() bool { return calls.Load() == 1 }, "first immediate status request did not run")
+ svc.StopInstallationStatusPoll()
+ svc.StartInstallationStatusPoll(context.Background())
+ waitForCondition(t, time.Second, func() bool { return calls.Load() == 2 }, "restart did not perform immediate status request")
+ svc.StopInstallationStatusPoll()
+}
+
+func TestInstallationStatusStopCancelsInFlightRequest(t *testing.T) {
+ entered := make(chan struct{})
+ release := make(chan struct{})
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ close(entered)
+ select {
+ case <-r.Context().Done():
+ case <-release:
+ }
+ }))
+ defer func() {
+ close(release)
+ server.Close()
+ }()
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.mu.Lock()
+ svc.activationState = testInstallationStatusState(1)
+ svc.mu.Unlock()
+ svc.StartInstallationStatusPoll(context.Background())
+ select {
+ case <-entered:
+ case <-time.After(time.Second):
+ t.Fatal("status request did not start")
+ }
+ done := make(chan struct{})
+ go func() {
+ svc.StopInstallationStatusPoll()
+ close(done)
+ }()
+ select {
+ case <-done:
+ case <-time.After(time.Second):
+ t.Fatal("stop did not cancel and join in-flight request")
+ }
+}
+
+func TestCheckInstallationStatusSameVersionDoesNotRefresh(t *testing.T) {
+ var statusCalls atomic.Int32
+ var refreshCalls atomic.Int32
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ switch r.URL.Path {
+ case "/v1/grants/status":
+ statusCalls.Add(1)
+ json.NewEncoder(w).Encode(InstallationStatusResponse{LicenseVersion: 4})
+ case "/v1/grants/refresh":
+ refreshCalls.Add(1)
+ t.Fatal("same-version status must not refresh the grant")
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.mu.Lock()
+ svc.activationState = testInstallationStatusState(4)
+ svc.mu.Unlock()
+ if err := svc.checkInstallationStatusOnce(context.Background()); err != nil {
+ t.Fatalf("checkInstallationStatusOnce: %v", err)
+ }
+ if statusCalls.Load() != 1 || refreshCalls.Load() != 0 {
+ t.Fatalf("status=%d refresh=%d", statusCalls.Load(), refreshCalls.Load())
+ }
+}
+
+func TestCheckInstallationStatusHigherVersionRefreshesAndPersists(t *testing.T) {
+ setupTestPublicKey(t)
+ newGrant := makeTestGrantJWT(t, &GrantClaims{
+ LicenseID: "lic_status",
+ InstallationID: "inst_status",
+ LicenseVersion: 2,
+ Tier: "relay",
+ State: "active",
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ JTI: "grt_new",
+ })
+ var refreshCalls atomic.Int32
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ switch r.URL.Path {
+ case "/v1/grants/status":
+ json.NewEncoder(w).Encode(InstallationStatusResponse{LicenseVersion: 2, RefreshRequired: true})
+ case "/v1/grants/refresh":
+ refreshCalls.Add(1)
+ json.NewEncoder(w).Encode(RefreshGrantResponse{Grant: GrantEnvelope{
+ JWT: newGrant, JTI: "grt_new", ExpiresAt: time.Now().Add(72 * time.Hour).UTC().Format(time.RFC3339),
+ }})
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+ tmpDir, err := os.MkdirTemp("", "pulse-status-refresh-*")
+ if err != nil {
+ t.Fatalf("MkdirTemp: %v", err)
+ }
+ defer os.RemoveAll(tmpDir)
+ persistence, err := NewPersistence(tmpDir)
+ if err != nil {
+ t.Fatalf("NewPersistence: %v", err)
+ }
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.SetPersistence(persistence)
+ state := testInstallationStatusState(1)
+ svc.mu.Lock()
+ svc.activationState = state
+ svc.license = &License{Claims: Claims{Tier: TierPro}}
+ svc.mu.Unlock()
+ if err := persistence.SaveActivationState(state); err != nil {
+ t.Fatalf("SaveActivationState: %v", err)
+ }
+
+ if err := svc.checkInstallationStatusOnce(context.Background()); err != nil {
+ t.Fatalf("checkInstallationStatusOnce: %v", err)
+ }
+ if refreshCalls.Load() != 1 {
+ t.Fatalf("refresh calls=%d want 1", refreshCalls.Load())
+ }
+ updated := svc.GetActivationState()
+ if updated == nil || updated.LicenseVersion != 2 || updated.GrantJTI != "grt_new" {
+ t.Fatalf("unexpected activation state: %+v", updated)
+ }
+ persisted, err := persistence.LoadActivationState()
+ if err != nil {
+ t.Fatalf("LoadActivationState: %v", err)
+ }
+ if persisted.LicenseVersion != 2 || persisted.GrantJTI != "grt_new" {
+ t.Fatalf("unexpected persisted state: %+v", persisted)
+ }
+}
+
+func TestInstallationStatusExplicitRevocationClearsActivation(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ status int
+ code string
+ }{
+ {name: "token", status: http.StatusUnauthorized, code: "TOKEN_REVOKED"},
+ {name: "installation", status: http.StatusUnauthorized, code: "INSTALLATION_REVOKED"},
+ {name: "license", status: http.StatusForbidden, code: "LICENSE_REVOKED"},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ w.WriteHeader(tc.status)
+ json.NewEncoder(w).Encode(map[string]any{"error": map[string]any{"code": tc.code, "message": "revoked", "revoked": true}})
+ }))
+ defer server.Close()
+ tmpDir, err := os.MkdirTemp("", "pulse-status-revoked-*")
+ if err != nil {
+ t.Fatalf("MkdirTemp: %v", err)
+ }
+ defer os.RemoveAll(tmpDir)
+ persistence, err := NewPersistence(tmpDir)
+ if err != nil {
+ t.Fatalf("NewPersistence: %v", err)
+ }
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.SetPersistence(persistence)
+ state := testInstallationStatusState(1)
+ if err := persistence.SaveActivationState(state); err != nil {
+ t.Fatalf("SaveActivationState: %v", err)
+ }
+ svc.mu.Lock()
+ svc.activationState = state
+ svc.license = &License{Claims: Claims{Tier: TierPro}}
+ svc.mu.Unlock()
+ svc.StartInstallationStatusPoll(context.Background())
+ waitForCondition(t, 2*time.Second, func() bool { return !svc.IsActivated() }, "revocation did not clear activation")
+ svc.StopInstallationStatusPoll()
+ if svc.Current() != nil || persistence.ActivationStateExists() {
+ t.Fatalf("revoked activation survived: current=%+v persisted=%v", svc.Current(), persistence.ActivationStateExists())
+ }
+ })
+ }
+}
+
+func TestInstallationStatusAmbiguous401RetainsActivation(t *testing.T) {
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ w.WriteHeader(http.StatusUnauthorized)
+ json.NewEncoder(w).Encode(map[string]any{"error": map[string]any{"code": "INVALID_TOKEN", "message": "unknown"}})
+ }))
+ defer server.Close()
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.mu.Lock()
+ svc.activationState = testInstallationStatusState(1)
+ svc.license = &License{Claims: Claims{Tier: TierPro}}
+ svc.mu.Unlock()
+ err := svc.checkInstallationStatusOnce(context.Background())
+ if err == nil {
+ t.Fatal("expected error")
+ }
+ if isRevokedActivationError(err) || !svc.IsActivated() || svc.Current() == nil {
+ t.Fatalf("ambiguous 401 must retain activation: err=%v", err)
+ }
+}
+
+func TestInstallationStatusSuspensionDropsPaidAccessAndRecoversWithScopedActivation(t *testing.T) {
+ setupTestPublicKey(t)
+ initialGrant := makeTestGrantJWT(t, &GrantClaims{
+ LicenseID: "lic_status",
+ InstallationID: "inst_status",
+ LicenseVersion: 1,
+ Tier: "pro",
+ State: "active",
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ JTI: "grt_status",
+ })
+ recoveredGrant := makeTestGrantJWT(t, &GrantClaims{
+ LicenseID: "lic_status",
+ InstallationID: "inst_status",
+ LicenseVersion: 2,
+ Tier: "relay",
+ State: "active",
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ JTI: "grt_recovered",
+ })
+ var suspended atomic.Bool
+ suspended.Store(true)
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ switch r.URL.Path {
+ case "/v1/grants/status":
+ if suspended.Load() {
+ w.WriteHeader(http.StatusForbidden)
+ json.NewEncoder(w).Encode(map[string]any{"error": map[string]any{
+ "code": "LICENSE_SUSPENDED", "message": "paid access suspended",
+ }})
+ return
+ }
+ json.NewEncoder(w).Encode(InstallationStatusResponse{LicenseVersion: 2, RefreshRequired: true})
+ case "/v1/grants/refresh":
+ json.NewEncoder(w).Encode(RefreshGrantResponse{Grant: GrantEnvelope{
+ JWT: recoveredGrant, JTI: "grt_recovered", ExpiresAt: time.Now().Add(72 * time.Hour).UTC().Format(time.RFC3339),
+ }})
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+ persistence, err := NewPersistence(t.TempDir())
+ if err != nil {
+ t.Fatalf("NewPersistence: %v", err)
+ }
+ state := testInstallationStatusState(1)
+ state.GrantJWT = initialGrant
+ if err := persistence.SaveActivationState(state); err != nil {
+ t.Fatalf("SaveActivationState: %v", err)
+ }
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.SetPersistence(persistence)
+ svc.mu.Lock()
+ svc.activationState = state
+ svc.license = &License{Claims: Claims{Tier: TierPro}}
+ svc.mu.Unlock()
+
+ svc.StartInstallationStatusPoll(context.Background())
+ waitForCondition(t, time.Second, func() bool { return svc.Current() == nil }, "suspension did not remove paid entitlements")
+ svc.StopInstallationStatusPoll()
+ if !svc.IsActivated() || !persistence.ActivationStateExists() {
+ t.Fatal("suspension must preserve scoped activation for recovery")
+ }
+ persistedSuspension, err := persistence.LoadActivationState()
+ if err != nil {
+ t.Fatalf("LoadActivationState after suspension: %v", err)
+ }
+ if persistedSuspension == nil || !persistedSuspension.PaidAccessSuspended {
+ t.Fatalf("suspension marker was not persisted: %+v", persistedSuspension)
+ }
+ restarted := NewService()
+ if err := restarted.RestoreActivation(persistedSuspension); err != nil {
+ t.Fatalf("RestoreActivation after suspension: %v", err)
+ }
+ if !restarted.IsActivated() || restarted.Current() != nil {
+ t.Fatalf("restart must preserve recovery authority without restoring paid access: activated=%v current=%+v", restarted.IsActivated(), restarted.Current())
+ }
+ if syncStatus := svc.Status().Synchronization; syncStatus == nil || !syncStatus.Healthy || syncStatus.ConsecutiveFailures != 0 {
+ t.Fatalf("authoritative suspension should be synchronized, got %+v", syncStatus)
+ }
+
+ suspended.Store(false)
+ if err := svc.checkInstallationStatusOnce(context.Background()); err != nil {
+ t.Fatalf("recovery status check: %v", err)
+ }
+ if current := svc.Current(); current == nil || current.Claims.Tier != TierRelay {
+ t.Fatalf("paid entitlements did not recover from signed grant: %+v", current)
+ }
+ if recovered := svc.GetActivationState(); recovered == nil || recovered.LicenseVersion != 2 || recovered.GrantJTI != "grt_recovered" {
+ t.Fatalf("activation did not advance after recovery: %+v", recovered)
+ } else if recovered.Continuity.DowngradeRetention == nil {
+ t.Fatalf("suspended Pro-to-Relay recovery lost downgrade retention: %+v", recovered.Continuity)
+ }
+ persistedRecovery, err := persistence.LoadActivationState()
+ if err != nil {
+ t.Fatalf("LoadActivationState after recovery: %v", err)
+ }
+ if persistedRecovery == nil || persistedRecovery.PaidAccessSuspended {
+ t.Fatalf("signed recovery grant did not clear persisted suspension: %+v", persistedRecovery)
+ }
+}
+
+func TestInstallationStatusHintBoundsAndBackoff(t *testing.T) {
+ svc := NewService()
+ svc.SetInstallationStatusHints(StatusHints{IntervalSeconds: 1, JitterPercent: 90, RetryBaseSeconds: 1, RetryMaxSeconds: 99999})
+ svc.mu.RLock()
+ loop := svc.installationStatus
+ svc.mu.RUnlock()
+ loop.mu.Lock()
+ if loop.interval != minInstallationStatusInterval || loop.jitterPercent != defaultInstallationStatusJitter || loop.retryBase != 5*time.Second || loop.retryMax != maxInstallationStatusBackoff {
+ t.Fatalf("unexpected bounded hints: interval=%v jitter=%v base=%v max=%v", loop.interval, loop.jitterPercent, loop.retryBase, loop.retryMax)
+ }
+ loop.consecutiveFailures = 20
+ loop.mu.Unlock()
+ if delay := loop.nextDelay(); delay != maxInstallationStatusBackoff {
+ t.Fatalf("backoff=%v want %v", delay, maxInstallationStatusBackoff)
+ }
+}
+
+func TestInstallationStatusSnapshotMarksStaleSynchronizationUnhealthy(t *testing.T) {
+ svc := NewService()
+ svc.mu.Lock()
+ svc.activationState = testInstallationStatusState(1)
+ loop := newInstallationStatusPollLoop()
+ svc.installationStatus = loop
+ loop.mu.Lock()
+ loop.running = true
+ loop.lastAttemptAt = time.Now().Add(-20 * time.Minute)
+ loop.lastSuccessAt = time.Now().Add(-20 * time.Minute)
+ loop.nextCheckAt = time.Now().Add(-10 * time.Minute)
+ loop.mu.Unlock()
+ svc.mu.Unlock()
+
+ status := svc.Status().Synchronization
+ if status == nil || !status.Running || !status.Stale || status.Healthy {
+ t.Fatalf("unexpected stale synchronization status: %+v", status)
+ }
+}
+
+func TestInstallationStatusNoActivationExitsCleanly(t *testing.T) {
+ svc := NewService()
+ if err := svc.checkInstallationStatusOnce(context.Background()); !errors.Is(err, errNoActivationState) {
+ t.Fatalf("error=%v want no activation", err)
+ }
+}
+
+func TestLicenseServerClientCheckInstallationStatus(t *testing.T) {
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.Method != http.MethodPost || r.URL.Path != "/v1/grants/status" {
+ t.Fatalf("request=%s %s", r.Method, r.URL.Path)
+ }
+ if got := r.Header.Get("Authorization"); got != "Bearer pit_live_transport" {
+ t.Fatalf("Authorization=%q", got)
+ }
+ var req InstallationStatusRequest
+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
+ t.Fatalf("Decode request: %v", err)
+ }
+ if req.InstallationID != "inst_transport" || req.CurrentLicenseVersion != 7 {
+ t.Fatalf("request=%+v", req)
+ }
+ json.NewEncoder(w).Encode(InstallationStatusResponse{
+ LicenseVersion: 8,
+ RefreshRequired: true,
+ StatusPolicy: StatusHints{IntervalSeconds: 300},
+ })
+ }))
+ defer server.Close()
+ client := NewLicenseServerClient(server.URL)
+ resp, err := client.CheckInstallationStatus(context.Background(), "pit_live_transport", InstallationStatusRequest{
+ InstallationID: "inst_transport",
+ CurrentLicenseVersion: 7,
+ })
+ if err != nil {
+ t.Fatalf("CheckInstallationStatus: %v", err)
+ }
+ if resp.LicenseVersion != 8 || !resp.RefreshRequired || resp.StatusPolicy.IntervalSeconds != 300 {
+ t.Fatalf("response=%+v", resp)
+ }
+}
+
+func TestRestoreActivationBackfillsSignedLicenseVersion(t *testing.T) {
+ setupTestPublicKey(t)
+ grant := makeTestGrantJWT(t, &GrantClaims{
+ LicenseID: "lic_restore_version",
+ InstallationID: "inst_restore_version",
+ LicenseVersion: 9,
+ Tier: "pro",
+ State: "active",
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ })
+ svc := NewService()
+ if err := svc.RestoreActivation(&ActivationState{
+ InstallationID: "inst_restore_version",
+ InstallationToken: "pit_live_restore",
+ LicenseID: "lic_restore_version",
+ GrantJWT: grant,
+ InstanceFingerprint: "fp-restore",
+ }); err != nil {
+ t.Fatalf("RestoreActivation: %v", err)
+ }
+ if state := svc.GetActivationState(); state == nil || state.LicenseVersion != 9 {
+ t.Fatalf("activation state=%+v want signed version 9", state)
+ }
+}
+
+func TestGrantRefreshAttemptsAreSerialized(t *testing.T) {
+ setupTestPublicKey(t)
+ grant := makeTestGrantJWT(t, &GrantClaims{
+ LicenseID: "lic_serial",
+ InstallationID: "inst_status",
+ LicenseVersion: 2,
+ Tier: "pro",
+ State: "active",
+ IssuedAt: time.Now().Unix(),
+ ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
+ })
+ entered := make(chan struct{}, 1)
+ release := make(chan struct{})
+ var calls atomic.Int32
+ var active atomic.Int32
+ var maxActive atomic.Int32
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ calls.Add(1)
+ current := active.Add(1)
+ defer active.Add(-1)
+ for {
+ maximum := maxActive.Load()
+ if current <= maximum || maxActive.CompareAndSwap(maximum, current) {
+ break
+ }
+ }
+ select {
+ case entered <- struct{}{}:
+ <-release
+ default:
+ }
+ json.NewEncoder(w).Encode(RefreshGrantResponse{Grant: GrantEnvelope{
+ JWT: grant, JTI: "grt_serial", ExpiresAt: time.Now().Add(72 * time.Hour).UTC().Format(time.RFC3339),
+ }})
+ }))
+ defer server.Close()
+ svc := NewService()
+ svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
+ svc.mu.Lock()
+ svc.activationState = testInstallationStatusState(1)
+ svc.license = &License{Claims: Claims{Tier: TierPro}}
+ svc.mu.Unlock()
+
+ var wg sync.WaitGroup
+ errs := make(chan error, 2)
+ wg.Add(2)
+ go func() { defer wg.Done(); errs <- svc.refreshGrantOnce(context.Background()) }()
+ <-entered
+ go func() { defer wg.Done(); errs <- svc.refreshGrantOnce(context.Background()) }()
+ time.Sleep(50 * time.Millisecond)
+ if calls.Load() != 1 {
+ t.Fatalf("concurrent refresh reached server before first completed: calls=%d", calls.Load())
+ }
+ close(release)
+ wg.Wait()
+ close(errs)
+ for err := range errs {
+ if err != nil {
+ t.Fatalf("refresh error: %v", err)
+ }
+ }
+ if calls.Load() != 2 || maxActive.Load() != 1 {
+ t.Fatalf("calls=%d max_active=%d want 2/1", calls.Load(), maxActive.Load())
+ }
+}
diff --git a/pkg/licensing/license_server_client.go b/pkg/licensing/license_server_client.go
index 8ccf7a4f69..791646de5d 100644
--- a/pkg/licensing/license_server_client.go
+++ b/pkg/licensing/license_server_client.go
@@ -195,6 +195,46 @@ func (c *LicenseServerClient) RefreshGrant(ctx context.Context, installationID,
return &result, nil
}
+// CheckInstallationStatus performs the lightweight installation-authenticated
+// commercial status check. It never returns a replacement grant; callers use
+// RefreshGrant only when the authoritative version requires it.
+func (c *LicenseServerClient) CheckInstallationStatus(ctx context.Context, installationToken string, req InstallationStatusRequest) (*InstallationStatusResponse, error) {
+ if err := c.ready(); err != nil {
+ return nil, err
+ }
+
+ body, err := json.Marshal(req)
+ if err != nil {
+ return nil, fmt.Errorf("marshal installation status request: %w", err)
+ }
+ httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, c.baseURL+"/v1/grants/status", bytes.NewReader(body))
+ if err != nil {
+ return nil, fmt.Errorf("create installation status request: %w", err)
+ }
+ httpReq.Header.Set("Content-Type", "application/json")
+ httpReq.Header.Set("Authorization", "Bearer "+installationToken)
+
+ statusClient := *c.httpClient
+ statusClient.Timeout = 10 * time.Second
+ resp, err := statusClient.Do(httpReq)
+ if err != nil {
+ return nil, fmt.Errorf("installation status request failed: %w", err)
+ }
+ defer resp.Body.Close()
+ if resp.StatusCode != http.StatusOK {
+ return nil, c.parseError(resp)
+ }
+
+ var result InstallationStatusResponse
+ if err := json.NewDecoder(io.LimitReader(resp.Body, 1<<20)).Decode(&result); err != nil {
+ return nil, fmt.Errorf("decode installation status response: %w", err)
+ }
+ if result.LicenseVersion <= 0 {
+ return nil, fmt.Errorf("decode installation status response: invalid license_version %d", result.LicenseVersion)
+ }
+ return &result, nil
+}
+
// GetCheckoutSessionResult resolves a commercial checkout session into its
// authoritative fulfillment payload.
func (c *LicenseServerClient) GetCheckoutSessionResult(ctx context.Context, sessionID string) (*CheckoutSessionResult, error) {
@@ -271,45 +311,6 @@ func (c *LicenseServerClient) CreateCheckoutPortalHandoff(ctx context.Context, r
return &result, nil
}
-// FetchRevocations polls the revocation feed for events after the given sequence number.
-// The feedToken authenticates access to the revocation feed.
-func (c *LicenseServerClient) FetchRevocations(ctx context.Context, feedToken string, sinceSeq int64, limit int) (*RevocationFeedResponse, error) {
- if err := c.ready(); err != nil {
- return nil, err
- }
-
- if limit <= 0 {
- limit = 500
- }
-
- url := fmt.Sprintf("%s/v1/revocations?since_seq=%d&limit=%d", c.baseURL, sinceSeq, limit)
- httpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
- if err != nil {
- return nil, fmt.Errorf("create revocations request: %w", err)
- }
- httpReq.Header.Set("Authorization", "Bearer "+feedToken)
-
- // Use a shorter timeout for polling.
- pollClient := *c.httpClient
- pollClient.Timeout = 10 * time.Second
-
- resp, err := pollClient.Do(httpReq)
- if err != nil {
- return nil, fmt.Errorf("revocations request failed: %w", err)
- }
- defer resp.Body.Close()
-
- if resp.StatusCode != http.StatusOK {
- return nil, c.parseError(resp)
- }
-
- var result RevocationFeedResponse
- if err := json.NewDecoder(io.LimitReader(resp.Body, 1<<20)).Decode(&result); err != nil {
- return nil, fmt.Errorf("decode revocations response: %w", err)
- }
- return &result, nil
-}
-
// BaseURL returns the configured license server base URL.
func (c *LicenseServerClient) BaseURL() string {
return c.baseURL
diff --git a/pkg/licensing/models.go b/pkg/licensing/models.go
index 05dd88ad88..2df0a807c1 100644
--- a/pkg/licensing/models.go
+++ b/pkg/licensing/models.go
@@ -220,15 +220,28 @@ const (
// LicenseStatus is the JSON response for license status API.
type LicenseStatus struct {
- Valid bool `json:"valid"`
- Tier Tier `json:"tier"`
- PlanVersion string `json:"plan_version,omitempty"`
- Email string `json:"email,omitempty"`
- ExpiresAt *string `json:"expires_at,omitempty"`
- IsLifetime bool `json:"is_lifetime"`
- DaysRemaining int `json:"days_remaining"`
- Features []string `json:"features"`
- MaxGuests int `json:"max_guests,omitempty"`
- InGracePeriod bool `json:"in_grace_period,omitempty"`
- GracePeriodEnd *string `json:"grace_period_end,omitempty"`
+ Valid bool `json:"valid"`
+ Tier Tier `json:"tier"`
+ PlanVersion string `json:"plan_version,omitempty"`
+ Email string `json:"email,omitempty"`
+ ExpiresAt *string `json:"expires_at,omitempty"`
+ IsLifetime bool `json:"is_lifetime"`
+ DaysRemaining int `json:"days_remaining"`
+ Features []string `json:"features"`
+ MaxGuests int `json:"max_guests,omitempty"`
+ InGracePeriod bool `json:"in_grace_period,omitempty"`
+ GracePeriodEnd *string `json:"grace_period_end,omitempty"`
+ Synchronization *LicenseSynchronizationStatus `json:"synchronization,omitempty"`
+}
+
+// LicenseSynchronizationStatus reports non-secret health for the
+// installation-scoped commercial invalidation loop.
+type LicenseSynchronizationStatus struct {
+ Running bool `json:"running"`
+ Healthy bool `json:"healthy"`
+ Stale bool `json:"stale"`
+ LastAttemptAt *string `json:"last_attempt_at,omitempty"`
+ LastSuccessAt *string `json:"last_success_at,omitempty"`
+ NextCheckAt *string `json:"next_check_at,omitempty"`
+ ConsecutiveFailures int `json:"consecutive_failures"`
}
diff --git a/pkg/licensing/revocation_poll.go b/pkg/licensing/revocation_poll.go
deleted file mode 100644
index f357705047..0000000000
--- a/pkg/licensing/revocation_poll.go
+++ /dev/null
@@ -1,251 +0,0 @@
-package licensing
-
-import (
- "context"
- "fmt"
- "math/rand/v2"
- "sync"
- "time"
-
- "github.com/rs/zerolog/log"
-)
-
-const (
- // defaultRevocationPollInterval is the default interval between revocation feed polls.
- defaultRevocationPollInterval = 5 * time.Minute
-
- // revocationPollJitter adds randomness to prevent thundering herd.
- revocationPollJitter = 0.2
-
- // minRevocationPollBackoff is the minimum backoff after a failed poll.
- minRevocationPollBackoff = 30 * time.Second
-
- // maxRevocationPollBackoff is the maximum backoff after consecutive failures.
- maxRevocationPollBackoff = 10 * time.Minute
-)
-
-// revocationPollLoop holds state for the background revocation feed poller.
-type revocationPollLoop struct {
- mu sync.Mutex
- cancel context.CancelFunc
- wg sync.WaitGroup
- running bool
- feedToken string
- lastSeq int64
-}
-
-// StartRevocationPoll starts the background revocation feed poller.
-// The feedToken authenticates access to the revocation feed endpoint.
-// It is safe to call multiple times — only the first call starts the loop.
-func (s *Service) StartRevocationPoll(ctx context.Context, feedToken string) {
- if feedToken == "" {
- return // No token → revocation polling disabled.
- }
-
- s.mu.Lock()
- if s.revocationPoll == nil {
- s.revocationPoll = &revocationPollLoop{}
- }
- loop := s.revocationPoll
- s.mu.Unlock()
-
- loop.mu.Lock()
- defer loop.mu.Unlock()
-
- if loop.running {
- return
- }
-
- loop.feedToken = feedToken
- pollCtx, cancel := context.WithCancel(ctx)
- loop.cancel = cancel
- loop.running = true
- loop.wg.Add(1)
-
- go func() {
- defer func() {
- loop.mu.Lock()
- loop.running = false
- loop.mu.Unlock()
- loop.wg.Done()
- }()
- s.runRevocationPollLoop(pollCtx)
- }()
-
- log.Info().Msg("Revocation poll loop started")
-}
-
-// StopRevocationPoll stops the background revocation feed poller and waits for it to exit.
-func (s *Service) StopRevocationPoll() {
- s.mu.RLock()
- loop := s.revocationPoll
- s.mu.RUnlock()
-
- if loop == nil {
- return
- }
-
- loop.mu.Lock()
- if !loop.running {
- loop.mu.Unlock()
- return
- }
- loop.cancel()
- loop.mu.Unlock()
-
- loop.wg.Wait()
- log.Info().Msg("Revocation poll loop stopped")
-}
-
-// runRevocationPollLoop is the main poll goroutine.
-func (s *Service) runRevocationPollLoop(ctx context.Context) {
- consecutiveFailures := 0
-
- for {
- interval := nextRevocationPollInterval(consecutiveFailures)
-
- select {
- case <-ctx.Done():
- return
- case <-time.After(interval):
- }
-
- if err := s.pollRevocationsOnce(ctx); err != nil {
- consecutiveFailures++
- log.Warn().
- Err(err).
- Int("consecutive_failures", consecutiveFailures).
- Msg("Revocation poll failed")
- } else {
- consecutiveFailures = 0
- }
- }
-}
-
-// pollRevocationsOnce performs a single revocation feed poll.
-// maxPages limits pagination depth to prevent infinite loops.
-func (s *Service) pollRevocationsOnce(ctx context.Context) error {
- return s.pollRevocationsPage(ctx, 20) // Max 20 pages per poll cycle (10k events).
-}
-
-func (s *Service) pollRevocationsPage(ctx context.Context, remainingPages int) error {
- if remainingPages <= 0 {
- log.Warn().Msg("Revocation poll hit pagination limit, will continue next cycle")
- return nil
- }
- s.mu.RLock()
- client := s.serverClient
- state := s.activationState
- s.mu.RUnlock()
-
- if client == nil {
- return fmt.Errorf("license server client not configured")
- }
- if state == nil {
- return nil // No activation — nothing to check revocations for.
- }
-
- s.mu.RLock()
- loop := s.revocationPoll
- s.mu.RUnlock()
-
- if loop == nil {
- return fmt.Errorf("revocation poll not initialized")
- }
-
- loop.mu.Lock()
- feedToken := loop.feedToken
- sinceSeq := loop.lastSeq
- loop.mu.Unlock()
-
- resp, err := client.FetchRevocations(ctx, feedToken, sinceSeq, 500)
- if err != nil {
- return fmt.Errorf("fetch revocations: %w", err)
- }
-
- // Process events.
- for _, event := range resp.Events {
- s.handleRevocationEvent(event)
- }
-
- // Update checkpoint — but only if sequence advanced.
- loop.mu.Lock()
- advanced := resp.NextSeq > loop.lastSeq
- if advanced {
- loop.lastSeq = resp.NextSeq
- }
- loop.mu.Unlock()
-
- // If there are more events and sequence advanced, fetch next page.
- // Guard against server returning HasMore=true without advancing NextSeq.
- if resp.HasMore && advanced {
- return s.pollRevocationsPage(ctx, remainingPages-1)
- }
-
- return nil
-}
-
-// handleRevocationEvent processes a single revocation event.
-func (s *Service) handleRevocationEvent(event RevocationEvent) {
- s.mu.RLock()
- state := s.activationState
- s.mu.RUnlock()
-
- if state == nil {
- return
- }
-
- switch event.Action {
- case "revoke_license":
- if event.LicenseID == state.LicenseID {
- log.Warn().
- Str("license_id", event.LicenseID).
- Str("reason", event.ReasonCode).
- Msg("License revoked via revocation feed — clearing activation")
- s.clearActivationState()
- }
-
- case "revoke_installation":
- if event.InstallationID == state.InstallationID {
- log.Warn().
- Str("installation_id", event.InstallationID).
- Str("reason", event.ReasonCode).
- Msg("Installation revoked via revocation feed — clearing activation")
- s.clearActivationState()
- }
-
- case "bump_license_version":
- if event.LicenseID == state.LicenseID {
- // The current grant may be stale. Force an immediate refresh
- // to pick up the new license version.
- log.Info().
- Str("license_id", event.LicenseID).
- Int64("min_version", event.MinLicenseVersion).
- Msg("License version bumped — triggering immediate grant refresh")
- go func() {
- if err := s.refreshGrantOnce(context.Background()); err != nil {
- if isRevokedActivationError(err) {
- s.clearActivationState()
- return
- }
- log.Warn().Err(err).Msg("Immediate grant refresh after version bump failed")
- }
- }()
- }
- }
-}
-
-// nextRevocationPollInterval calculates the next poll delay with jitter and backoff.
-func nextRevocationPollInterval(consecutiveFailures int) time.Duration {
- if consecutiveFailures > 0 {
- backoff := minRevocationPollBackoff * (1 << min(consecutiveFailures-1, 10))
- if backoff > maxRevocationPollBackoff {
- backoff = maxRevocationPollBackoff
- }
- return backoff
- }
-
- jitterRange := float64(defaultRevocationPollInterval) * revocationPollJitter
- offset := (rand.Float64()*2 - 1) * jitterRange
- return defaultRevocationPollInterval + time.Duration(offset)
-}
diff --git a/pkg/licensing/revocation_poll_test.go b/pkg/licensing/revocation_poll_test.go
deleted file mode 100644
index f38cc6c0ee..0000000000
--- a/pkg/licensing/revocation_poll_test.go
+++ /dev/null
@@ -1,347 +0,0 @@
-package licensing
-
-import (
- "context"
- "encoding/json"
- "net/http"
- "net/http/httptest"
- "sync/atomic"
- "testing"
- "time"
-)
-
-func TestRevocationPollLoop_StartStop(t *testing.T) {
- svc := NewService()
-
- // Empty token means polling is disabled — should not start.
- svc.StartRevocationPoll(context.Background(), "")
- svc.StopRevocationPoll() // Should be no-op.
-
- // Start and stop with a real token.
- svc.StartRevocationPoll(context.Background(), "feed_token")
- svc.StartRevocationPoll(context.Background(), "feed_token") // Duplicate start is no-op.
- svc.StopRevocationPoll()
- svc.StopRevocationPoll() // Duplicate stop is no-op.
-}
-
-func TestClientFetchRevocations(t *testing.T) {
- t.Run("successful fetch", func(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.Method != http.MethodGet {
- t.Errorf("Method = %q, want GET", r.Method)
- }
- if got := r.Header.Get("Authorization"); got != "Bearer feed_token" {
- t.Errorf("Authorization = %q, want Bearer feed_token", got)
- }
- if r.URL.Query().Get("since_seq") != "5" {
- t.Errorf("since_seq = %q, want 5", r.URL.Query().Get("since_seq"))
- }
-
- json.NewEncoder(w).Encode(RevocationFeedResponse{
- FromSeq: 5,
- NextSeq: 10,
- LatestSeq: 10,
- HasMore: false,
- Events: []RevocationEvent{
- {Seq: 6, Action: "revoke_license", LicenseID: "lic_bad"},
- {Seq: 10, Action: "bump_license_version", LicenseID: "lic_other", MinLicenseVersion: 3},
- },
- })
- }))
- defer server.Close()
-
- client := NewLicenseServerClient(server.URL)
- resp, err := client.FetchRevocations(t.Context(), "feed_token", 5, 500)
- if err != nil {
- t.Fatalf("FetchRevocations failed: %v", err)
- }
- if len(resp.Events) != 2 {
- t.Fatalf("events = %d, want 2", len(resp.Events))
- }
- if resp.NextSeq != 10 {
- t.Errorf("NextSeq = %d, want 10", resp.NextSeq)
- }
- })
-
- t.Run("auth error", func(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusForbidden)
- json.NewEncoder(w).Encode(map[string]any{
- "code": "unauthorized",
- "message": "Invalid feed token",
- })
- }))
- defer server.Close()
-
- client := NewLicenseServerClient(server.URL)
- _, err := client.FetchRevocations(t.Context(), "bad_token", 0, 500)
- if err == nil {
- t.Fatal("expected error")
- }
- apiErr, ok := err.(*LicenseServerError)
- if !ok {
- t.Fatalf("expected *LicenseServerError, got %T", err)
- }
- if apiErr.StatusCode != 403 {
- t.Errorf("StatusCode = %d, want 403", apiErr.StatusCode)
- }
- })
-}
-
-func TestHandleRevocationEvent_RevokeLicense(t *testing.T) {
- setupTestPublicKey(t)
-
- initialJWT := makeTestGrantJWT(t, &GrantClaims{
- LicenseID: "lic_revoked",
- Tier: "pro",
- State: "active",
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- })
-
- svc := NewService()
- state := &ActivationState{
- InstallationID: "inst_test",
- LicenseID: "lic_revoked",
- GrantJWT: initialJWT,
- }
- if err := svc.RestoreActivation(state); err != nil {
- t.Fatalf("RestoreActivation: %v", err)
- }
-
- // Non-matching license should be ignored.
- svc.handleRevocationEvent(RevocationEvent{
- Action: "revoke_license",
- LicenseID: "lic_other",
- })
- if !svc.IsActivated() {
- t.Error("non-matching revocation should not clear activation")
- }
-
- // Matching license should clear activation.
- svc.handleRevocationEvent(RevocationEvent{
- Action: "revoke_license",
- LicenseID: "lic_revoked",
- })
- if svc.IsActivated() {
- t.Error("matching revocation should clear activation")
- }
- if svc.Current() != nil {
- t.Error("license should be nil after revocation")
- }
-}
-
-func TestHandleRevocationEvent_RevokeInstallation(t *testing.T) {
- setupTestPublicKey(t)
-
- initialJWT := makeTestGrantJWT(t, &GrantClaims{
- LicenseID: "lic_test",
- Tier: "pro",
- State: "active",
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- })
-
- svc := NewService()
- state := &ActivationState{
- InstallationID: "inst_revoked",
- LicenseID: "lic_test",
- GrantJWT: initialJWT,
- }
- if err := svc.RestoreActivation(state); err != nil {
- t.Fatalf("RestoreActivation: %v", err)
- }
-
- svc.handleRevocationEvent(RevocationEvent{
- Action: "revoke_installation",
- InstallationID: "inst_revoked",
- })
- if svc.IsActivated() {
- t.Error("matching installation revocation should clear activation")
- }
-}
-
-func TestHandleRevocationEvent_BumpLicenseVersion(t *testing.T) {
- setupTestPublicKey(t)
-
- // When bump_license_version fires, it should trigger an immediate grant refresh.
- var refreshCalled atomic.Int32
- newJWT := makeTestGrantJWT(t, &GrantClaims{
- LicenseID: "lic_bumped",
- Tier: "pro",
- State: "active",
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- })
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- refreshCalled.Add(1)
- json.NewEncoder(w).Encode(RefreshGrantResponse{
- Grant: GrantEnvelope{
- JWT: newJWT,
- JTI: "grant_bumped",
- ExpiresAt: time.Now().Add(72 * time.Hour).UTC().Format(time.RFC3339),
- },
- })
- }))
- defer server.Close()
-
- initialJWT := makeTestGrantJWT(t, &GrantClaims{
- LicenseID: "lic_bumped",
- Tier: "pro",
- State: "active",
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- })
-
- svc := NewService()
- svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
- state := &ActivationState{
- InstallationID: "inst_bump",
- InstallationToken: "pit_live_bump",
- LicenseID: "lic_bumped",
- GrantJWT: initialJWT,
- GrantJTI: "grant_old",
- InstanceFingerprint: "fp-bump",
- }
- svc.mu.Lock()
- svc.activationState = state
- svc.mu.Unlock()
- if err := svc.RestoreActivation(state); err != nil {
- t.Fatalf("RestoreActivation: %v", err)
- }
-
- // Non-matching license should not trigger refresh.
- svc.handleRevocationEvent(RevocationEvent{
- Action: "bump_license_version",
- LicenseID: "lic_other",
- MinLicenseVersion: 5,
- })
- time.Sleep(50 * time.Millisecond)
- if refreshCalled.Load() != 0 {
- t.Error("non-matching bump should not trigger refresh")
- }
-
- // Matching license should trigger async refresh.
- svc.handleRevocationEvent(RevocationEvent{
- Action: "bump_license_version",
- LicenseID: "lic_bumped",
- MinLicenseVersion: 5,
- })
- // Wait for the async goroutine.
- deadline := time.After(2 * time.Second)
- for refreshCalled.Load() == 0 {
- select {
- case <-deadline:
- t.Fatal("timed out waiting for refresh after version bump")
- default:
- time.Sleep(10 * time.Millisecond)
- }
- }
-}
-
-func TestNextRevocationPollInterval(t *testing.T) {
- t.Run("zero failures returns near default", func(t *testing.T) {
- interval := nextRevocationPollInterval(0)
- low := defaultRevocationPollInterval - defaultRevocationPollInterval/5
- high := defaultRevocationPollInterval + defaultRevocationPollInterval/5
- if interval < low || interval > high {
- t.Errorf("interval = %v, want between %v and %v", interval, low, high)
- }
- })
-
- t.Run("first failure returns min backoff", func(t *testing.T) {
- interval := nextRevocationPollInterval(1)
- if interval != minRevocationPollBackoff {
- t.Errorf("interval = %v, want %v", interval, minRevocationPollBackoff)
- }
- })
-
- t.Run("capped at max", func(t *testing.T) {
- interval := nextRevocationPollInterval(20)
- if interval > maxRevocationPollBackoff {
- t.Errorf("interval = %v, want <= %v", interval, maxRevocationPollBackoff)
- }
- })
-}
-
-func TestPollRevocationsOnce_NoActivation(t *testing.T) {
- svc := NewService()
- svc.SetLicenseServerClient(NewLicenseServerClient("http://localhost"))
- svc.mu.Lock()
- svc.revocationPoll = &revocationPollLoop{feedToken: "token"}
- svc.mu.Unlock()
-
- // No activation state — should return nil (nothing to check).
- err := svc.pollRevocationsOnce(context.Background())
- if err != nil {
- t.Fatalf("expected nil error, got: %v", err)
- }
-}
-
-func TestPollRevocationsOnce_Pagination(t *testing.T) {
- setupTestPublicKey(t)
-
- page := 0
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- page++
- if page == 1 {
- json.NewEncoder(w).Encode(RevocationFeedResponse{
- FromSeq: 0,
- NextSeq: 5,
- LatestSeq: 10,
- HasMore: true,
- Events: []RevocationEvent{{Seq: 5, Action: "revoke_license", LicenseID: "lic_other"}},
- })
- } else {
- json.NewEncoder(w).Encode(RevocationFeedResponse{
- FromSeq: 5,
- NextSeq: 10,
- LatestSeq: 10,
- HasMore: false,
- Events: []RevocationEvent{{Seq: 10, Action: "revoke_license", LicenseID: "lic_other"}},
- })
- }
- }))
- defer server.Close()
-
- initialJWT := makeTestGrantJWT(t, &GrantClaims{
- LicenseID: "lic_mine",
- Tier: "pro",
- State: "active",
- IssuedAt: time.Now().Unix(),
- ExpiresAt: time.Now().Add(72 * time.Hour).Unix(),
- })
-
- svc := NewService()
- svc.SetLicenseServerClient(NewLicenseServerClient(server.URL))
- svc.mu.Lock()
- svc.activationState = &ActivationState{
- InstallationID: "inst_test",
- LicenseID: "lic_mine",
- GrantJWT: initialJWT,
- }
- svc.revocationPoll = &revocationPollLoop{feedToken: "token"}
- svc.mu.Unlock()
- if err := svc.RestoreActivation(svc.activationState); err != nil {
- t.Fatalf("RestoreActivation: %v", err)
- }
-
- err := svc.pollRevocationsOnce(context.Background())
- if err != nil {
- t.Fatalf("pollRevocationsOnce: %v", err)
- }
- if page != 2 {
- t.Errorf("expected 2 pages fetched, got %d", page)
- }
-
- // Checkpoint should be at 10.
- svc.mu.RLock()
- loop := svc.revocationPoll
- svc.mu.RUnlock()
- loop.mu.Lock()
- seq := loop.lastSeq
- loop.mu.Unlock()
- if seq != 10 {
- t.Errorf("lastSeq = %d, want 10", seq)
- }
-}
diff --git a/pkg/licensing/service.go b/pkg/licensing/service.go
index 0ee0f2c6e4..0594edc64e 100644
--- a/pkg/licensing/service.go
+++ b/pkg/licensing/service.go
@@ -88,10 +88,11 @@ type Service struct {
stateMachineConfigured bool
// Activation-key license server fields.
- serverClient *LicenseServerClient // HTTP client for license server
- activationState *ActivationState // Current activation state (nil if using legacy JWT)
- grantRefresh *grantRefreshLoop // Background refresh loop (nil until started)
- revocationPoll *revocationPollLoop // Background revocation feed poller (nil until started)
+ serverClient *LicenseServerClient // HTTP client for license server
+ activationState *ActivationState // Current activation state (nil if using legacy JWT)
+ grantRefresh *grantRefreshLoop // Background refresh loop (nil until started)
+ installationStatus *installationStatusPollLoop // Installation-scoped invalidation loop
+ refreshMu sync.Mutex // Serializes scheduled and status-triggered refreshes
// Persistence reference for activation state save/load. Set via SetPersistence.
persistence *Persistence
@@ -187,7 +188,7 @@ func (s *Service) Activate(licenseKey string) (*License, error) {
// JWT validated successfully — now safe to tear down any existing activation.
s.StopGrantRefresh()
- s.StopRevocationPoll()
+ s.StopInstallationStatusPoll()
s.mu.Lock()
s.license = cloneLicense(license)
@@ -354,6 +355,7 @@ func (s *Service) applyActivationResponse(
GrantJWT: resp.Grant.JWT,
GrantJTI: resp.Grant.JTI,
GrantExpiresAt: resp.Grant.ParseExpiresAt(),
+ LicenseVersion: gc.LicenseVersion,
InstanceFingerprint: fingerprint,
LicenseServerURL: serverURL,
ActivatedAt: now,
@@ -453,13 +455,19 @@ func (s *Service) RestoreActivation(state *ActivationState) error {
stateCopy := *state
stateCopy.Continuity = normalizeActivationContinuity(stateCopy.Continuity)
+ stateCopy.LicenseVersion = gc.LicenseVersion
lic := grantClaimsToLicenseWithContinuity(gc, stateCopy.GrantJWT, stateCopy.Continuity)
s.mu.Lock()
- s.license = cloneLicense(lic)
- source := NewTokenSource(&s.license.Claims)
- s.evaluator = NewEvaluator(source)
+ if stateCopy.PaidAccessSuspended {
+ s.license = nil
+ s.evaluator = nil
+ } else {
+ s.license = cloneLicense(lic)
+ source := NewTokenSource(&s.license.Claims)
+ s.evaluator = NewEvaluator(source)
+ }
s.activationState = &stateCopy
persistence := s.persistence
cb := s.onLicenseChange
@@ -489,7 +497,7 @@ func (s *Service) RestoreActivation(state *ActivationState) error {
func (s *Service) Clear() {
// Stop background loops first (outside the lock to avoid deadlock).
s.StopGrantRefresh()
- s.StopRevocationPoll()
+ s.StopInstallationStatusPoll()
s.mu.Lock()
s.license = nil
@@ -691,6 +699,7 @@ func (s *Service) Status() *LicenseStatus {
Tier: TierFree,
Features: append([]string(nil), TierFeatures[TierFree]...),
}
+ status.Synchronization = s.installationStatusSnapshotLocked(time.Now())
if s.license == nil {
// Hosted path: evaluator drives status when no JWT is present.
diff --git a/scripts/release_control/canonical_completion_guard_test.py b/scripts/release_control/canonical_completion_guard_test.py
index b1aeac9fcc..f9d92876de 100644
--- a/scripts/release_control/canonical_completion_guard_test.py
+++ b/scripts/release_control/canonical_completion_guard_test.py
@@ -2720,6 +2720,7 @@ None yet.
"test_prefixes": [],
"exact_files": [
"pkg/licensing/cloud_paid_guardrails_test.go",
+ "pkg/licensing/installation_status_poll_test.go",
"pkg/licensing/models_test.go",
"pkg/licensing/service_activate_test.go",
],
@@ -2745,6 +2746,7 @@ None yet.
"exact_files": [
"pkg/licensing/activation_types_test.go",
"pkg/licensing/grant_claims_contract_test.go",
+ "pkg/licensing/installation_status_poll_test.go",
"pkg/licensing/service_activate_test.go",
],
}
@@ -2868,7 +2870,7 @@ None yet.
[
"pkg/licensing/service.go",
"pkg/licensing/grant_refresh.go",
- "pkg/licensing/revocation_poll.go",
+ "pkg/licensing/installation_status_poll.go",
],
)
self.assertEqual(
@@ -2880,14 +2882,14 @@ None yet.
"touched_runtime_files": [
"pkg/licensing/service.go",
"pkg/licensing/grant_refresh.go",
- "pkg/licensing/revocation_poll.go",
+ "pkg/licensing/installation_status_poll.go",
],
"allow_same_subsystem_tests": False,
"test_prefixes": [],
"exact_files": [
"pkg/licensing/cloud_paid_guardrails_test.go",
"pkg/licensing/grant_refresh_test.go",
- "pkg/licensing/revocation_poll_test.go",
+ "pkg/licensing/installation_status_poll_test.go",
"pkg/licensing/service_activate_test.go",
],
}
@@ -2910,8 +2912,8 @@ None yet.
"allow_same_subsystem_tests": False,
"test_prefixes": [],
"exact_files": [
+ "pkg/licensing/installation_status_poll_test.go",
"pkg/licensing/license_server_client_test.go",
- "pkg/licensing/revocation_poll_test.go",
],
}
],
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 03542422d5..a4314a415f 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -2970,7 +2970,7 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 1214,
+ "line": 1225,
"heading_line": 144,
}
],