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.

Prove and document Pulse Account upgrade return

rcourtmanca7e9adc7d57
diff --git a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
index b98d2b1993..4e8eadbcac 100644
--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
@@ -427,8 +427,8 @@ Transition rule:
1. existing utility pages may remain as entry points or compatibility shims
2. new commercial/account workflows should prefer the Pulse Account shell
3. in-product self-hosted upgrade CTAs should hand off into `Pulse Account`
- billing first, even when plan comparison or checkout still continues on the
- public site as the next step
+ billing first, with `Pulse Account` owning self-hosted plan comparison and
+ checkout before returning through Pulse's activation callback
4. utility pages should shrink toward redirects or lightweight recovery
handoffs once equivalent Pulse Account areas exist
@@ -461,8 +461,12 @@ Accepted as sufficient for RC and GA:
1. Cloud/MSP control-plane portal exists
2. self-hosted recovery and billing utilities exist
3. in-product self-hosted upgrade surfaces may hand off into `Pulse Account`
- billing before the portal absorbs full purchase depth
-4. commercial surfaces are functional but fragmented
+ billing, with `Pulse Account` owning self-hosted plan comparison and
+ checkout for those arrivals
+4. purchase completion may return directly into Pulse billing activation
+ instead of requiring manual copy/paste of a newly issued license key
+5. commercial surfaces are functional but still fragmented outside the owned
+ checkout-return path
### Candidate lane target
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 1a9663062c..89f9a43e00 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -503,6 +503,12 @@ self-hosted upgrade arrivals: `/portal?service=upgrade&feature=...` may open a
portal-owned upgrade job inside `Billing`, but it must not fabricate broader
self-hosted commercial history or reveal retrieve/refund/privacy panels for a
hosted-only account that only arrived through an upgrade CTA.
+That same commercial contract now also includes the self-hosted purchase
+return path. Product-originated upgrade handoffs must include a canonical
+`return_url` that points back to Pulse's public `POST /auth/license-purchase-activate`
+callback, and that callback must redeem the completed checkout through the
+shared license/commercial API before redirecting the browser back to the
+owned billing plan route.
That same typed bootstrap/runtime contract must also derive the default signed-
in shell section from account shape: hosted accounts open on `Workspaces`,
self-hosted-only accounts open on `Billing`, and the signed-in shell keeps
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 39a83e4a8e..8adb959a51 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -412,11 +412,12 @@ The same commercial handoff rule also covers the legacy `/pricing` route in
product-owned destinations such as monitored-system billing or Cloud plans
inside the app, but self-hosted commercial upgrade intents now hand off to
`Pulse Account` first instead of treating the public pricing page as the app's
-canonical destination. The portal may continue the next step on the public
-self-hosted pricing site while the authenticated account shell is still
-absorbing new-purchase depth, but Pulse itself must not render a second public
-pricing surface inside the runtime or dump upgrade CTAs straight to marketing
-as though that were the product-owned commercial surface.
+canonical destination. `Pulse Account` now owns self-hosted plan comparison,
+checkout-session creation, and the purchase return handoff back into Pulse via
+`/auth/license-purchase-activate`; Pulse itself must not render a second
+public pricing surface inside the runtime, and the authenticated portal shell
+must not collapse back into a public-site-only waystation for new-purchase
+depth.
That destination split is canonical commercial truth, but navigation semantics
are not owned here. `frontend-modern/src/utils/pricingHandoff.ts` and
`frontend-modern/src/stores/license.ts` decide which href each commercial
@@ -592,8 +593,11 @@ router contract: `/settings/system/billing/plan` is the canonical plan state,
and `/settings/system/billing` remains a compatibility handoff rather than the
primary owned destination. Arrival-specific UI affordances belong to that same
owned billing surface: usage arrivals may open counting rules by default, and
-plan arrivals may surface an upgrade callout, but checkout still hands off to
-the public pricing surface rather than living inside the product runtime.
+plan arrivals may surface an upgrade callout that hands off into `Pulse Account`
+for self-hosted plan comparison and checkout before returning through the
+runtime-owned activation callback. Pulse product routes keep ownership of
+license status, usage, and activation state; `Pulse Account` owns the commerce
+flow itself.
That same ownership split is explicit in the governed registry as well:
`CommercialBillingSections.tsx` is part of the shared commercial shell/model
surface, while `SelfHostedCommercialActivationSection.tsx` stays on the
diff --git a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
index db1bd1d88d..72ff458ba8 100644
--- a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
+++ b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
@@ -31,6 +31,6 @@ export const SELF_HOSTED_PRO_BILLING_PRESENTATION: SelfHostedProBillingPresentat
usageSectionTitle: 'Usage',
monitoredSystemUpgradeArrivalTitle: 'Need a higher monitored-system cap?',
monitoredSystemUpgradeArrivalBody:
- 'Open Pulse Account to continue with self-hosted plan comparison and checkout, then activate the new Pulse Pro license key here once you purchase it.',
+ 'Open Pulse Account to compare self-hosted plans, complete checkout, and return here with Pulse Pro activated automatically.',
monitoredSystemUpgradeArrivalActionLabel: 'Compare plans',
};
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index c6e4688668..0db13e5c48 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "8296295bb975b67afbc4c6c7a19e1273fe505688feb0dfd6af629f73e5e5d00c",
+ "source_hash": "c7889cf007edcd132e614ad8c8629d58ec665987b748ea62e4e6589b7e5e4080",
"build_inputs": [
"package.json",
"tsconfig.json",
diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.js
index 3f69937fc1..92daf51f3d 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -1466,7 +1466,7 @@
} else if (checkoutResultState.status === "error") {
summaryItems.push('<div class="billing-status visible error">' + escapeText(checkoutResultState.error || "Could not confirm the completed checkout.") + "</div>");
} else if (result && result.status === "fulfilled") {
- var activationForm = returnURL && sessionID ? '<form method="POST" action="' + escapeAttribute(returnURL) + '"><input type="hidden" name="session_id" value="' + escapeAttribute(sessionID) + '"><input type="hidden" name="feature" value="' + escapeAttribute(featureKey) + '"><div class="form-actions"><button class="btn-primary" type="submit">Activate in Pulse Pro</button></div></form>' : '<div class="helper-text">Return to Pulse Pro billing, then use Pulse Account to retrieve the latest active license if automatic activation is unavailable.</div>';
+ var activationForm = returnURL && sessionID ? '<form method="POST" action="' + escapeAttribute(returnURL) + '"><input type="hidden" name="session_id" value="' + escapeAttribute(sessionID) + '"><input type="hidden" name="feature" value="' + escapeAttribute(featureKey) + '"><div class="form-actions"><button class="btn-primary" type="submit">Activate in Pulse Pro</button></div></form>' : '<div class="helper-text">Return to Pulse Pro billing to refresh the upgraded entitlement. If automatic activation is unavailable, Pulse Account can still retrieve the latest active license.</div>';
summaryItems.push(
'<div class="billing-result"><h4>Checkout complete</h4><div class="result-grid"><div><div class="result-meta-label">Plan</div><div class="result-meta-value">' + escapeText(result.tier || result.plan_key || "Purchased") + '</div></div><div><div class="result-meta-label">Purchase email</div><div class="result-meta-value">' + escapeText(result.owner_email || bootstrap.email || "") + '</div></div><div><div class="result-meta-label">Activation key</div><div class="result-meta-value">' + escapeText(result.activation_key_prefix || "Issued") + '</div></div><div><div class="result-meta-label">Monitored systems</div><div class="result-meta-value">' + escapeText(typeof result.max_monitored_systems === "number" && result.max_monitored_systems > 0 ? String(result.max_monitored_systems) : "Included") + "</div></div></div>" + activationForm + "</div>"
);
diff --git a/internal/cloudcp/portal/frontend/src/billing_view.test.ts b/internal/cloudcp/portal/frontend/src/billing_view.test.ts
index b5e4f2db8d..18e804c676 100644
--- a/internal/cloudcp/portal/frontend/src/billing_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/billing_view.test.ts
@@ -272,4 +272,26 @@ describe('services view', function() {
expect(document.getElementById('upgrade-billing-root')?.innerHTML).toContain('session_id');
expect(document.getElementById('upgrade-billing-root')?.innerHTML).toContain('ppk_live_preview');
});
+
+ it('renders a product-refresh fallback when a completed checkout has no return URL', function() {
+ document.body.innerHTML = '<div id="upgrade-billing-root"></div>';
+
+ var billingState = createPortalBillingState();
+ billingState.upgradeFeatureKey = 'max_monitored_systems';
+ billingState.upgradeCheckoutSessionID = 'cs_success';
+ billingState.upgradeCheckoutResult.status = 'ready';
+ billingState.upgradeCheckoutResult.data = {
+ status: 'fulfilled',
+ owner_email: '[email protected]',
+ tier: 'pro_plus',
+ activation_key_prefix: 'ppk_live_preview',
+ max_monitored_systems: 50,
+ };
+
+ renderUpgradePanel(billingState, createBootstrap());
+
+ expect(document.getElementById('upgrade-billing-root')?.innerHTML).toContain(
+ 'Return to Pulse Pro billing to refresh the upgraded entitlement.',
+ );
+ });
});
diff --git a/internal/cloudcp/portal/frontend/src/billing_view.ts b/internal/cloudcp/portal/frontend/src/billing_view.ts
index 18b67a8e46..8dd31fe6d1 100644
--- a/internal/cloudcp/portal/frontend/src/billing_view.ts
+++ b/internal/cloudcp/portal/frontend/src/billing_view.ts
@@ -186,7 +186,7 @@ export function renderUpgradePanel(billingState: PortalBillingState, bootstrap:
'</div>' +
'</form>'
)
- : '<div class="helper-text">Return to Pulse Pro billing, then use Pulse Account to retrieve the latest active license if automatic activation is unavailable.</div>';
+ : '<div class="helper-text">Return to Pulse Pro billing to refresh the upgraded entitlement. If automatic activation is unavailable, Pulse Account can still retrieve the latest active license.</div>';
summaryItems.push(
'<div class="billing-result">' +
'<h4>Checkout complete</h4>' +
diff --git a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
index 384966c3a4..eb51b8ca8f 100644
--- a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
+++ b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
@@ -142,7 +142,7 @@ test.describe('Monitored-system billing focus', () => {
await expect(page.getByText('Need a higher monitored-system cap?')).toBeVisible();
await expect(page.getByRole('link', { name: 'Compare plans' })).toHaveAttribute(
'href',
- 'https://pulserelay.pro/pricing?utm_source=pulse&utm_medium=app&utm_campaign=upgrade&feature=max_monitored_systems',
+ 'https://cloud.pulserelay.pro/portal?feature=max_monitored_systems&service=upgrade&return_url=http%3A%2F%2F127.0.0.1%3A5173%2Fauth%2Flicense-purchase-activate',
);
});
});
diff --git a/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts b/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts
new file mode 100644
index 0000000000..7e48450ff5
--- /dev/null
+++ b/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts
@@ -0,0 +1,200 @@
+import { test, expect, type BrowserContext, type Page, type Route } from '@playwright/test';
+
+const DEV_SERVER_URL = 'http://127.0.0.1:5173';
+const PULSE_ACCOUNT_PORTAL_URL = 'https://cloud.pulserelay.pro/portal';
+const PURCHASE_RETURN_URL = `${DEV_SERVER_URL}/auth/license-purchase-activate`;
+const ACTIVATED_BILLING_URL = `${DEV_SERVER_URL}/settings/system/billing/plan?intent=max_monitored_systems`;
+
+const MONITORED_SYSTEM_ENTITLEMENTS = {
+ capabilities: [],
+ limits: [{ key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' }],
+ subscription_state: 'expired',
+ upgrade_reasons: [],
+ tier: 'free',
+ trial_eligible: false,
+ hosted_mode: false,
+ legacy_connections: {
+ proxmox_nodes: 0,
+ docker_hosts: 0,
+ kubernetes_clusters: 0,
+ },
+ has_migration_gap: false,
+ overflow_days_remaining: 14,
+};
+
+const MONITORED_SYSTEM_LEDGER = {
+ systems: [
+ {
+ name: 'edge-cluster',
+ type: 'cluster',
+ status: 'warning',
+ status_explanation: {
+ summary:
+ 'At least one included source has a warning state, so Pulse keeps this monitored system under review.',
+ reasons: [],
+ },
+ latest_included_signal: {
+ name: 'edge-cluster',
+ type: 'cluster',
+ source: 'kubernetes',
+ at: '2026-04-07T09:00:00Z',
+ },
+ source: 'kubernetes',
+ explanation: {
+ summary:
+ 'Counts as one monitored system because Pulse merged multiple top-level views into one canonical cluster.',
+ reasons: [],
+ surfaces: [{ name: 'edge-cluster', type: 'cluster', source: 'kubernetes' }],
+ },
+ },
+ ],
+ total: 16,
+ limit: 5,
+};
+
+function fulfillJSON(route: Route, payload: unknown, status = 200) {
+ return route.fulfill({
+ status,
+ contentType: 'application/json',
+ body: JSON.stringify(payload),
+ });
+}
+
+function escapeAttribute(value: string): string {
+ return value
+ .replaceAll('&', '&amp;')
+ .replaceAll('"', '&quot;')
+ .replaceAll('<', '&lt;')
+ .replaceAll('>', '&gt;');
+}
+
+async function configureBillingFixtures(context: BrowserContext, page: Page) {
+ await page.addInitScript(() => {
+ localStorage.setItem('pulse_whats_new_v2_shown', 'true');
+ });
+
+ await context.route('**/api/security/status', async (route) => {
+ await fulfillJSON(route, {
+ hasAuthentication: true,
+ hideLocalLogin: false,
+ ssoProviders: [],
+ sessionCapabilities: {},
+ });
+ });
+
+ await context.route('**/api/state', async (route) => {
+ await fulfillJSON(route, { ok: true });
+ });
+
+ await context.route('**/api/system/settings', async (route) => {
+ await fulfillJSON(route, {
+ theme: 'system',
+ fullWidthMode: false,
+ });
+ });
+
+ await context.route('**/api/license/runtime-capabilities', async (route) => {
+ await fulfillJSON(route, {
+ capabilities: [],
+ limits: [{ key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' }],
+ hosted_mode: false,
+ max_history_days: 90,
+ });
+ });
+
+ await context.route('**/api/license/entitlements', async (route) => {
+ await fulfillJSON(route, MONITORED_SYSTEM_ENTITLEMENTS);
+ });
+
+ await context.route('**/api/license/monitored-system-ledger', async (route) => {
+ await fulfillJSON(route, MONITORED_SYSTEM_LEDGER);
+ });
+}
+
+async function openMonitoredSystemUpgradeArrival(page: Page) {
+ await page.goto(`${DEV_SERVER_URL}/settings/system-general`, {
+ waitUntil: 'domcontentloaded',
+ });
+ await expect(
+ page.getByRole('status').filter({ hasText: 'Monitored systems: 16/5' }),
+ ).toBeVisible();
+ await page
+ .getByRole('status')
+ .filter({ hasText: 'Monitored systems: 16/5' })
+ .getByRole('link', { name: 'Upgrade to add more' })
+ .click();
+ await page.waitForURL('**/settings/system/billing/plan?intent=max_monitored_systems');
+ await expect(page.getByRole('tab', { name: 'Plan' })).toHaveAttribute('aria-selected', 'true');
+}
+
+test.describe('Self-hosted upgrade return flow', () => {
+ test('returns from Pulse Account checkout into the owned billing plan route', async ({
+ page,
+ }, testInfo) => {
+ test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only billing continuity');
+
+ const context = page.context();
+ await configureBillingFixtures(context, page);
+
+ await context.route(`${PULSE_ACCOUNT_PORTAL_URL}**`, async (route) => {
+ const requestUrl = new URL(route.request().url());
+ expect(requestUrl.searchParams.get('feature')).toBe('max_monitored_systems');
+ expect(requestUrl.searchParams.get('service')).toBe('upgrade');
+ expect(requestUrl.searchParams.get('return_url')).toBe(PURCHASE_RETURN_URL);
+
+ await route.fulfill({
+ status: 200,
+ contentType: 'text/html',
+ body:
+ '<!doctype html><html><body>' +
+ '<h1>Pulse Account</h1>' +
+ '<p>Checkout complete.</p>' +
+ `<form method="POST" action="${escapeAttribute(PURCHASE_RETURN_URL)}">` +
+ '<input type="hidden" name="session_id" value="cs_upgrade_return">' +
+ '<input type="hidden" name="feature" value="max_monitored_systems">' +
+ '<button type="submit">Activate in Pulse Pro</button>' +
+ '</form>' +
+ '</body></html>',
+ });
+ });
+
+ await context.route(PURCHASE_RETURN_URL, async (route) => {
+ expect(route.request().method()).toBe('POST');
+ const formData = new URLSearchParams(route.request().postData() || '');
+ expect(formData.get('session_id')).toBe('cs_upgrade_return');
+ expect(formData.get('feature')).toBe('max_monitored_systems');
+ await route.fulfill({
+ status: 303,
+ headers: {
+ location: ACTIVATED_BILLING_URL,
+ },
+ body: '',
+ });
+ });
+
+ await openMonitoredSystemUpgradeArrival(page);
+
+ const comparePlansLink = page.getByRole('link', { name: 'Compare plans' });
+ await expect(comparePlansLink).toHaveAttribute(
+ 'href',
+ `${PULSE_ACCOUNT_PORTAL_URL}?feature=max_monitored_systems&service=upgrade&return_url=${encodeURIComponent(PURCHASE_RETURN_URL)}`,
+ );
+
+ const [popup] = await Promise.all([
+ page.waitForEvent('popup'),
+ comparePlansLink.click(),
+ ]);
+
+ await popup.waitForLoadState('domcontentloaded');
+ await expect(popup.getByRole('heading', { name: 'Pulse Account' })).toBeVisible();
+ await expect(popup.getByRole('button', { name: 'Activate in Pulse Pro' })).toBeVisible();
+
+ await popup.getByRole('button', { name: 'Activate in Pulse Pro' }).click();
+ await popup.waitForURL('**/settings/system/billing/plan?intent=max_monitored_systems');
+ await expect(popup.getByRole('heading', { name: 'Pulse Pro' }).first()).toBeVisible();
+ await expect(popup.getByRole('tab', { name: 'Plan' })).toHaveAttribute('aria-selected', 'true');
+
+ await expect(page).toHaveURL(/\/settings\/system\/billing\/plan\?intent=max_monitored_systems$/);
+ await popup.close();
+ });
+});