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.

Retire stale trial upgrade fallback

rcourtman552bacfe82bb
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 449c67cd59..9f6ba8455c 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -533,7 +533,10 @@ pricing handoff destinations; no ordinary self-hosted runtime path should emit
them as an upgrade reason or plan-page CTA.
Legacy browser arrivals carrying that stale feature may land on the neutral
Plans & Activation surface, but must not preserve `trial_expired` into a Pulse
-Account purchase-start handoff or trial-shaped checkout feature.
+Account purchase-start handoff or trial-shaped checkout feature. The shared
+upgrade-action fallback must therefore return no action for retired trial keys,
+while the legacy `/pricing?feature=trial_expired` browser route may strip the
+stale feature and route to `/settings/system/billing/plan`.
The monitored-system app-shell warning CTA now follows that same commercial
boundary by rendering only in hosted mode. Ordinary self-hosted installs must
not see finite monitored-system pressure in the global app shell; when hosted
diff --git a/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx b/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
index a4b9a742a4..aebbd92ec1 100644
--- a/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
+++ b/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
@@ -83,4 +83,21 @@ describe('PricingHandoff', () => {
expect(await screen.findByText('Billing destination')).toBeInTheDocument();
expect(handoffToExternalPricingMock).not.toHaveBeenCalled();
});
+
+ it('keeps retired trial pricing handoffs on the neutral Plans surface', async () => {
+ window.history.replaceState({}, '', '/pricing?feature=trial_expired');
+
+ render(() => (
+ <Router>
+ <Route path="/pricing" component={PricingHandoff} />
+ <Route
+ path="/settings/system/billing/plan"
+ component={() => <div>Plans destination</div>}
+ />
+ </Router>
+ ));
+
+ expect(await screen.findByText('Plans destination')).toBeInTheDocument();
+ expect(handoffToExternalPricingMock).not.toHaveBeenCalled();
+ });
});
diff --git a/frontend-modern/src/stores/__tests__/license.test.ts b/frontend-modern/src/stores/__tests__/license.test.ts
index 121e8d3194..89814fdafe 100644
--- a/frontend-modern/src/stores/__tests__/license.test.ts
+++ b/frontend-modern/src/stores/__tests__/license.test.ts
@@ -451,6 +451,21 @@ describe('license stores', () => {
);
});
+ it('drops retired trial upgrade actions instead of reviving a paid prompt', async () => {
+ vi.mocked(LicenseAPI.getCommercialPosture).mockResolvedValue({
+ ...mockCommercialPosture,
+ upgrade_reasons: [
+ {
+ key: 'trial_expired',
+ reason: 'Trial expired',
+ action_url: '/auth/license-purchase-start?feature=trial_expired',
+ },
+ ],
+ });
+ await loadCommercialPosture(true);
+ expect(getUpgradeActionUrlOrFallback('trial_expired')).toBe('');
+ });
+
it('keeps specific monitored-system upgrade actions on usage review', async () => {
vi.mocked(LicenseAPI.getCommercialPosture).mockResolvedValue({
...mockCommercialPosture,
diff --git a/frontend-modern/src/stores/licenseCommercial.ts b/frontend-modern/src/stores/licenseCommercial.ts
index f9556959c5..79cea6e41c 100644
--- a/frontend-modern/src/stores/licenseCommercial.ts
+++ b/frontend-modern/src/stores/licenseCommercial.ts
@@ -8,6 +8,7 @@ import { eventBus } from '@/stores/events';
import { logger } from '@/utils/logger';
import {
getUpgradeFallbackDestination,
+ isRetiredPricingFeature,
isSelfHostedPurchaseStartDestination,
} from '@/utils/pricingHandoff';
import { resolveUpgradeDestination, type UpgradeDestination } from '@/utils/upgradeNavigation';
@@ -142,11 +143,16 @@ export function getFirstUpgradeActionUrl(): string | undefined {
export function getUpgradeActionDestination(key: string): UpgradeDestination {
const productOwnedHref = key ? getUpgradeFallbackDestination(key) : undefined;
+ if (isRetiredPricingFeature(key)) {
+ return resolveUpgradeDestination(undefined);
+ }
+
const href =
productOwnedHref ||
getUpgradeActionUrl(key) ||
getFirstUpgradeActionUrl() ||
- getUpgradeFallbackDestination(key);
+ getUpgradeFallbackDestination(key) ||
+ '';
if (isSelfHostedPurchaseStartDestination(href)) {
return resolveUpgradeDestination(href, {
diff --git a/frontend-modern/src/utils/__tests__/pricingHandoff.test.ts b/frontend-modern/src/utils/__tests__/pricingHandoff.test.ts
index 5bb679a78e..d228774223 100644
--- a/frontend-modern/src/utils/__tests__/pricingHandoff.test.ts
+++ b/frontend-modern/src/utils/__tests__/pricingHandoff.test.ts
@@ -10,7 +10,9 @@ import {
getPricingRouteDestination,
getPublicPricingUrl,
getUpgradeFallbackDestination,
+ getInProductPricingDestination,
isExternalPricingDestination,
+ isRetiredPricingFeature,
isSelfHostedPurchaseStartDestination,
resolveCanonicalSelfHostedBillingHref,
resolveSelfHostedBillingSection,
@@ -80,11 +82,16 @@ describe('pricingHandoff', () => {
}
});
- it('does not keep retired trial-expired as an owned in-product billing intent', () => {
+ it('keeps retired trial-expired out of upgrade fallbacks while preserving neutral legacy arrival', () => {
expect(getPricingRouteDestination('?feature=trial_expired')).toBe(
SELF_HOSTED_PRO_BILLING_PLAN_HREF,
);
- expect(getUpgradeFallbackDestination('trial_expired')).toBe(SELF_HOSTED_PRO_BILLING_PLAN_HREF);
+ expect(getInProductPricingDestination('trial_expired')).toBeUndefined();
+ expect(getUpgradeFallbackDestination('trial_expired')).toBeUndefined();
+ expect(isRetiredPricingFeature('trial_expired')).toBe(true);
+ expect(
+ isSelfHostedPurchaseStartDestination(getPricingRouteDestination('?feature=trial_expired')),
+ ).toBe(false);
});
it('routes unknown feature upgrades to Pulse Account purchase start', () => {
diff --git a/frontend-modern/src/utils/pricingHandoff.ts b/frontend-modern/src/utils/pricingHandoff.ts
index 7f12797696..9b236809bc 100644
--- a/frontend-modern/src/utils/pricingHandoff.ts
+++ b/frontend-modern/src/utils/pricingHandoff.ts
@@ -52,7 +52,6 @@ export const SELF_HOSTED_PRO_BILLING_PLAN_SELECTION_HREF = `${SELF_HOSTED_PRO_BI
const IN_PRODUCT_PRICING_DESTINATIONS: Record<string, string> = {
self_hosted_plan: SELF_HOSTED_PRO_BILLING_PLAN_SELECTION_HREF,
max_monitored_systems: SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF,
- trial_expired: SELF_HOSTED_PRO_BILLING_PLAN_HREF,
cloud: '/cloud',
// Paid self-hosted feature keys: route to the owned billing plan page instead
// of the Pulse Account purchase-start handoff, which fails for local instances
@@ -70,6 +69,8 @@ const IN_PRODUCT_PRICING_DESTINATIONS: Record<string, string> = {
long_term_metrics: SELF_HOSTED_PRO_BILLING_PLAN_HREF,
};
+const RETIRED_TRIAL_PRICING_FEATURES = new Set(['trial_expired']);
+
const INTERNAL_HREF_BASE = 'https://pulse.invalid';
function normalizeSettingsLikePath(pathname: string): string {
@@ -155,6 +156,11 @@ export function getInProductPricingDestination(
return IN_PRODUCT_PRICING_DESTINATIONS[normalizedFeature];
}
+export function isRetiredPricingFeature(feature: string | null | undefined): boolean {
+ const normalizedFeature = normalizeFeatureKey(feature);
+ return normalizedFeature ? RETIRED_TRIAL_PRICING_FEATURES.has(normalizedFeature) : false;
+}
+
export function getPublicPricingUrl(feature?: string | null): string {
const url = new URL(DEFAULT_PUBLIC_PRICING_URL);
const normalizedFeature = normalizeFeatureKey(feature);
@@ -164,7 +170,8 @@ export function getPublicPricingUrl(feature?: string | null): string {
return url.toString();
}
-export function getUpgradeFallbackDestination(feature?: string | null): string {
+export function getUpgradeFallbackDestination(feature?: string | null): string | undefined {
+ if (isRetiredPricingFeature(feature)) return undefined;
return getInProductPricingDestination(feature) || getSelfHostedPurchaseStartUrl(feature);
}
@@ -350,6 +357,10 @@ export function scopeSelfHostedBillingDestination(
export function getPricingRouteDestination(search: string): string {
const params = new URLSearchParams(search.startsWith('?') ? search.slice(1) : search);
const feature = params.get('feature');
+ if (isRetiredPricingFeature(feature)) {
+ return SELF_HOSTED_PRO_BILLING_PLAN_HREF;
+ }
+
const inProductDestination = getInProductPricingDestination(feature);
if (inProductDestination) {
return inProductDestination;