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.

Stop advertising retired Relay upgrades in licensing payloads

pulse-triage[bot]0e4fb6819511
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 676bdc2302..01557b23f5 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -3692,3 +3692,13 @@ Mobile settings gate and Alerts push panel carry no upgrade prompt. The
`relay` feature is labelled "Pulse Relay (Mobile Connection)" because it never
provided remote access to the web UI. Pulse Mobile retires on 31 March 2027;
until then licensed instances keep pairing and push unchanged.
+
+The backend feature catalog follows the same boundary: `relay`, `mobile_app`
+and `push_notifications` have no generic upgrade reason. Both full entitlements
+and non-billing commercial posture omit those retired offers. Missing extended
+history advertises only Pro's 90 days, never Relay or remote web access. Catalog
+roles, capability grants, subscriber terms and the legacy `relay` runtime's
+14-day compatibility limit remain unchanged. The retirement HTTP regression
+checks both commercial projections and runtime capabilities for Community,
+legacy Relay and Pro; continuing Relay subscribers' Pro grants remain owned by
+the license server, not inferred from a legacy tier payload.
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 83c78de340..8dc5461bd5 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -8653,10 +8653,7 @@ func TestContract_SelfHostedCommunityEntitlementsJSONSnapshot(t *testing.T) {
"limits":[],
"subscription_state":"active",
"upgrade_reasons":[
- {"key":"mobile_app","reason":"Get Relay so Pulse Mobile can pair with this instance for secure handoff and notifications.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=mobile_app"},
- {"key":"push_notifications","reason":"Get Relay so important alerts reach you immediately on mobile instead of waiting for you to reopen Pulse.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=push_notifications"},
- {"key":"relay","reason":"Get Relay so Pulse stays reachable securely from anywhere instead of only on the local dashboard.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=relay"},
- {"key":"long_term_metrics","reason":"Get Relay for 14 days of history, or Pro for 90 days, so you can see what changed before and after an incident.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=long_term_metrics"},
+ {"key":"long_term_metrics","reason":"Upgrade to Pro for 90 days of metric history, so you can see what changed before and after an incident.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=long_term_metrics"},
{"key":"ai_autofix","reason":"Upgrade to Pro so Patrol can investigate issues, apply safe fixes within Patrol mode, and verify the result.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=ai_autofix"},
{"key":"ai_alerts","reason":"Upgrade to Pro so Patrol can investigate issues instead of handing you a stack of symptoms.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=ai_alerts"},
{"key":"rbac","reason":"Upgrade to Pro when more than one operator needs safe access boundaries around infrastructure changes.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=rbac"},
diff --git a/internal/api/entitlement_retirement_test.go b/internal/api/entitlement_retirement_test.go
new file mode 100644
index 0000000000..32df5e6bb8
--- /dev/null
+++ b/internal/api/entitlement_retirement_test.go
@@ -0,0 +1,155 @@
+package api
+
+import (
+ "context"
+ "encoding/base64"
+ "encoding/json"
+ "io"
+ "net/http"
+ "net/http/httptest"
+ "reflect"
+ "slices"
+ "strings"
+ "testing"
+ "time"
+
+ pkglicensing "github.com/rcourtman/pulse-go-rewrite/pkg/licensing"
+ licensetestsupport "github.com/rcourtman/pulse-go-rewrite/pkg/licensing/testsupport"
+)
+
+func TestLicenseHTTPRetirementCopyPreservesEntitlements(t *testing.T) {
+ t.Setenv("PULSE_LICENSE_DEV_MODE", "true")
+ for _, tier := range []pkglicensing.Tier{pkglicensing.TierFree, pkglicensing.TierRelay, pkglicensing.TierPro} {
+ t.Run(string(tier), func(t *testing.T) {
+ handler := createTestHandler(t)
+ if tier != pkglicensing.TierFree {
+ key, err := licensetestsupport.GenerateLicenseForTesting("[email protected]", tier, 24*time.Hour)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := handler.Service(context.Background()).Activate(key); err != nil {
+ t.Fatal(err)
+ }
+ }
+ mux := http.NewServeMux()
+ mux.HandleFunc("GET /api/license/entitlements", handler.HandleEntitlements)
+ mux.HandleFunc("GET /api/license/commercial-posture", handler.HandleCommercialPosture)
+ mux.HandleFunc("GET /api/license/runtime-capabilities", handler.HandleRuntimeCapabilities)
+ server := httptest.NewServer(mux)
+ defer server.Close()
+
+ fixtures := make(map[string]json.RawMessage)
+ for _, endpoint := range []string{"entitlements", "commercial-posture", "runtime-capabilities"} {
+ response, err := server.Client().Get(server.URL + "/api/license/" + endpoint)
+ if err != nil {
+ t.Fatal(err)
+ }
+ body, err := io.ReadAll(response.Body)
+ response.Body.Close()
+ if err != nil || response.StatusCode != http.StatusOK {
+ t.Fatalf("%s: status %d, read %v", endpoint, response.StatusCode, err)
+ }
+ fixtures[endpoint] = body
+ }
+ var entitlement EntitlementPayload
+ var posture CommercialPosturePayload
+ var runtime RuntimeCapabilitiesPayload
+ for _, decode := range []struct {
+ name string
+ out any
+ }{
+ {"entitlements", &entitlement},
+ {"commercial-posture", &posture},
+ {"runtime-capabilities", &runtime},
+ } {
+ if err := json.Unmarshal(fixtures[decode.name], decode.out); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if entitlement.Tier != string(tier) || posture.Tier != string(tier) {
+ t.Fatal("marketing correction changed the active tier")
+ }
+ if entitlement.MaxHistoryDays != pkglicensing.TierHistoryDays[tier] || runtime.MaxHistoryDays != entitlement.MaxHistoryDays {
+ t.Fatalf("history compatibility changed: entitlement %d, runtime %d", entitlement.MaxHistoryDays, runtime.MaxHistoryDays)
+ }
+ // Signed activation canonicalizes capability order; grants are a set.
+ wantCapabilities := slices.Clone(pkglicensing.TierFeatures[tier])
+ gotCapabilities := slices.Clone(entitlement.Capabilities)
+ slices.Sort(wantCapabilities)
+ slices.Sort(gotCapabilities)
+ if !slices.Equal(gotCapabilities, wantCapabilities) {
+ t.Fatalf("grants = %v, want %v", gotCapabilities, wantCapabilities)
+ }
+ // This is the public Community binary, not the private Pro runtime.
+ // Its existing paid-runtime fence must survive the copy correction.
+ if runtime.Runtime == nil || runtime.Runtime.Build != pkglicensing.RuntimeBuildCommunity {
+ t.Fatalf("runtime identity = %+v, want Community", runtime.Runtime)
+ }
+ wantRuntimeCapabilities := slices.Clone(wantCapabilities)
+ privateRuntimeCapabilities := []string{
+ pkglicensing.FeatureAgentProfiles, pkglicensing.FeatureAIAlerts,
+ pkglicensing.FeatureAIAutoFix, pkglicensing.FeatureAuditLogging,
+ pkglicensing.FeatureKubernetesAI, pkglicensing.FeatureRBAC,
+ }
+ if tier == pkglicensing.TierPro {
+ wantRuntimeCapabilities = slices.DeleteFunc(wantRuntimeCapabilities, func(feature string) bool {
+ return slices.Contains(privateRuntimeCapabilities, feature)
+ })
+ blockedKeys := make([]string, 0, len(runtime.BlockedCapabilities))
+ for _, block := range runtime.BlockedCapabilities {
+ blockedKeys = append(blockedKeys, block.Key)
+ if block.Reason != "paid_runtime_required" || block.ActionURL != pkglicensing.PulseProDownloadURL {
+ t.Errorf("private-runtime recovery changed: %+v", block)
+ }
+ }
+ slices.Sort(blockedKeys)
+ slices.Sort(privateRuntimeCapabilities)
+ if !slices.Equal(blockedKeys, privateRuntimeCapabilities) {
+ t.Fatalf("private-runtime blocks = %v, want %v", blockedKeys, privateRuntimeCapabilities)
+ }
+ }
+ gotRuntimeCapabilities := slices.Clone(runtime.Capabilities)
+ slices.Sort(gotRuntimeCapabilities)
+ if !slices.Equal(gotRuntimeCapabilities, wantRuntimeCapabilities) {
+ t.Fatalf("runtime capabilities = %v, want %v", gotRuntimeCapabilities, wantRuntimeCapabilities)
+ }
+ if !reflect.DeepEqual(posture.UpgradeReasons, entitlement.UpgradeReasons) {
+ t.Fatal("commercial projection disagrees with full entitlement reasons")
+ }
+ foundHistory := false
+ for _, reason := range posture.UpgradeReasons {
+ switch reason.Key {
+ case pkglicensing.FeatureRelay, pkglicensing.FeatureMobileApp, pkglicensing.FeaturePushNotifications:
+ t.Errorf("%s still markets retired %s", tier, reason.Key)
+ case pkglicensing.FeatureLongTermMetrics:
+ foundHistory = true
+ if reason.Reason != "Upgrade to Pro for 90 days of metric history, so you can see what changed before and after an incident." {
+ t.Errorf("obsolete history offer: %q", reason.Reason)
+ }
+ }
+ if strings.Contains(reason.Reason, "Get Relay") {
+ t.Errorf("retired offer: %q", reason.Reason)
+ }
+ }
+ if foundHistory != (tier == pkglicensing.TierFree) {
+ t.Error("history upgrade must only appear for a missing capability")
+ }
+ for _, forbidden := range []string{"licensed_email", "plan_version", "max_history_days", "capabilities"} {
+ var fields map[string]json.RawMessage
+ if err := json.Unmarshal(fixtures["commercial-posture"], &fields); err != nil {
+ t.Fatal(err)
+ }
+ if _, ok := fields[forbidden]; ok {
+ t.Errorf("commercial posture leaked %s", forbidden)
+ }
+ }
+ encoded, err := json.Marshal(fixtures)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Synthetic handler output feeds the offline consuming-browser proof.
+ // Never include activated license keys or real customer data here.
+ t.Logf("RETIREMENT_FIXTURE:%s:%s", tier, base64.StdEncoding.EncodeToString(encoded))
+ })
+ }
+}
diff --git a/pkg/licensing/self_hosted_feature_catalog.go b/pkg/licensing/self_hosted_feature_catalog.go
index cf4014537f..2802b234b6 100644
--- a/pkg/licensing/self_hosted_feature_catalog.go
+++ b/pkg/licensing/self_hosted_feature_catalog.go
@@ -101,8 +101,6 @@ var featureMetadataCatalog = map[string]FeatureMetadata{
Relay: SelfHostedFeatureRolePrimaryPillar,
Pro: SelfHostedFeatureRoleIncluded,
},
- UpgradeReason: "Get Relay so Pulse stays reachable securely from anywhere instead of only on the local dashboard.",
- UpgradePriority: 1,
},
FeatureMobileApp: {
Key: FeatureMobileApp,
@@ -115,8 +113,6 @@ var featureMetadataCatalog = map[string]FeatureMetadata{
Relay: SelfHostedFeatureRolePrimaryPillar,
Pro: SelfHostedFeatureRoleIncluded,
},
- UpgradeReason: "Get Relay so Pulse Mobile can pair with this instance for secure handoff and notifications.",
- UpgradePriority: 1,
},
FeaturePushNotifications: {
Key: FeaturePushNotifications,
@@ -129,8 +125,6 @@ var featureMetadataCatalog = map[string]FeatureMetadata{
Relay: SelfHostedFeatureRolePrimaryPillar,
Pro: SelfHostedFeatureRoleIncluded,
},
- UpgradeReason: "Get Relay so important alerts reach you immediately on mobile instead of waiting for you to reopen Pulse.",
- UpgradePriority: 1,
},
FeatureLongTermMetrics: {
Key: FeatureLongTermMetrics,
@@ -143,7 +137,7 @@ var featureMetadataCatalog = map[string]FeatureMetadata{
Relay: SelfHostedFeatureRolePrimaryPillar,
Pro: SelfHostedFeatureRolePrimaryPillar,
},
- UpgradeReason: "Get Relay for 14 days of history, or Pro for 90 days, so you can see what changed before and after an incident.",
+ UpgradeReason: "Upgrade to Pro for 90 days of metric history, so you can see what changed before and after an incident.",
UpgradePriority: 2,
},
FeatureAIAlerts: {
diff --git a/pkg/licensing/upgrade_reasons.go b/pkg/licensing/upgrade_reasons.go
index 49a911543a..3e18962391 100644
--- a/pkg/licensing/upgrade_reasons.go
+++ b/pkg/licensing/upgrade_reasons.go
@@ -11,9 +11,9 @@ type ReasonEntry struct {
}
// UpgradeReasonMatrix is the canonical feature-to-upgrade-reason mapping.
-// Relay features use "Upgrade to Relay" messaging; Pro features use "Upgrade to Pro".
-// Compatibility-only capabilities must not appear here as generic marketed
-// upgrade reasons.
+// Retired Relay/mobile capabilities remain available to existing entitlements,
+// but must not appear here as marketed upgrades. Current paid features use Pro
+// messaging; compatibility-only capabilities also stay out of this matrix.
var UpgradeReasonMatrix = buildUpgradeReasonMatrix()
func buildUpgradeReasonMatrix() []ReasonEntry {
diff --git a/pkg/licensing/upgrade_retirement_test.go b/pkg/licensing/upgrade_retirement_test.go
new file mode 100644
index 0000000000..7a24565494
--- /dev/null
+++ b/pkg/licensing/upgrade_retirement_test.go
@@ -0,0 +1,55 @@
+package licensing
+
+import "testing"
+
+func TestRetiredRelayCapabilitiesHaveNoUpgradeOffer(t *testing.T) {
+ for _, feature := range []string{FeatureRelay, FeatureMobileApp, FeaturePushNotifications} {
+ t.Run(feature, func(t *testing.T) {
+ metadata, ok := GetFeatureMetadata(feature)
+ if !ok {
+ t.Fatal("retirement must preserve compatibility metadata")
+ }
+ if metadata.UpgradeReason != "" || metadata.UpgradePriority != 0 {
+ t.Errorf("retired capability still markets an upgrade: %+v", metadata)
+ }
+ for _, entry := range GenericUpgradeFeatureMetadata() {
+ if entry.Key == feature {
+ t.Error("retired capability remains in marketed metadata")
+ }
+ }
+ for _, tier := range []Tier{TierFree, TierRelay, TierPro} {
+ for _, reason := range GenerateUpgradeReasons(TierFeatures[tier]) {
+ if reason.Feature == feature {
+ t.Errorf("%s still offers retired %s", tier, feature)
+ }
+ }
+ }
+ })
+ }
+}
+
+func TestHistoryUpgradeOffersOnlyCurrentProPlan(t *testing.T) {
+ const want = "Upgrade to Pro for 90 days of metric history, so you can see what changed before and after an incident."
+ found := false
+ for _, reason := range GenerateUpgradeReasons(TierFeatures[TierFree]) {
+ if reason.Feature == FeatureLongTermMetrics {
+ found = true
+ if reason.Reason != want {
+ t.Errorf("history upgrade = %q, want %q", reason.Reason, want)
+ }
+ if reason.ActionURL != UpgradeURLForFeature(FeatureLongTermMetrics) {
+ t.Error("history upgrade lost its current feature destination")
+ }
+ }
+ }
+ if !found {
+ t.Fatal("Community must retain its current Pro history upgrade")
+ }
+ for _, tier := range []Tier{TierRelay, TierPro, TierProAnnual, TierLifetime} {
+ for _, reason := range GenerateUpgradeReasons(TierFeatures[tier]) {
+ if reason.Feature == FeatureLongTermMetrics {
+ t.Errorf("entitled %s must not offer an already granted capability", tier)
+ }
+ }
+ }
+}
diff --git a/pkg/licensing/upgrade_test.go b/pkg/licensing/upgrade_test.go
index 7b36a6e606..cb1b4e61ed 100644
--- a/pkg/licensing/upgrade_test.go
+++ b/pkg/licensing/upgrade_test.go
@@ -93,13 +93,13 @@ func TestResolvePulseAccountPortalURL_RejectsInvalidOverrides(t *testing.T) {
func TestOperatorOutcomeUpgradeReasonsRemainCanonical(t *testing.T) {
expected := map[string]string{
- FeatureRelay: "Get Relay so Pulse stays reachable securely from anywhere instead of only on the local dashboard.",
- FeatureLongTermMetrics: "Get Relay for 14 days of history, or Pro for 90 days, so you can see what changed before and after an incident.",
+ FeatureLongTermMetrics: "Upgrade to Pro for 90 days of metric history, so you can see what changed before and after an incident.",
FeatureAIAlerts: "Upgrade to Pro so Patrol can investigate issues instead of handing you a stack of symptoms.",
FeatureAIAutoFix: "Upgrade to Pro so Patrol can investigate issues, apply safe fixes within Patrol mode, and verify the result.",
FeatureExternalProbe: "Upgrade to Pro to run availability checks from an agent outside the monitored site and report the results back to Pulse for alerting.",
}
+ found := make(map[string]bool, len(expected))
for _, entry := range UpgradeReasonMatrix {
want, ok := expected[entry.Feature]
if !ok {
@@ -108,6 +108,12 @@ func TestOperatorOutcomeUpgradeReasonsRemainCanonical(t *testing.T) {
if entry.Reason != want {
t.Fatalf("reason for %q = %q, want %q", entry.Feature, entry.Reason, want)
}
+ found[entry.Feature] = true
+ }
+ for feature := range expected {
+ if !found[feature] {
+ t.Errorf("missing current upgrade reason for %q", feature)
+ }
}
}
@@ -140,9 +146,6 @@ func TestCompatibilityOnlyFeatureUpgradeURLsFallBackToGenericPricing(t *testing.
func TestUpgradeReasonMatrixDerivesFromCanonicalFeatureMetadata(t *testing.T) {
expectedOrder := []string{
- FeatureMobileApp,
- FeaturePushNotifications,
- FeatureRelay,
FeatureLongTermMetrics,
FeatureAIAutoFix,
FeatureAIAlerts,