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 self-hosted trial start route

rcourtman0b52968cd07e
diff --git a/docs/operations/TRIAL_E2E_LXC_SNAPSHOT_RUNBOOK.md b/docs/operations/TRIAL_E2E_LXC_SNAPSHOT_RUNBOOK.md
index 2855ff6693..2f4a16aa68 100644
--- a/docs/operations/TRIAL_E2E_LXC_SNAPSHOT_RUNBOOK.md
+++ b/docs/operations/TRIAL_E2E_LXC_SNAPSHOT_RUNBOOK.md
@@ -78,10 +78,10 @@ Use:
This script asserts:
1. Login succeeds.
-2. Pre-trial entitlements are fetched and trial is eligible.
-3. `POST /api/license/trial/start` returns `409` with `trial_signup_required` and a hosted `action_url`.
-4. Post-initiation entitlements remain locally unactivated (`trial_eligible=true`, `subscription_state=expired`).
-5. Duplicate immediate trial starts stay on the hosted-signup retry burst until it is exhausted, then return `429 trial_rate_limited` plus `Retry-After` backoff metadata.
+2. Current entitlements can be fetched.
+3. `POST /api/license/trial/start` returns `404`, because ordinary self-hosted v6 runtimes no longer expose in-app trial acquisition.
+4. The retired route does not return legacy hosted-signup or trial-rate-limit acquisition payloads.
+5. Entitlements remain unchanged after the retired route probe.
Run inside container:
@@ -101,8 +101,8 @@ for i in 1 2 3; do
done
```
-If each run prints `PASS: hosted trial signup initiation contract validated`, state pollution between runs is eliminated.
-On a fresh rollback the probe should show `trial_start_code=409 (code=trial_signup_required)` first, then report which later duplicate attempt first hit the limiter via `retry_limiter_attempt=...` and `final_trial_start_code=429 (...)`.
+If each run prints `PASS: self-hosted trial-start route is retired`, state pollution between runs is eliminated.
+On a fresh rollback the probe should show `trial_start_code=404` and matching entitlement summaries before and after the route probe.
## Full Sandbox E2E (Playwright)
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 1a420ac9dc..70f5bb87a3 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
@@ -46,13 +46,11 @@ Companion drill:
`cd frontend-modern && npx vitest run src/pages/__tests__/HostedSignup.test.tsx src/components/Settings/__tests__/BillingAdminPanel.test.tsx`
`cd tests/integration && PULSE_E2E_USE_LOCAL_BACKEND=1 PULSE_E2E_SKIP_PLAYWRIGHT_INSTALL=1 npm test -- tests/07-trial-signup-return.spec.ts --project=chromium`
`cd tests/integration && PULSE_E2E_USE_LOCAL_BACKEND=1 PULSE_E2E_SKIP_PLAYWRIGHT_INSTALL=1 npm test -- tests/58-self-hosted-trial-rate-limit-ui.spec.ts --project=chromium`
- The self-hosted support/explicit-handoff proof must keep the canonical
- trial-start transport contract: `POST /api/license/trial/start` returns `409
- trial_signup_required` while the hosted-signup retry burst remains open, then
- transitions to `429 trial_rate_limited` plus `Retry-After` backoff once the
- limiter actually engages. Ordinary self-hosted runtime surfaces must still
- suppress trial prompts unless an explicit commercial handoff or entitlement
- state allows them.
+ The self-hosted proof must keep the retired trial-start transport contract:
+ `POST /api/license/trial/start` returns `404` on an ordinary self-hosted v6
+ runtime and does not mutate entitlements. Ordinary self-hosted runtime
+ surfaces must still suppress trial prompts; signed support handoffs may return
+ through `/auth/trial-activate` only.
- Live rehearsal helper:
`python3 scripts/release_control/hosted_signup_billing_replay_rehearsal.py --base-url <hosted-url> --signup-email <email> --org-name <org> ...`
- Manual scenario:
diff --git a/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md b/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md
index 68c0cbab05..a2277d70f4 100644
--- a/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md
+++ b/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md
@@ -418,14 +418,12 @@ Assertion design rules:
2. v6 GA is gated by `L1`, `L2`, `L3`, `L5`, `L6`, `L7`, `L8`, `L9`, `L10`,
`L11`, and `L12`. `L4` remains post-GA track work and is not a GA floor
gate.
-3. Trial authority for v6 is SaaS-controlled.
- `POST /api/license/trial/start` must initiate hosted signup only by
- returning `409 trial_signup_required` while the hosted-signup retry burst
- remains open, then `429 trial_rate_limited` plus `Retry-After` backoff once
- that limiter engages; the local runtime may redeem signed trial activations
- but must not mint local trial state directly. This transport is support-only
- or explicit-handoff plumbing for self-hosted v6 GA; ordinary self-hosted
- runtime surfaces must not promote trial entry.
+3. Trial acquisition is retired from ordinary self-hosted v6 GA.
+ `POST /api/license/trial/start` must not be registered as an in-app route
+ and must return `404` when probed on a normal self-hosted runtime. The local
+ runtime may redeem signed trial activations through `/auth/trial-activate`,
+ but it must not mint local trial state directly or prompt users into paid
+ trial entry from default self-hosted surfaces.
4. v5 to v6 commercial migration must preserve unresolved paid-license state
and downgrade safety.
5. Cloud and MSP Stripe `price_*` IDs are operational fill-in items, not
diff --git a/docs/release-control/v6/internal/V5_TO_V6_COMMERCIAL_MIGRATION_AUDIT_2026-03-07.md b/docs/release-control/v6/internal/V5_TO_V6_COMMERCIAL_MIGRATION_AUDIT_2026-03-07.md
index 2c0056e5f5..e29c27d154 100644
--- a/docs/release-control/v6/internal/V5_TO_V6_COMMERCIAL_MIGRATION_AUDIT_2026-03-07.md
+++ b/docs/release-control/v6/internal/V5_TO_V6_COMMERCIAL_MIGRATION_AUDIT_2026-03-07.md
@@ -11,8 +11,8 @@ Scope: Self-hosted v5 -> v6 commercial and licensing bridge in `pulse`
Locked v6 contract from those sources:
-1. Trial authority in v6 is SaaS-controlled. `POST /api/license/trial/start` must initiate hosted signup only by returning `409 trial_signup_required` while the hosted-signup retry burst remains open, then `429 trial_rate_limited` plus `Retry-After` backoff once the limiter engages.
-2. The local runtime may only redeem signed hosted trial activation tokens via `/auth/trial-activate`; it may not mint local trial state directly.
+1. Trial acquisition is retired from ordinary self-hosted v6 GA. `POST /api/license/trial/start` must not be registered as an in-app route and must return `404` on a normal self-hosted runtime.
+2. The local runtime may only redeem signed hosted trial activation tokens via `/auth/trial-activate`; it may not mint local trial state directly or prompt trial entry from default self-hosted surfaces.
3. v6 may auto-exchange persisted v5 Pro/Lifetime licenses on upgrade startup.
4. v6 may accept valid v5 Pro/Lifetime keys in the activation flow.
5. Paid Pulse Pro v5 recurring customers keep their existing recurring price after migration until they cancel; any return after cancellation uses current v6 pricing.
@@ -22,7 +22,7 @@ Locked v6 contract from those sources:
- Startup auto-exchange: `internal/api/licensing_handlers.go`, `internal/api/licensing_handlers_auto_migrate_test.go`
- Activation flow: `pkg/licensing/service.go`, `internal/api/license_handlers_test.go`, `pkg/licensing/service_activate_test.go`
- Entitlement payload + trial eligibility: `internal/api/subscription_entitlements.go`, `pkg/licensing/entitlement_payload.go`, `internal/api/entitlement_handlers_test.go`
-- Hosted trial start and callback: `internal/api/licensing_handlers.go`, `internal/api/trial_handlers_test.go`, `internal/api/hosted_lifecycle_integration_test.go`
+- Hosted trial activation callback: `internal/api/licensing_handlers.go`, `internal/api/hosted_lifecycle_integration_test.go`
- Upgrade UI messaging: `frontend-modern/src/components/Settings/ProLicensePanel.tsx`, `frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx`, `frontend-modern/src/stores/license.ts`
- Upgrade integration fixture: `tests/migration/v5_full_upgrade_test.go`
@@ -30,7 +30,7 @@ Locked v6 contract from those sources:
| Incoming v5 state | Starting persisted state | Expected v6 entitlement result | Expected UI state / message | User action required | Hosted service involved |
|---|---|---|---|---|---|
-| Fresh/free v5 install | No `license.enc`, no `activation.enc` | Free / expired entitlement only | Standard free-state upgrade UI; Pro trial CTA allowed | No | No |
+| Fresh/free v5 install | No `license.enc`, no `activation.enc` | Free / expired entitlement only | Standard free-state upgrade UI; no Pro trial CTA | No | No |
| Already on v6 activation model | `activation.enc` present, optional stale `license.enc` | Keep current v6 activation/grant; do not re-exchange legacy file | Active paid state with current plan details; no migration prompt | No | No at startup |
| Paid v5 Pro/Lifetime, exchange succeeds on startup | Valid v5 `license.enc`, no `activation.enc` | Auto-exchange into active v6 activation/grant; preserve grandfathered recurring-price identity and `plan_version`; keep legacy key on disk for downgrade fallback | Paid state is live immediately; if grandfathered, show migrated plan terms and legacy-price continuity | No | Yes, license exchange endpoint |
| Paid v5 Pro/Lifetime, exchange fails transiently | Valid v5 `license.enc`, no `activation.enc`, exchange unavailable/5xx/network | Do not silently collapse to ordinary free/trial-eligible state; mark migration as pending/blocked; preserve legacy key | Explicit migration-needed notice: paid v5 key detected, automatic exchange did not complete, retry activation from this instance; no new-trial CTA | Yes, retry activation or retrieve v6 activation key | Yes, exchange endpoint unavailable |
@@ -38,13 +38,12 @@ Locked v6 contract from those sources:
| Manual activation with valid v5 Pro/Lifetime key | User pastes v5 key into v6 panel | Exchange into active v6 activation/grant; persist activation state; preserve legacy key for downgrade fallback | Success message should make it clear the v5 key was migrated to v6 | Yes, one-time manual paste | Yes, exchange endpoint |
| Manual activation with invalid/expired/unsupported v5-like key | User pastes JWT-like legacy key into v6 panel | No entitlement change | Clear error message: not a valid v6 activation key or supported v5 Pro/Lifetime key | Yes | Yes, exchange endpoint |
-## Related hosted-trial flows after upgrade
+## Related hosted-trial activation flows after upgrade
-These are not incoming paid-license migration states, but they are part of the same commercial bridge and must stay coherent for upgraded v5 users.
+These are not incoming paid-license migration states, but signed support or hosted activation handoffs remain part of the same commercial bridge and must stay coherent for upgraded v5 users.
| Post-upgrade state | Starting persisted state | Expected v6 entitlement result | Expected UI state / message | User action required | Hosted service involved |
|---|---|---|---|---|---|
-| Free/eligible org starts v6 trial | No active paid state; no prior `trial_started_at` | No immediate local trial minting from `/api/license/trial/start`; response must redirect into hosted signup | User leaves Pulse for hosted signup | Yes | Yes, hosted signup |
| Hosted trial callback succeeds | Signed token + valid initiation token | Lease-backed trial entitlement becomes active; local billing state is lease cache only | `/settings/system-pro?trial=activated` notice and live trial countdown | No further action | Yes, hosted signup + lease redemption |
| Hosted trial callback invalid/replayed/unavailable/ineligible | Invalid or stale callback/token state | No new paid entitlement | Explicit result banner based on `trial` query (`invalid`, `replayed`, `unavailable`, `ineligible`) | Usually yes | Yes |
@@ -55,7 +54,7 @@ These are not incoming paid-license migration states, but they are part of the s
1. Startup auto-exchange exists for persisted legacy JWT-style licenses and preserves the old key for downgrade fallback.
2. Manual activation accepts v6 activation keys and also exchanges v5 JWT-style keys outside dev mode.
3. Migrated `plan_version` survives into `status` and `entitlements`, and the Pro panel renders migrated plan terms without repricing recurring v5 customers.
-4. `POST /api/license/trial/start` does not mint local trial state; it returns `409 trial_signup_required` with a hosted action URL while the retry burst remains open, then `429 trial_rate_limited` plus `Retry-After` once the limiter engages.
+4. `POST /api/license/trial/start` is no longer registered as an ordinary self-hosted in-app route, so the default runtime returns `404` instead of starting hosted signup.
5. `/auth/trial-activate` redeems a signed hosted token, stores lease-backed billing state, and redirects with an explicit result code.
### Highest-risk gaps
diff --git a/docs/release-control/v6/internal/records/rc-to-ga-promotion-readiness-blocked-2026-04-04.md b/docs/release-control/v6/internal/records/rc-to-ga-promotion-readiness-blocked-2026-04-04.md
index 2c18e0018e..5dd10a15f9 100644
--- a/docs/release-control/v6/internal/records/rc-to-ga-promotion-readiness-blocked-2026-04-04.md
+++ b/docs/release-control/v6/internal/records/rc-to-ga-promotion-readiness-blocked-2026-04-04.md
@@ -8,21 +8,24 @@
1. The latest shipped Pulse v6 prerelease tag is `v6.0.0-rc.2`.
2. That shipped prerelease tag resolves to commit `7b0bdebdff8127228708e84eb836cfd3d7214c08`.
-3. The governed release profile in `docs/release-control/control_plane.json`
+3. The selected remote ref `origin/pulse/v6-release` is still behind the current
+ local governed branch state, so `Release Dry Run` would exercise stale remote
+ control-plane metadata instead of the intended candidate.
+4. The governed release profile in `docs/release-control/control_plane.json`
currently declares both `prerelease_branch` and `stable_branch` as
`pulse/v6-release`.
-4. The active control-plane target is still `v6-product-lane-expansion`, not
+5. The active control-plane target is still `v6-product-lane-expansion`, not
`v6-ga-promotion`.
-5. The active local `pulse/v6-release` branch currently reports `VERSION=6.0.0`, so a
+6. The active local `pulse/v6-release` branch currently reports `VERSION=6.0.0`, so a
local GA candidate exists on the governed stable line.
-6. There is still no governed `Prerelease-to-GA Rehearsal Record` proving a successful
+7. There is still no governed `Prerelease-to-GA Rehearsal Record` proving a successful
non-publish `Release Dry Run` for the current `6.0.0` candidate.
-7. `docs/releases/RELEASE_NOTES_v6.md` and
+8. `docs/releases/RELEASE_NOTES_v6.md` and
`docs/release-control/v6/internal/V5_MAINTENANCE_SUPPORT_POLICY.md` now carry the
currently proposed exact dates for the eventual GA notice:
- `v6` GA date: `2026-04-20`
- `v5` end-of-support date: `2026-07-19`
-8. There is still no governed `Release Dry Run` artifact or rehearsal record
+9. There is still no governed `Release Dry Run` artifact or rehearsal record
exercising stable inputs for:
- `version=6.0.0`
- `promoted_from_tag=v6.0.0-rc.2`
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index a76521ea8e..345e0d97a9 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -497,6 +497,7 @@ the manifest's support-floor row.
1. New install or update continuity behavior hidden only inside broad monitoring ownership.
2. Agent profile or fleet-control behavior implemented outside the canonical agent settings/profile surfaces.
3. Installer or update flows that depend on branch-tip, dev-only, or non-release asset behavior for supported RC/stable paths.
+4. Lifecycle setup, install, or fleet surfaces that invoke retired self-hosted trial acquisition; `POST /api/license/trial/start` must stay closed on the ordinary self-hosted router, and approved support/hosted activation belongs to signed `/auth/trial-activate` rather than lifecycle-local CTAs.
## Completion Obligations
@@ -1630,11 +1631,13 @@ continuity, but `session_store.go` and `csrf_store.go` must immediately
rewrite hashed canonical persistence during load instead of leaving raw-token
files on the primary runtime path until a later save side effect happens to
run.
-That same shared `internal/api/` dependency also assumes local commercial-trial
-handoff remains human-usable: lifecycle-adjacent trial CTAs may allow a short
-burst of retries, but the backend contract must return the real remaining
-backoff through `Retry-After` plus `details.retry_after_seconds` so setup and
-install-adjacent surfaces do not drift into generic “try again later” behavior.
+That same shared `internal/api/` dependency also assumes ordinary self-hosted
+commercial-trial acquisition is retired: lifecycle-adjacent setup, install, and
+fleet surfaces must not expose direct trial CTAs or depend on
+`POST /api/license/trial/start`, and the normal router must fail that path as
+`404` without mutating entitlements. Approved support or hosted handoff remains
+owned by signed `/auth/trial-activate` redemption, not by lifecycle-local retry
+or backoff behavior.
That same shared `internal/api/` dependency also assumes session-carried OIDC
refresh tokens stay fail-closed at rest: `session_store.go` may only persist
or recover those tokens through encrypted-at-rest session payloads, and any
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 24057375d8..95148a13ba 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -674,14 +674,15 @@ the canonical monitored-system blocked payload.
`+git...` builds, and other unpublished prerelease identifiers must fail
closed on that API boundary instead of generating fake release URLs from
a local runtime version string.
-28. Keep local trial-start transport retired from normal self-hosted v6 GA
- frontend paths. `/api/license/trial/start` may remain available only as a
- legacy/support or externally initiated compatibility endpoint while existing
- purchase and activation flows migrate; browser API clients and ordinary
- self-hosted feature gates must not expose it as an in-app acquisition path.
- Hosted self-serve verification failures may render owned HTML, but they must
- preserve originating Pulse context instead of collapsing into generic
- control-plane failures.
+28. Keep local trial-start transport retired from self-hosted v6 GA runtime
+ paths. `POST /api/license/trial/start` must not be registered as an ordinary
+ in-app acquisition endpoint; browser API clients, route inventory, demo
+ mode, and feature gates must all treat it as absent. Signed hosted/support
+ handoffs may still return through `/auth/trial-activate`, but trial
+ acquisition must not start from the self-hosted app. Hosted self-serve
+ verification failures may render owned HTML, but they must preserve
+ originating Pulse context instead of collapsing into generic control-plane
+ failures.
29. Keep `/api/security/dev/reset-first-run` transport-backed and genuinely
unauthenticated: when the dev reset route clears first-run auth it must
also clear any env-backed auth state that feeds `/api/security/status`, so
@@ -2960,12 +2961,12 @@ security side: token settings changes must continue to carry the direct
`api-token-management-surface` API-contract proof together with the
security-side surface proof.
That same shared commercial API boundary now treats local trial-start transport
-as legacy/support compatibility, not a normal self-hosted v6 GA browser path.
-If `/api/license/trial/start` remains implemented for externally initiated
-activation or support flows, `internal/api/contract_test.go` may pin its
-compatibility behavior, but `frontend-modern/src/api/license.ts` and ordinary
-feature gates must not expose a start-trial client method or in-app CTA
-in the same slice as any handler change.
+as retired for normal self-hosted v6 GA. `POST /api/license/trial/start` must stay
+out of the router inventory and must not return the old hosted-signup or
+trial-rate-limit acquisition payloads from an ordinary self-hosted runtime;
+`frontend-modern/src/api/license.ts`, demo mode, and feature gates must not
+expose a start-trial client method or in-app CTA in the same slice as any
+handler change.
That same shared commercial API boundary also owns hosted self-serve failure
transport semantics. Hosted trial request and verification failures may render
owned HTML pages, but they must preserve the originating Pulse instance and
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 9ecaa22efb..7360220cfa 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -990,60 +990,21 @@ that decides whether that href stays in-app or opens externally. Commercial
surfaces must not re-infer that behavior locally with per-component
`target="_blank"` or `window.open(...)` branches once a feature can resolve to
either product-owned billing/cloud routes or the public pricing site.
-The trial-start rate-limit contract is part of that same boundary. Local
-`/api/license/trial/start` retries are allowed as a short human-scale burst so
-operators can revisit the hosted handoff without getting locked out for a day,
-and both the local app server and hosted trial signup limiters must return the
-actual remaining backoff through `Retry-After` and
-`details.retry_after_seconds` rather than a coarse full-window guess. Shared
-trial-start presentation must treat that backoff as canonical and surface it
-consistently instead of flattening every `429` into generic copy.
-That proof must stay aligned in browser and shell coverage too:
-`tests/integration/tests/07-trial-signup-return.spec.ts` and
-`tests/integration/scripts/trial-signup-contract.sh` must treat duplicate
-starts inside the allowed burst as the same hosted-signup redirect contract and
-only require `trial_rate_limited` plus backoff metadata once the limiter
-actually engages, rather than assuming the second attempt is already denied.
-`tests/integration/tests/58-self-hosted-trial-rate-limit-ui.spec.ts` must then
-prove the rendered Pulse Pro CTA on `/settings/system/billing` surfaces the
-same canonical `Retry-After` backoff when the backend returns
-`trial_rate_limited`, including header precedence over a conflicting
-`details.retry_after_seconds` payload.
-That proof split is also intentional: the browser spec may attach to a reused
-local instance whose retry bucket is already exhausted and therefore must
-accept an immediate canonical `429` backoff response, while the snapshot-clean
-shell probe remains the fresh-state contract that proves an initial hosted
-redirect and the later transition into `trial_rate_limited`.
-Operator docs must describe that same split. The snapshot-clean runbook in
-`docs/operations/TRIAL_E2E_LXC_SNAPSHOT_RUNBOOK.md` may require the first trial
-start to return `409 trial_signup_required` on a rolled-back container, but it
-must describe duplicate attempts as staying on the hosted-signup retry burst
-until exhaustion rather than teaching a universal "second attempt is `429`"
-rule.
-That active-doc hygiene is guarded directly in
-`scripts/tests/test-trial-signup-docs.sh`: it auto-discovers every tracked
-trial-start reference across `docs/` and `tests/integration/`, requires the
-operator/pricing/upgrade/integration surfaces to keep the hosted-only /
-retry-burst story aligned, and rejects the obsolete 24-hour or automatic
-second-attempt phrasing anywhere in that tracked reference set. The integration
-README now carries the same `POST /api/license/trial/start`,
-`trial_signup_required`, and `trial_rate_limited` anchors as the other
-operator-facing docs so it stays inside the discovered set instead of relying
-on a special-case assertion path. The `trial-signup` entry in
-`tests/integration/evals/scenarios.json` must now carry those same anchors too,
-so eval-pack metadata cannot silently drift away from the canonical hosted
-handoff contract while the task file stays correct. The release-control
-high-risk verification matrix must carry those same anchors for the
-`tests/07-trial-signup-return.spec.ts` transport proof and the
-`tests/58-self-hosted-trial-rate-limit-ui.spec.ts` Pulse Pro CTA proof, so the
-RC packet cannot describe trial-start verification through an unanchored
-summary path. The
-canonical release-control summaries in `docs/release-control/v6/internal/
-SOURCE_OF_TRUTH.md` and
-`docs/release-control/v6/internal/V5_TO_V6_COMMERCIAL_MIGRATION_AUDIT_2026-03-07.md`
-must carry that same explicit `409 trial_signup_required` to `429
-trial_rate_limited` plus `Retry-After` transition, so the governing release
-packet cannot collapse the hosted handoff into a vague "hosted-only" statement.
+The self-hosted trial-start boundary is now retired for ordinary v6 GA
+runtimes. Local `POST /api/license/trial/start` must not be registered as an
+in-app acquisition route, and it must not return the old
+hosted-signup or trial-rate-limit payloads from a normal self-hosted instance.
+Signed activation handoffs may still return through
+`/auth/trial-activate`, but the user must not be prompted into a paid trial
+from the self-hosted app. Browser and shell coverage now guard that retired
+boundary: `tests/integration/tests/07-trial-signup-return.spec.ts` and
+`tests/integration/scripts/trial-signup-contract.sh` must expect `404` from the
+retired route and prove entitlements remain unchanged. The paid-prompt browser
+proof in `tests/integration/tests/58-self-hosted-trial-rate-limit-ui.spec.ts`
+must keep trial CTAs and paid-only navigation out of the default self-hosted UI.
+`scripts/tests/test-trial-signup-docs.sh` guards the same documentation posture
+so active operator docs and eval metadata describe the retired route instead of
+the old hosted-signup acquisition contract.
Hosted tenant organization seeding and hosted handoff role mapping now belong
to the same cloud-paid truth too. `internal/cloudcp/stripe/provisioner.go`
must seed tenant org members from the shared account-role-to-organization-role
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index a3c2ebbdce..caf64def15 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -839,23 +839,18 @@ browser helper must treat `PLAYWRIGHT_BASE_URL` as the browser truth and leave
`PULSE_BASE_URL` available for backend-oriented health checks and setup
traffic, so split browser/backend proof can target fresh frontend code without
rewiring the API-side contract.
-That same integration-README ownership includes the local commercial trial
-probe guidance. The snapshot-clean trial instructions for
-`tests/integration/scripts/trial-signup-contract.sh` must describe duplicate
-local `/api/license/trial/start` requests as staying on the hosted-signup
-redirect contract until the configured retry burst is exhausted; they may only
-teach `429 trial_rate_limited` plus `Retry-After` backoff once the limiter
-actually engages, rather than claiming the second duplicate attempt is always
-rate limited. The reused-instance browser-proof entry in
-`tests/integration/README.md` must carry those same canonical anchors by name:
-`POST /api/license/trial/start`, `409 trial_signup_required`, `429
-trial_rate_limited`, and `Retry-After`, so the shared trial-start docs guard
-can auto-discover that README alongside the rest of the governed trial-start
-surface instead of relying on README-only fallback checks. That README must
-also keep the named Pulse Pro browser proof,
-`tests/58-self-hosted-trial-rate-limit-ui.spec.ts`, on the owned trial-start
-surface so the user-facing retry-after proof does not drift into an orphaned
-integration spec. The eval-pack metadata in
+That same integration-README ownership includes the retired local commercial
+trial probe guidance. The snapshot-clean trial instructions for
+`tests/integration/scripts/trial-signup-contract.sh` must describe
+`POST /api/license/trial/start` as retired in ordinary self-hosted v6 and must
+expect `404` plus unchanged entitlements. The reused-instance browser-proof
+entry in `tests/integration/README.md` must carry that same retired-route
+posture, so the shared trial-start docs guard can auto-discover that README
+alongside the rest of the governed trial-start surface instead of relying on
+README-only fallback checks. That README must also keep the named Pulse Pro
+browser proof, `tests/58-self-hosted-trial-rate-limit-ui.spec.ts`, on the
+owned paid-prompt surface so the user-facing no-trial-CTA proof does not drift
+into an orphaned integration spec. The eval-pack metadata in
`tests/integration/evals/scenarios.json` must carry those same anchors for the
`trial-signup` scenario description, so deterministic and agentic trial runs
inherit the same canonical contract wording instead of teaching a drifted
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index f14e76e7c9..4fa722197e 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -506,6 +506,7 @@ querying, and the operator-facing storage health presentation layer.
17. Letting recovery-event focus leak as hidden state on the protected inventory surface; switching back to protected items must clear event-only `rollupId` and `day` context, and protected-item drill-ins must open recovery events without preserving an invisible day filter that can make valid history look empty.
18. Letting the recovery details panel lead with transport-shaped payloads; operator-facing details must summarize outcome, artifact, target, restore readiness, and readable metadata labels first, while raw JSON and provider-specific keys stay behind an explicitly technical disclosure.
19. Letting recovery posture summaries become passive counters only; summary-card actions may focus events, stale inventory, or attention inventory, but those actions must route through the canonical recovery workspace and route-state owner instead of mutating local-only filter state.
+20. Letting storage or recovery surfaces invoke retired self-hosted trial acquisition; `POST /api/license/trial/start` must stay closed on the ordinary self-hosted router, and storage/recovery-adjacent billing or support handoffs must not treat trial activation as recovery identity, restore proof, or backup transport state.
## Completion Obligations
@@ -1891,10 +1892,12 @@ continuity, but `session_store.go` and `csrf_store.go` must immediately
rewrite hashed canonical persistence on load so adjacent storage and recovery
transport does not keep running against primary-path raw-token files.
That same shared `internal/api/` dependency also assumes customer-visible
-commercial retry guidance stays canonical when storage- or recovery-adjacent
-surfaces invoke trial or billing handoffs: the backend must return the real
-remaining backoff through `Retry-After` and `details.retry_after_seconds`
-instead of leaving neighboring surfaces to guess or hardcode retry windows.
+commercial acquisition stays out of storage and recovery surfaces by default:
+storage- or recovery-adjacent flows must not invoke or advertise the retired
+`POST /api/license/trial/start` route, and the normal self-hosted router must
+return `404` for that path without mutating entitlements. Approved support or
+hosted handoff remains owned by signed `/auth/trial-activate` redemption, not by
+storage/recovery-local retry or backoff behavior.
That same shared `internal/api/` dependency now also assumes adjacent
commercial helper surfaces speak in monitored-system terms: recovery- or
storage-adjacent API wiring may consume the canonical monitored-system ledger
diff --git a/internal/api/backend_conversion_events_test.go b/internal/api/backend_conversion_events_test.go
index 963103b7f9..3454742d8e 100644
--- a/internal/api/backend_conversion_events_test.go
+++ b/internal/api/backend_conversion_events_test.go
@@ -42,41 +42,6 @@ func queryAllEvents(t *testing.T, store *pkglicensing.ConversionStore, orgID str
// --- LicenseHandlers.emitConversionEvent tests ---
-func TestLicenseHandlersEmitConversionEvent_CheckoutStartedViaHandleStartTrial(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{PublicURL: "https://pulse.example.com"})
-
- rec, store := newTestRecorderWithStore(t, baseDir)
- health := pkglicensing.NewPipelineHealth()
- h.SetConversionRecorder(rec, health)
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- w := httptest.NewRecorder()
- h.HandleStartTrial(w, req)
-
- if w.Code != http.StatusConflict {
- t.Fatalf("HandleStartTrial status=%d, want %d: %s", w.Code, http.StatusConflict, w.Body.String())
- }
-
- events := queryAllEvents(t, store, "default")
- found := false
- for _, e := range events {
- if e.EventType == pkglicensing.EventCheckoutStarted && e.Surface == "license_api" {
- found = true
- break
- }
- }
- if !found {
- t.Fatalf("expected checkout_started event with surface=license_api in store, got %d events: %+v", len(events), events)
- }
-
- if hs := health.CheckHealth(); hs.EventsTotal < 1 {
- t.Fatalf("pipeline health events_total=%d, want >=1", hs.EventsTotal)
- }
-}
-
func TestLicenseHandlersEmitConversionEvent_ActivationFailedOnBadKey(t *testing.T) {
baseDir := t.TempDir()
mtp := config.NewMultiTenantPersistence(baseDir)
@@ -114,52 +79,6 @@ func TestLicenseHandlersEmitConversionEvent_ActivationFailedOnBadKey(t *testing.
}
}
-func TestLicenseHandlersEmitConversionEvent_RespectsDisableFlag(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- cfg := &config.Config{
- DisableLocalUpgradeMetrics: true,
- PublicURL: "https://pulse.example.com",
- }
- h := NewLicenseHandlers(mtp, false, cfg)
-
- rec, store := newTestRecorderWithStore(t, baseDir)
- h.SetConversionRecorder(rec, pkglicensing.NewPipelineHealth())
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- w := httptest.NewRecorder()
- h.HandleStartTrial(w, req)
-
- if w.Code != http.StatusConflict {
- t.Fatalf("HandleStartTrial status=%d, want %d: %s", w.Code, http.StatusConflict, w.Body.String())
- }
-
- events := queryAllEvents(t, store, "default")
- for _, e := range events {
- if e.EventType == pkglicensing.EventCheckoutStarted {
- t.Fatalf("expected no checkout_started event when DisableLocalUpgradeMetrics=true, but found one: %+v", e)
- }
- }
-}
-
-func TestLicenseHandlersEmitConversionEvent_NilRecorderDoesNotPanic(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{PublicURL: "https://pulse.example.com"})
- // Deliberately NOT setting a conversion recorder.
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- w := httptest.NewRecorder()
- h.HandleStartTrial(w, req)
-
- if w.Code != http.StatusConflict {
- t.Fatalf("HandleStartTrial status=%d, want %d: %s", w.Code, http.StatusConflict, w.Body.String())
- }
- // No panic — success.
-}
-
func TestLicenseHandlersEmitConversionEvent_LicenseActivatedDirectEmit(t *testing.T) {
baseDir := t.TempDir()
mtp := config.NewMultiTenantPersistence(baseDir)
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index f4231124da..5daf2688a0 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -2349,129 +2349,6 @@ func TestContract_HostedSignupResponseJSONSnapshot(t *testing.T) {
assertJSONSnapshot(t, got, want)
}
-func TestContract_TrialStartHostedSignupRedirectContract(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{
- PublicURL: "https://pulse.example.com",
- ProTrialSignupURL: "https://billing.example.com/start-pro-trial?source=contract",
- })
-
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(
- context.WithValue(context.Background(), OrgIDContextKey, "default"),
- )
- rec := httptest.NewRecorder()
- h.HandleStartTrial(rec, req)
-
- if rec.Code != http.StatusConflict {
- t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusConflict, rec.Body.String())
- }
-
- var payload APIError
- if err := json.NewDecoder(rec.Body).Decode(&payload); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if payload.Code != "trial_signup_required" {
- t.Fatalf("code=%q, want %q", payload.Code, "trial_signup_required")
- }
- if strings.TrimSpace(payload.Details["action_url"]) == "" {
- t.Fatal("expected action_url in contract payload")
- }
-}
-
-func TestContract_TrialStartRejectsInsecureNonLoopbackCallbackURL(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{
- ProTrialSignupURL: "https://billing.example.com/start-pro-trial?source=contract",
- })
-
- req := httptest.NewRequest(
- http.MethodPost,
- "http://192.168.1.25:7655/api/license/trial/start",
- nil,
- ).WithContext(context.WithValue(context.Background(), OrgIDContextKey, "default"))
- req.Host = "192.168.1.25:7655"
- req.RemoteAddr = "192.168.1.50:54321"
- rec := httptest.NewRecorder()
- h.HandleStartTrial(rec, req)
-
- if rec.Code != http.StatusServiceUnavailable {
- t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusServiceUnavailable, rec.Body.String())
- }
-
- var payload APIError
- if err := json.NewDecoder(rec.Body).Decode(&payload); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- payload = payload.NormalizeCollections()
- got, err := json.Marshal(struct {
- StatusCode int `json:"status_code"`
- Code string `json:"code"`
- Error string `json:"error"`
- Details map[string]string `json:"details"`
- }{
- StatusCode: payload.StatusCode,
- Code: payload.Code,
- Error: payload.ErrorMessage,
- Details: payload.Details,
- })
- if err != nil {
- t.Fatalf("marshal payload snapshot: %v", err)
- }
-
- const want = `{
- "status_code":503,
- "code":"trial_signup_unavailable",
- "error":"Hosted trial signup is unavailable",
- "details":{}
- }`
-
- assertJSONSnapshot(t, got, want)
-}
-
-func TestContract_TrialStartRateLimitContract(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{
- PublicURL: "https://pulse.example.com",
- ProTrialSignupURL: "https://billing.example.com/start-pro-trial?source=contract",
- })
- h.trialLimiter = NewRateLimiter(1, time.Minute)
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
-
- firstReq := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- firstRec := httptest.NewRecorder()
- h.HandleStartTrial(firstRec, firstReq)
- if firstRec.Code != http.StatusConflict {
- t.Fatalf("first status=%d, want %d: %s", firstRec.Code, http.StatusConflict, firstRec.Body.String())
- }
-
- secondReq := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- secondRec := httptest.NewRecorder()
- h.HandleStartTrial(secondRec, secondReq)
- if secondRec.Code != http.StatusTooManyRequests {
- t.Fatalf("second status=%d, want %d: %s", secondRec.Code, http.StatusTooManyRequests, secondRec.Body.String())
- }
-
- retryAfter := secondRec.Header().Get("Retry-After")
- if retryAfter == "" {
- t.Fatal("expected Retry-After header")
- }
-
- var payload APIError
- if err := json.NewDecoder(secondRec.Body).Decode(&payload); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if payload.Code != "trial_rate_limited" {
- t.Fatalf("code=%q, want %q", payload.Code, "trial_rate_limited")
- }
- if payload.Details["retry_after_seconds"] != retryAfter {
- t.Fatalf("retry_after_seconds=%q, want %q", payload.Details["retry_after_seconds"], retryAfter)
- }
-}
-
func TestContract_BillingStateQuickstartJSONSnapshot(t *testing.T) {
grantedAt := time.Date(2026, 3, 25, 14, 30, 0, 0, time.UTC).Unix()
@@ -5604,7 +5481,7 @@ func TestContract_SelfHostedCommunityEntitlementsJSONSnapshot(t *testing.T) {
{"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":"ai_autofix","reason":"Upgrade to Pro so Pulse can move from finding issues to applying safe remediation with your approval or in autonomous mode.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=ai_autofix"},
+ {"key":"ai_autofix","reason":"Upgrade to Pro so Pulse can move from finding issues to governed remediation with your approval or autonomy policy.","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 alerts arrive with root-cause analysis instead of 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"},
{"key":"agent_profiles","reason":"Upgrade to Pro to standardize agent behavior across systems without reconfiguring every install by hand.","action_url":"https://pulserelay.pro/pricing?utm_source=pulse\u0026utm_medium=app\u0026utm_campaign=upgrade\u0026feature=agent_profiles"},
@@ -6671,7 +6548,6 @@ func TestContract_DemoModeCommercialSurfacePolicy(t *testing.T) {
{method: http.MethodGet, path: "/api/license/entitlements"},
{method: http.MethodPost, path: "/api/license/activate"},
{method: http.MethodPost, path: "/api/license/clear"},
- {method: http.MethodPost, path: "/api/license/trial/start"},
{method: http.MethodGet, path: "/api/license/monitored-system-ledger"},
{method: http.MethodPost, path: "/api/license/monitored-system-ledger/explain"},
{method: http.MethodPost, path: "/api/license/monitored-system-ledger/preview"},
diff --git a/internal/api/demo_mode_commercial.go b/internal/api/demo_mode_commercial.go
index e58b3bc04f..3d985dcd00 100644
--- a/internal/api/demo_mode_commercial.go
+++ b/internal/api/demo_mode_commercial.go
@@ -53,11 +53,6 @@ var publicDemoCommercialPolicies = []publicDemoCommercialRoutePolicy{
exposure: publicDemoCommercialExposureHidden,
matches: exactDemoCommercialMethodPath(http.MethodGet, "/api/license/entitlements"),
},
- {
- route: "POST /api/license/trial/start",
- exposure: publicDemoCommercialExposureHidden,
- matches: exactDemoCommercialMethodPath(http.MethodPost, "/api/license/trial/start"),
- },
{
route: "GET /api/license/monitored-system-ledger",
exposure: publicDemoCommercialExposureHidden,
diff --git a/internal/api/licensing_handlers.go b/internal/api/licensing_handlers.go
index 0397b141d1..8989af5118 100644
--- a/internal/api/licensing_handlers.go
+++ b/internal/api/licensing_handlers.go
@@ -11,7 +11,6 @@ import (
"net/http"
"net/url"
"os"
- "strconv"
"strings"
"sync"
"time"
@@ -25,8 +24,6 @@ import (
)
const (
- trialStartRateLimitBurst = 6
- trialStartRateLimitWindow = 15 * time.Minute
licensePurchaseStartPath = "/auth/license-purchase-start"
licensePurchaseActivationPath = "/auth/license-purchase-activate"
licensePurchaseSessionIDField = "session_id"
@@ -62,7 +59,6 @@ type LicenseHandlers struct {
hostedMode bool
cfg *config.Config
services sync.Map // map[string]*licenseService
- trialLimiter *RateLimiter
trialReplay *jtiReplayStore
purchaseReturnRedemptions *purchaseReturnRedemptionStore
trialInitiations *trialSignupInitiationStore
@@ -97,7 +93,6 @@ func NewLicenseHandlers(mtp *config.MultiTenantPersistence, hostedMode bool, cfg
mtPersistence: mtp,
hostedMode: hostedMode,
cfg: cfg,
- trialLimiter: NewRateLimiter(trialStartRateLimitBurst, trialStartRateLimitWindow),
trialReplay: trialReplay,
purchaseReturnRedemptions: purchaseReturnRedemptions,
trialInitiations: trialInitiations,
@@ -237,14 +232,6 @@ func securePublicCallbackBaseURLForRequest(r *http.Request, cfg *config.Config)
return strings.TrimRight(parsed.String(), "/")
}
-func trialCallbackURLForRequest(r *http.Request, cfg *config.Config) string {
- baseURL := securePublicCallbackBaseURLForRequest(r, cfg)
- if baseURL == "" {
- return ""
- }
- return baseURL + "/auth/trial-activate"
-}
-
func licensePurchaseCallbackURLForRequest(r *http.Request, cfg *config.Config) string {
baseURL := securePublicCallbackBaseURLForRequest(r, cfg)
if baseURL == "" {
@@ -283,30 +270,6 @@ func parseHostedCommercialURL(raw string) (*url.URL, error) {
return parsed, nil
}
-func trialSignupActionURLForRequest(cfg *config.Config, orgID, returnURL, instanceToken string) (string, error) {
- signupBaseURL := ""
- if cfg != nil {
- signupBaseURL = strings.TrimSpace(cfg.ProTrialSignupURL)
- }
- signupURL := strings.TrimSpace(proTrialSignupURLFromLicensing(signupBaseURL))
- if signupURL == "" {
- return "", fmt.Errorf("trial signup URL is unavailable")
- }
-
- parsed, err := parseHostedCommercialURL(signupURL)
- if err != nil {
- return "", fmt.Errorf("parse trial signup URL: %w", err)
- }
-
- query := parsed.Query()
- query.Set("org_id", strings.TrimSpace(orgID))
- query.Set("return_url", strings.TrimSpace(returnURL))
- query.Set("instance_token", strings.TrimSpace(instanceToken))
- parsed.RawQuery = query.Encode()
-
- return parsed.String(), nil
-}
-
func (h *LicenseHandlers) purchaseReturnDataDir() string {
if h == nil {
return ""
@@ -896,98 +859,6 @@ func (h *LicenseHandlers) FeatureService(ctx context.Context) licenseFeatureChec
return h.Service(ctx)
}
-// HandleStartTrial handles POST /api/license/trial/start.
-// SaaS trials are initiated through hosted signup; the local instance only redeems
-// a signed activation token via /auth/trial-activate.
-func (h *LicenseHandlers) HandleStartTrial(w http.ResponseWriter, r *http.Request) {
- if r.Method != http.MethodPost {
- http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
- return
- }
- if h == nil || h.mtPersistence == nil {
- writeErrorResponse(w, http.StatusInternalServerError, "trial_start_unavailable", "Trial start is unavailable", nil)
- return
- }
-
- orgID := GetOrgID(r.Context())
- if orgID == "" {
- orgID = "default"
- }
-
- svc, _, err := h.getTenantComponents(r.Context())
- if err != nil {
- writeErrorResponse(w, http.StatusInternalServerError, "tenant_error", "Failed to resolve tenant", nil)
- return
- }
-
- billingStore := config.NewFileBillingStore(h.mtPersistence.BaseDataDir())
- existing, err := billingStore.GetBillingState(orgID)
- if err != nil {
- writeErrorResponse(w, http.StatusInternalServerError, "billing_state_load_failed", "Failed to load billing state", nil)
- return
- }
- decision := evaluateTrialStartEligibilityFromLicensing(svc.Current() != nil && svc.IsValid(), existing)
- if !decision.Allowed {
- code, message, includeOrgID := trialStartErrorFromLicensing(decision.Reason)
- details := map[string]string(nil)
- if includeOrgID {
- details = map[string]string{"org_id": orgID}
- }
- writeErrorResponse(w, http.StatusConflict, code, message, details)
- return
- }
-
- if h.trialLimiter != nil {
- allowed, retryDelay := h.trialLimiter.allowAt(orgID, time.Now().UTC())
- if !allowed {
- retryAfterSeconds := int(retryDelay.Round(time.Second).Seconds())
- if retryAfterSeconds < 1 {
- retryAfterSeconds = 1
- }
- w.Header().Set("Retry-After", strconv.Itoa(retryAfterSeconds))
- writeErrorResponse(w, http.StatusTooManyRequests, "trial_rate_limited", "Trial start rate limit exceeded", map[string]string{
- "org_id": orgID,
- "retry_after_seconds": strconv.Itoa(retryAfterSeconds),
- })
- return
- }
- }
-
- if h.trialInitiations == nil {
- writeErrorResponse(w, http.StatusServiceUnavailable, "trial_signup_unavailable", "Hosted trial signup is unavailable", nil)
- return
- }
- returnURL := trialCallbackURLForRequest(r, h.cfg)
- if returnURL == "" {
- log.Error().Str("org_id", orgID).Msg("Trial callback URL unavailable for initiation")
- writeErrorResponse(w, http.StatusServiceUnavailable, "trial_signup_unavailable", "Hosted trial signup is unavailable", nil)
- return
- }
- instanceToken, err := h.trialInitiations.issue(orgID, returnURL, time.Now().UTC().Add(trialSignupInitiationTTL))
- if err != nil {
- log.Error().Err(err).Str("org_id", orgID).Msg("Trial signup initiation token unavailable")
- writeErrorResponse(w, http.StatusServiceUnavailable, "trial_signup_unavailable", "Hosted trial signup is unavailable", nil)
- return
- }
-
- actionURL, err := trialSignupActionURLForRequest(h.cfg, orgID, returnURL, instanceToken)
- if err != nil {
- log.Error().Err(err).Str("org_id", orgID).Msg("Trial signup redirect unavailable")
- writeErrorResponse(w, http.StatusServiceUnavailable, "trial_signup_unavailable", "Hosted trial signup is unavailable", nil)
- return
- }
-
- h.emitConversionEvent(orgID, conversionEvent{
- Type: conversionEventCheckoutStarted,
- Surface: "license_api",
- })
-
- writeErrorResponse(w, http.StatusConflict, "trial_signup_required", "Complete hosted signup to start your trial", map[string]string{
- "org_id": orgID,
- "action_url": actionURL,
- })
-}
-
// HandleTrialActivation handles GET /auth/trial-activate.
// It verifies a hosted signup trial activation token, blocks replay, persists a
// signed hosted entitlement lease, then redirects to Settings.
diff --git a/internal/api/route_inventory_test.go b/internal/api/route_inventory_test.go
index ae4446c10c..9dce9a3e10 100644
--- a/internal/api/route_inventory_test.go
+++ b/internal/api/route_inventory_test.go
@@ -463,7 +463,6 @@ var allRouteAllowlist = []string{
"GET /api/license/runtime-capabilities",
"GET /api/license/commercial-posture",
"GET /api/license/entitlements",
- "POST /api/license/trial/start",
"GET /api/license/monitored-system-ledger",
"POST /api/license/monitored-system-ledger/explain",
"POST /api/license/monitored-system-ledger/preview",
diff --git a/internal/api/router_routes_licensing.go b/internal/api/router_routes_licensing.go
index 9ebd60084c..84e6c3eaef 100644
--- a/internal/api/router_routes_licensing.go
+++ b/internal/api/router_routes_licensing.go
@@ -43,7 +43,6 @@ func (r *Router) registerOrgLicenseRoutesGroup(orgHandlers *OrgHandlers, rbacHan
r.mux.HandleFunc("GET /api/license/monitored-system-ledger", RequireAuth(r.config, r.handleMonitoredSystemLedger))
r.mux.HandleFunc("POST /api/license/monitored-system-ledger/explain", RequireAuth(r.config, r.handleMonitoredSystemLedgerExplain))
r.mux.HandleFunc("POST /api/license/monitored-system-ledger/preview", RequireAuth(r.config, r.handleMonitoredSystemLedgerPreview))
- r.mux.HandleFunc("POST /api/license/trial/start", RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.licenseHandlers.HandleStartTrial)))
// Local-only commercial handoff events (legacy route names retain "upgrade-metrics" for compatibility).
// These are local-only signals used to debug explicit paid-plan handoffs; no external export.
diff --git a/internal/api/security_regression_test.go b/internal/api/security_regression_test.go
index 4368ebfba0..9fb2193ee7 100644
--- a/internal/api/security_regression_test.go
+++ b/internal/api/security_regression_test.go
@@ -3528,7 +3528,6 @@ func TestPrivilegedSecurityEndpointsRejectNonAdminSession(t *testing.T) {
{method: http.MethodGet, path: "/api/diagnostics", body: ``},
{method: http.MethodGet, path: "/api/diagnostics/docker/prepare-token", body: ``},
{method: http.MethodGet, path: "/api/license/status", body: ``},
- {method: http.MethodPost, path: "/api/license/trial/start", body: `{}`},
{method: http.MethodGet, path: "/api/updates/check", body: ``},
{method: http.MethodGet, path: "/api/updates/status", body: ``},
{method: http.MethodGet, path: "/api/updates/plan", body: ``},
diff --git a/internal/api/trial_handlers_commercial_migration_test.go b/internal/api/trial_handlers_commercial_migration_test.go
deleted file mode 100644
index af97ca13af..0000000000
--- a/internal/api/trial_handlers_commercial_migration_test.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package api
-
-import (
- "context"
- "encoding/json"
- "net/http"
- "net/http/httptest"
- "testing"
-
- "github.com/rcourtman/pulse-go-rewrite/internal/config"
- "github.com/rcourtman/pulse-go-rewrite/internal/license/entitlements"
- pkglicensing "github.com/rcourtman/pulse-go-rewrite/pkg/licensing"
-)
-
-func TestTrialStart_RejectsUnresolvedCommercialMigration(t *testing.T) {
- tests := []struct {
- name string
- migration *pkglicensing.CommercialMigrationStatus
- wantMessage string
- }{
- {
- name: "pending",
- migration: &pkglicensing.CommercialMigrationStatus{
- Source: pkglicensing.CommercialMigrationSourceV5License,
- State: pkglicensing.CommercialMigrationStatePending,
- Reason: pkglicensing.CommercialMigrationReasonExchangeUnavailable,
- RecommendedAction: pkglicensing.CommercialMigrationActionRetryActivation,
- },
- wantMessage: "Trial cannot be started while a paid v5 license migration is pending",
- },
- {
- name: "failed",
- migration: &pkglicensing.CommercialMigrationStatus{
- Source: pkglicensing.CommercialMigrationSourceV5License,
- State: pkglicensing.CommercialMigrationStateFailed,
- Reason: pkglicensing.CommercialMigrationReasonExchangeInvalid,
- RecommendedAction: pkglicensing.CommercialMigrationActionUseV6Activation,
- },
- wantMessage: "Trial cannot be started until the paid v5 license migration is resolved",
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{PublicURL: "https://pulse.example.com"})
-
- orgID := "default"
- store := config.NewFileBillingStore(baseDir)
- if err := store.SaveBillingState(orgID, &entitlements.BillingState{
- Capabilities: []string{},
- Limits: map[string]int64{},
- MetersEnabled: []string{},
- PlanVersion: "free",
- SubscriptionState: entitlements.SubStateExpired,
- CommercialMigration: tt.migration,
- }); err != nil {
- t.Fatalf("SaveBillingState: %v", err)
- }
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, orgID)
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- rec := httptest.NewRecorder()
- h.HandleStartTrial(rec, req)
-
- if rec.Code != http.StatusConflict {
- t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusConflict, rec.Body.String())
- }
-
- var resp APIError
- if err := json.NewDecoder(rec.Body).Decode(&resp); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if resp.Code != "trial_not_available" {
- t.Fatalf("code=%q, want %q", resp.Code, "trial_not_available")
- }
- if resp.ErrorMessage != tt.wantMessage {
- t.Fatalf("message=%q, want %q", resp.ErrorMessage, tt.wantMessage)
- }
- if len(resp.Details) != 0 {
- t.Fatalf("details=%v, want empty", resp.Details)
- }
- })
- }
-}
diff --git a/internal/api/trial_handlers_test.go b/internal/api/trial_handlers_test.go
index e85033c4b1..fcbd2ade0a 100644
--- a/internal/api/trial_handlers_test.go
+++ b/internal/api/trial_handlers_test.go
@@ -75,224 +75,18 @@ func issueTrialRedemptionResponse(t *testing.T, priv ed25519.PrivateKey, orgID,
}
}
-func TestTrialStart_DefaultOrgReturnsHostedSignupRedirect(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{
- PublicURL: "https://pulse.example.com",
- ProTrialSignupURL: "https://billing.example.com/start-pro-trial?source=test",
- })
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
-
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- rec := httptest.NewRecorder()
- h.HandleStartTrial(rec, req)
- if rec.Code != http.StatusConflict {
- t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusConflict, rec.Body.String())
- }
-
- var resp APIError
- if err := json.NewDecoder(rec.Body).Decode(&resp); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if resp.Code != "trial_signup_required" {
- t.Fatalf("code=%q, want %q", resp.Code, "trial_signup_required")
- }
- actionURL := resp.Details["action_url"]
- if actionURL == "" {
- t.Fatal("expected action_url in trial signup response")
- }
- parsed, err := url.Parse(actionURL)
- if err != nil {
- t.Fatalf("parse action_url: %v", err)
- }
- if got := parsed.Scheme + "://" + parsed.Host + parsed.Path; got != "https://billing.example.com/start-pro-trial" {
- t.Fatalf("action_url base=%q, want %q", got, "https://billing.example.com/start-pro-trial")
- }
- if got := parsed.Query().Get("source"); got != "test" {
- t.Fatalf("action_url source=%q, want %q", got, "test")
- }
- if got := parsed.Query().Get("org_id"); got != "default" {
- t.Fatalf("action_url org_id=%q, want %q", got, "default")
- }
- if got := parsed.Query().Get("return_url"); got != "https://pulse.example.com/auth/trial-activate" {
- t.Fatalf("action_url return_url=%q, want %q", got, "https://pulse.example.com/auth/trial-activate")
- }
- if got := strings.TrimSpace(parsed.Query().Get("instance_token")); got == "" {
- t.Fatal("expected instance_token in action_url")
- }
-
- billingPath := filepath.Join(baseDir, "billing.json")
- if _, err := os.Stat(billingPath); !os.IsNotExist(err) {
- t.Fatalf("expected no billing.json to be written, stat err=%v", err)
- }
-}
-
-func TestTrialStart_AllowsRepeatHostedSignupRedirectsWithinBurstWindow(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{
- PublicURL: "https://pulse.example.com",
- ProTrialSignupURL: "https://billing.example.com/start-pro-trial?source=test",
- })
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
-
- for i := 0; i < 2; i++ {
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- rec := httptest.NewRecorder()
- h.HandleStartTrial(rec, req)
- if rec.Code != http.StatusConflict {
- t.Fatalf("attempt %d status=%d, want %d: %s", i+1, rec.Code, http.StatusConflict, rec.Body.String())
- }
-
- var resp APIError
- if err := json.NewDecoder(rec.Body).Decode(&resp); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if resp.Code != "trial_signup_required" {
- t.Fatalf("attempt %d code=%q, want %q", i+1, resp.Code, "trial_signup_required")
- }
- if strings.TrimSpace(resp.Details["action_url"]) == "" {
- t.Fatalf("attempt %d missing action_url", i+1)
- }
- }
-}
-
-func TestTrialStart_FailsClosedWithoutCallbackURL(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{
- ProTrialSignupURL: "https://billing.example.com/start-pro-trial",
- })
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- req.Host = ""
- rec := httptest.NewRecorder()
- h.HandleStartTrial(rec, req)
-
- if rec.Code != http.StatusServiceUnavailable {
- t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusServiceUnavailable, rec.Body.String())
- }
-
- var resp APIError
- if err := json.NewDecoder(rec.Body).Decode(&resp); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if resp.Code != "trial_signup_unavailable" {
- t.Fatalf("code=%q, want %q", resp.Code, "trial_signup_unavailable")
- }
-}
-
-func TestTrialStart_FailsClosedOnInsecureNonLoopbackCallbackURL(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{
- ProTrialSignupURL: "https://billing.example.com/start-pro-trial",
- })
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
- req := httptest.NewRequest(http.MethodPost, "http://192.168.1.25:7655/api/license/trial/start", nil).WithContext(ctx)
- req.Host = "192.168.1.25:7655"
- req.RemoteAddr = "192.168.1.50:54321"
- rec := httptest.NewRecorder()
- h.HandleStartTrial(rec, req)
-
- if rec.Code != http.StatusServiceUnavailable {
- t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusServiceUnavailable, rec.Body.String())
- }
-
- var resp APIError
- if err := json.NewDecoder(rec.Body).Decode(&resp); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if resp.Code != "trial_signup_unavailable" {
- t.Fatalf("code=%q, want %q", resp.Code, "trial_signup_unavailable")
- }
-}
-
-func TestTrialStart_RejectsAlreadyUsedTrial(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{PublicURL: "https://pulse.example.com"})
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
- now := time.Now()
- startedAt := now.Add(-2 * time.Hour).Unix()
- endsAt := now.Add(12 * time.Hour).Unix()
- store := config.NewFileBillingStore(baseDir)
- if err := store.SaveBillingState("default", &entitlements.BillingState{
- Capabilities: append([]string(nil), license.TierFeatures[license.TierPro]...),
- Limits: map[string]int64{},
- MetersEnabled: []string{},
- PlanVersion: "trial",
- SubscriptionState: entitlements.SubStateTrial,
- TrialStartedAt: &startedAt,
- TrialEndsAt: &endsAt,
- }); err != nil {
- t.Fatalf("SaveBillingState: %v", err)
- }
+func TestTrialStartRoute_RetiredFromSelfHostedRouter(t *testing.T) {
+ rawToken := "trial-start-retired-token-123.12345678"
+ record := newTokenRecord(t, rawToken, []string{config.ScopeSettingsWrite}, nil)
+ router := NewRouter(newTestConfigWithTokens(t, record), nil, nil, nil, nil, "1.0.0")
- req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
+ req := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil)
+ req.Header.Set("X-API-Token", rawToken)
rec := httptest.NewRecorder()
- h.HandleStartTrial(rec, req)
- if rec.Code != http.StatusConflict {
- t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusConflict, rec.Body.String())
- }
-
- var resp APIError
- if err := json.NewDecoder(rec.Body).Decode(&resp); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if resp.Code != "trial_already_used" {
- t.Fatalf("code=%q, want %q", resp.Code, "trial_already_used")
- }
-}
-
-func TestTrialStart_ReturnsRetryAfterWhenRateLimited(t *testing.T) {
- baseDir := t.TempDir()
- mtp := config.NewMultiTenantPersistence(baseDir)
- h := NewLicenseHandlers(mtp, false, &config.Config{
- PublicURL: "https://pulse.example.com",
- ProTrialSignupURL: "https://billing.example.com/start-pro-trial?source=test",
- })
- h.trialLimiter = NewRateLimiter(1, time.Minute)
-
- ctx := context.WithValue(context.Background(), OrgIDContextKey, "default")
+ router.Handler().ServeHTTP(rec, req)
- firstReq := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- firstRec := httptest.NewRecorder()
- h.HandleStartTrial(firstRec, firstReq)
- if firstRec.Code != http.StatusConflict {
- t.Fatalf("first status=%d, want %d: %s", firstRec.Code, http.StatusConflict, firstRec.Body.String())
- }
-
- secondReq := httptest.NewRequest(http.MethodPost, "/api/license/trial/start", nil).WithContext(ctx)
- secondRec := httptest.NewRecorder()
- h.HandleStartTrial(secondRec, secondReq)
- if secondRec.Code != http.StatusTooManyRequests {
- t.Fatalf("second status=%d, want %d: %s", secondRec.Code, http.StatusTooManyRequests, secondRec.Body.String())
- }
-
- retryAfter := secondRec.Header().Get("Retry-After")
- if retryAfter == "" {
- t.Fatal("expected Retry-After header")
- }
- if got := secondRec.Header().Get("Content-Type"); !strings.Contains(got, "application/json") {
- t.Fatalf("content-type=%q, want JSON response", got)
- }
-
- var resp APIError
- if err := json.NewDecoder(secondRec.Body).Decode(&resp); err != nil {
- t.Fatalf("decode response: %v", err)
- }
- if resp.Code != "trial_rate_limited" {
- t.Fatalf("code=%q, want %q", resp.Code, "trial_rate_limited")
- }
- if resp.Details["retry_after_seconds"] != retryAfter {
- t.Fatalf("retry_after_seconds=%q, want %q", resp.Details["retry_after_seconds"], retryAfter)
+ if rec.Code != http.StatusNotFound {
+ t.Fatalf("status=%d, want %d: %s", rec.Code, http.StatusNotFound, rec.Body.String())
}
}
diff --git a/scripts/release_control/internal/hosted_signup_billing_replay_rehearsal.py b/scripts/release_control/internal/hosted_signup_billing_replay_rehearsal.py
index 302cfe1237..3f5fee2abb 100644
--- a/scripts/release_control/internal/hosted_signup_billing_replay_rehearsal.py
+++ b/scripts/release_control/internal/hosted_signup_billing_replay_rehearsal.py
@@ -46,7 +46,7 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
parser.add_argument("--cookie", help="Optional Cookie header for admin checks")
parser.add_argument(
"--expected-checkout-base",
- help="Optional prefix expected for trial-start redirect action_url",
+ help="Deprecated; retained for old command lines. Self-hosted trial start is retired.",
)
parser.add_argument(
"--billing-org-id",
@@ -232,10 +232,10 @@ def check_fail_closed(args: argparse.Namespace) -> CheckResult:
)
-def check_trial_start_redirect(args: argparse.Namespace, auth_headers: dict[str, str]) -> CheckResult:
+def check_retired_self_hosted_trial_start(args: argparse.Namespace, auth_headers: dict[str, str]) -> CheckResult:
if not auth_headers:
return CheckResult(
- name="self-hosted-trial-redirect-to-hosted",
+ name="self-hosted-trial-start-retired",
ok=False,
detail="authenticated admin credentials are required for this check",
)
@@ -246,48 +246,23 @@ def check_trial_start_redirect(args: argparse.Namespace, auth_headers: dict[str,
headers=auth_headers,
json_body={},
)
- if status != 409:
+ if status != 404:
return CheckResult(
- name="self-hosted-trial-redirect-to-hosted",
+ name="self-hosted-trial-start-retired",
ok=False,
- detail=f"status={status}, expected 409",
+ detail=f"status={status}, expected 404",
)
code = str(payload.get("code", "")).strip()
- if code != "trial_signup_required":
+ if code in {"trial_signup_required", "trial_rate_limited"}:
return CheckResult(
- name="self-hosted-trial-redirect-to-hosted",
+ name="self-hosted-trial-start-retired",
ok=False,
- detail=f"code={code!r}, expected 'trial_signup_required'",
- )
- details = payload.get("details")
- if not isinstance(details, dict):
- return CheckResult(
- name="self-hosted-trial-redirect-to-hosted",
- ok=False,
- detail="missing details.action_url in response",
- )
- action_url = str(details.get("action_url", "")).strip()
- if not action_url:
- return CheckResult(
- name="self-hosted-trial-redirect-to-hosted",
- ok=False,
- detail="details.action_url was empty",
- )
- if args.expected_checkout_base and not action_url.startswith(args.expected_checkout_base):
- return CheckResult(
- name="self-hosted-trial-redirect-to-hosted",
- ok=False,
- detail=f"action_url={action_url!r} did not start with {args.expected_checkout_base!r}",
+ detail=f"retired route returned legacy acquisition code={code!r}",
)
return CheckResult(
- name="self-hosted-trial-redirect-to-hosted",
+ name="self-hosted-trial-start-retired",
ok=True,
- detail=(
- "returned hosted handoff action_url="
- f"{action_url}; this rehearsal covers the `409 trial_signup_required` "
- "branch only, while the later `429 trial_rate_limited` plus "
- "`Retry-After` branch stays owned by the local trial-start proofs"
- ),
+ detail="ordinary self-hosted trial-start route returned 404 without legacy acquisition payload",
)
@@ -470,8 +445,8 @@ def run_rehearsal(args: argparse.Namespace) -> list[CheckResult]:
if auth_headers:
results.append(
safe_check(
- "self-hosted-trial-redirect-to-hosted",
- lambda: check_trial_start_redirect(args, auth_headers),
+ "self-hosted-trial-start-retired",
+ lambda: check_retired_self_hosted_trial_start(args, auth_headers),
)
)
diff --git a/scripts/release_control/internal/hosted_signup_billing_replay_rehearsal_test.py b/scripts/release_control/internal/hosted_signup_billing_replay_rehearsal_test.py
index 05501542ad..d1aecb5f26 100644
--- a/scripts/release_control/internal/hosted_signup_billing_replay_rehearsal_test.py
+++ b/scripts/release_control/internal/hosted_signup_billing_replay_rehearsal_test.py
@@ -42,8 +42,6 @@ class HostedSignupBillingReplayRehearsalTest(unittest.TestCase):
"Pulse Labs",
"--api-token",
"token",
- "--expected-checkout-base",
- "https://billing.example.com/start-pro-trial",
"--prelink-webhook-payload-file",
str(prelink_path),
"--prelink-webhook-secret",
@@ -61,10 +59,7 @@ class HostedSignupBillingReplayRehearsalTest(unittest.TestCase):
if url == "https://pulse-bad.example.com/api/public/signup":
return 503, {"code": "public_url_missing"}
if url == "https://pulse.example.com/api/license/trial/start":
- return 409, {
- "code": "trial_signup_required",
- "details": {"action_url": "https://billing.example.com/start-pro-trial?org_id=default"},
- }
+ return 404, {"error": "not found"}
if url == "https://pulse.example.com/api/public/signup":
return 201, {
"org_id": "org-123",
@@ -91,10 +86,8 @@ class HostedSignupBillingReplayRehearsalTest(unittest.TestCase):
results = mod.run_rehearsal(args)
self.assertTrue(all(result.ok for result in results), [r.detail for r in results])
- redirect_result = next(result for result in results if result.name == "self-hosted-trial-redirect-to-hosted")
- self.assertIn("trial_signup_required", redirect_result.detail)
- self.assertIn("trial_rate_limited", redirect_result.detail)
- self.assertIn("Retry-After", redirect_result.detail)
+ retired_result = next(result for result in results if result.name == "self-hosted-trial-start-retired")
+ self.assertIn("returned 404", retired_result.detail)
trial_headers = next(headers for _method, url, headers in fetch_json_calls if url.endswith("/api/license/trial/start"))
self.assertEqual(trial_headers["X-API-Token"], "token")
webhook_headers = next(headers for _method, url, headers, _body in fetch_calls if url.endswith("/api/stripe/webhook"))
@@ -110,10 +103,7 @@ class HostedSignupBillingReplayRehearsalTest(unittest.TestCase):
def fake_fetch_json(method: str, url: str, **kwargs):
nonlocal billing_state_calls
if url.endswith("/api/license/trial/start"):
- return 409, {
- "code": "trial_signup_required",
- "details": {"action_url": "https://billing.example.com/start-pro-trial?org_id=default"},
- }
+ return 404, {"error": "not found"}
if url.endswith("/api/public/signup"):
return 201, {
"org_id": "org-123",
diff --git a/scripts/tests/test-hot-dev-bg.sh b/scripts/tests/test-hot-dev-bg.sh
index 73c9979342..45261696e6 100755
--- a/scripts/tests/test-hot-dev-bg.sh
+++ b/scripts/tests/test-hot-dev-bg.sh
@@ -756,7 +756,7 @@ test_integration_readme_uses_managed_backend_restart_wrapper() {
assert_not_contains "integration readme no longer documents raw backend restart script" "${output}" "./scripts/hot-dev-bg.sh backend-restart"
}
-test_integration_readme_documents_trial_retry_burst_contract() {
+test_integration_readme_documents_retired_trial_start_contract() {
local output
output="$(
awk '
@@ -769,25 +769,24 @@ test_integration_readme_documents_trial_retry_burst_contract() {
)"
assert_contains "integration readme names trial-start route" "${output}" "POST /api/license/trial/start"
- assert_contains "integration readme names hosted-signup redirect code" "${output}" "409 trial_signup_required"
- assert_contains "integration readme names rate-limited code" "${output}" "429 trial_rate_limited"
- assert_contains "integration readme documents hosted-signup retry burst" "${output}" "retry-burst"
- assert_contains "integration readme documents retry contract wording" "${output}" "contract:"
- assert_contains "integration readme keeps hosted-signup wording" "${output}" "hosted-signup"
- assert_contains "integration readme documents retry burst exhaustion" "${output}" "retry burst is exhausted"
- assert_contains "integration readme documents retry-after backoff" "${output}" "Retry-After"
- assert_contains "integration readme references hosted trial probe script" "${output}" "tests/integration/scripts/trial-signup-contract.sh"
- assert_contains "integration readme references pulse pro retry-after ui proof" "${output}" "tests/58-self-hosted-trial-rate-limit-ui.spec.ts"
+ assert_contains "integration readme documents retired route status" "${output}" "404"
+ assert_contains "integration readme documents unchanged entitlements" "${output}" "without mutating entitlements"
+ assert_contains "integration readme references retired trial probe script" "${output}" "tests/integration/scripts/trial-signup-contract.sh"
+ assert_contains "integration readme references paid prompt proof" "${output}" "tests/58-self-hosted-trial-rate-limit-ui.spec.ts"
+ assert_contains "integration readme documents no trial CTAs" "${output}" "trial CTAs"
+ assert_not_contains "integration readme no longer documents hosted-signup redirect code" "${output}" "409 trial_signup_required"
+ assert_not_contains "integration readme no longer documents trial rate limit code" "${output}" "429 trial_rate_limited"
}
-test_integration_eval_scenario_documents_trial_retry_burst_contract() {
+test_integration_eval_scenario_documents_retired_trial_start_contract() {
local output
output="$(sed -n '24,34p' "${INTEGRATION_EVAL_SCENARIOS}")"
assert_contains "integration eval scenario names trial-start route" "${output}" "POST /api/license/trial/start"
- assert_contains "integration eval scenario names hosted-signup redirect code" "${output}" "409 trial_signup_required"
- assert_contains "integration eval scenario names rate-limited code" "${output}" "429 trial_rate_limited"
- assert_contains "integration eval scenario names retry-after metadata" "${output}" "Retry-After"
+ assert_contains "integration eval scenario names retired route status" "${output}" "404"
+ assert_contains "integration eval scenario documents entitlement preservation" "${output}" "preserves local entitlements"
+ assert_not_contains "integration eval scenario no longer names hosted-signup redirect code" "${output}" "409 trial_signup_required"
+ assert_not_contains "integration eval scenario no longer names rate-limited code" "${output}" "429 trial_rate_limited"
}
test_integration_quick_start_distinguishes_embedded_frontend_from_hot_dev() {
@@ -1184,7 +1183,8 @@ main() {
test_hot_dev_bg_script_advertises_managed_entrypoint
test_hot_dev_bg_usage_prefers_managed_wrappers
test_integration_readme_uses_managed_backend_restart_wrapper
- test_integration_readme_documents_trial_retry_burst_contract
+ test_integration_readme_documents_retired_trial_start_contract
+ test_integration_eval_scenario_documents_retired_trial_start_contract
test_integration_quick_start_distinguishes_embedded_frontend_from_hot_dev
test_acceptance_doc_distinguishes_embedded_frontend_from_hot_dev
test_playwright_defaults_prefer_managed_hot_dev_runtime
diff --git a/scripts/tests/test-trial-signup-docs.sh b/scripts/tests/test-trial-signup-docs.sh
index 71a965d1ef..962fb64699 100755
--- a/scripts/tests/test-trial-signup-docs.sh
+++ b/scripts/tests/test-trial-signup-docs.sh
@@ -3,36 +3,36 @@ set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
RUNBOOK="${ROOT_DIR}/docs/operations/TRIAL_E2E_LXC_SNAPSHOT_RUNBOOK.md"
-PRICING_DOC="${ROOT_DIR}/docs/architecture/v6-pricing-and-tiering.md"
UPGRADE_DOC="${ROOT_DIR}/docs/UPGRADE_v6.md"
INTEGRATION_README="${ROOT_DIR}/tests/integration/README.md"
EVAL_TASK_DOC="${ROOT_DIR}/tests/integration/evals/tasks/trial-signup.md"
EVAL_SCENARIOS_DOC="${ROOT_DIR}/tests/integration/evals/scenarios.json"
SOURCE_OF_TRUTH_DOC="${ROOT_DIR}/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md"
-MIGRATION_AUDIT_DOC="${ROOT_DIR}/docs/release-control/v6/internal/V5_TO_V6_COMMERCIAL_MIGRATION_AUDIT_2026-03-07.md"
HIGH_RISK_MATRIX_DOC="${ROOT_DIR}/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md"
API_CONTRACTS_DOC="${ROOT_DIR}/docs/release-control/v6/internal/subsystems/api-contracts.md"
+CLOUD_PAID_DOC="${ROOT_DIR}/docs/release-control/v6/internal/subsystems/cloud-paid.md"
+AGENT_LIFECYCLE_DOC="${ROOT_DIR}/docs/release-control/v6/internal/subsystems/agent-lifecycle.md"
+STORAGE_RECOVERY_DOC="${ROOT_DIR}/docs/release-control/v6/internal/subsystems/storage-recovery.md"
+
+FORBIDDEN_ACTIVE_PATTERNS=(
+ "trial_signup_required"
+ "trial_rate_limited"
+ "hosted-signup retry burst"
+ "hosted-signup retry-burst"
+ "Start hosted Pro trial initiation"
+)
-TRIAL_SIGNUP_REFERENCE_PATTERN='(/api/license/trial/start|trial_signup_required|trial_rate_limited)'
-
-REQUIRED_CONTRACT_DOCS=(
+RETIRED_CONTRACT_DOCS=(
"${RUNBOOK}"
- "${PRICING_DOC}"
- "${UPGRADE_DOC}"
"${INTEGRATION_README}"
"${EVAL_TASK_DOC}"
"${EVAL_SCENARIOS_DOC}"
+ "${SOURCE_OF_TRUTH_DOC}"
"${HIGH_RISK_MATRIX_DOC}"
"${API_CONTRACTS_DOC}"
-)
-
-TRACKED_REFERENCE_DOCS=()
-
-FORBIDDEN_PATTERNS=(
- "1 trial initiation attempt per org per 24 hours"
- "1 initiation attempt per org per 24h"
- "A second immediate initiation attempt is rate limited."
- "Second immediate trial start is rejected with \`429\`"
+ "${CLOUD_PAID_DOC}"
+ "${AGENT_LIFECYCLE_DOC}"
+ "${STORAGE_RECOVERY_DOC}"
)
failures=0
@@ -46,29 +46,6 @@ record_pass() {
echo "[PASS] $1"
}
-discover_tracked_reference_docs() {
- local discovered_doc
- local tracked_doc
-
- TRACKED_REFERENCE_DOCS=()
- while IFS= read -r discovered_doc; do
- TRACKED_REFERENCE_DOCS+=("${ROOT_DIR}/${discovered_doc}")
- done < <(
- while IFS= read -r tracked_doc; do
- if rg -q "${TRIAL_SIGNUP_REFERENCE_PATTERN}" "${ROOT_DIR}/${tracked_doc}"; then
- printf '%s\n' "${tracked_doc}"
- fi
- done < <(git -C "${ROOT_DIR}" ls-files docs tests/integration)
- )
-
- if (( ${#TRACKED_REFERENCE_DOCS[@]} == 0 )); then
- record_failure "discovered tracked trial-start reference files"
- echo "Expected tracked trial-start reference docs/tests from tracked worktree discovery." >&2
- else
- record_pass "discovered tracked trial-start reference files (${#TRACKED_REFERENCE_DOCS[@]})"
- fi
-}
-
assert_contains() {
local label="$1"
local haystack="$2"
@@ -93,152 +70,45 @@ assert_not_contains() {
fi
}
-assert_doc_discovered() {
+assert_file_contains() {
local label="$1"
- local doc="$2"
- local candidate
- for candidate in "${TRACKED_REFERENCE_DOCS[@]}"; do
- if [[ "${candidate}" == "${doc}" ]]; then
- record_pass "${label}"
- return
- fi
- done
- record_failure "${label}"
- echo "Expected discovered reference set to include: ${doc#${ROOT_DIR}/}" >&2
+ local file="$2"
+ local needle="$3"
+ assert_contains "${label}" "$(cat "${file}")" "${needle}"
}
-assert_forbidden_patterns_absent() {
- local doc file_content needle label
-
- for doc in "${TRACKED_REFERENCE_DOCS[@]}"; do
- file_content="$(cat "${doc}")"
- for needle in "${FORBIDDEN_PATTERNS[@]}"; do
- label="${doc#${ROOT_DIR}/} excludes stale pattern: ${needle}"
- assert_not_contains "${label}" "${file_content}" "${needle}"
- done
- done
+assert_file_not_contains() {
+ local label="$1"
+ local file="$2"
+ local needle="$3"
+ assert_not_contains "${label}" "$(cat "${file}")" "${needle}"
}
main() {
- local runbook_output pricing_output upgrade_output integration_output eval_task_output
- local eval_scenarios_output high_risk_matrix_output api_contracts_output
- local source_of_truth_output migration_audit_output
- local contract_doc
-
- discover_tracked_reference_docs
+ local doc pattern
- assert_doc_discovered "source of truth is in tracked reference discovery" "${SOURCE_OF_TRUTH_DOC}"
- assert_doc_discovered "migration audit is in tracked reference discovery" "${MIGRATION_AUDIT_DOC}"
- for contract_doc in "${REQUIRED_CONTRACT_DOCS[@]}"; do
- assert_doc_discovered "${contract_doc#${ROOT_DIR}/} is in tracked reference discovery" "${contract_doc}"
+ for doc in "${RETIRED_CONTRACT_DOCS[@]}"; do
+ assert_file_contains "${doc#${ROOT_DIR}/} documents retired trial-start route" "${doc}" "POST /api/license/trial/start"
+ assert_file_contains "${doc#${ROOT_DIR}/} documents HTTP 404 retired route behavior" "${doc}" "404"
done
- runbook_output="$(
- awk '
- /^## Contract Probe Script$/ { capture=1 }
- capture { print }
- /^## Full Sandbox E2E \(Playwright\)$/ { exit }
- ' "${RUNBOOK}"
- )"
- pricing_output="$(
- sed -n '368,386p' "${PRICING_DOC}"
- )"
- upgrade_output="$(
- sed -n '112,128p' "${UPGRADE_DOC}"
- )"
- integration_output="$(
- sed -n '28,48p' "${INTEGRATION_README}"
- )"
- eval_task_output="$(
- sed -n '1,24p' "${EVAL_TASK_DOC}"
- )"
- eval_scenarios_output="$(
- sed -n '24,34p' "${EVAL_SCENARIOS_DOC}"
- )"
- high_risk_matrix_output="$(
- sed -n '44,58p' "${HIGH_RISK_MATRIX_DOC}"
- )"
- api_contracts_output="$(
- sed -n '447,453p' "${API_CONTRACTS_DOC}"
- )"
- source_of_truth_output="$(
- sed -n '412,420p' "${SOURCE_OF_TRUTH_DOC}"
- )"
- migration_audit_output="$(
- sed -n '10,22p' "${MIGRATION_AUDIT_DOC}"
- )"
-
- assert_contains "runbook references hosted trial probe script" "${runbook_output}" "tests/integration/scripts/trial-signup-contract.sh"
- assert_contains "runbook documents initial hosted-signup redirect" "${runbook_output}" "returns \`409\` with \`trial_signup_required\`"
- assert_contains "runbook documents hosted-signup retry burst" "${runbook_output}" "hosted-signup retry burst"
- assert_contains "runbook documents retry-after backoff metadata" "${runbook_output}" "\`Retry-After\` backoff metadata"
- assert_contains "runbook documents limiter transition output" "${runbook_output}" "retry_limiter_attempt=..."
- assert_contains "runbook documents final trial-rate-limited output" "${runbook_output}" "final_trial_start_code=429"
- assert_not_contains "runbook no longer hardcodes second-attempt rejection" "${runbook_output}" "Second immediate trial start is rejected with \`429\`"
-
- assert_contains "pricing doc documents trial-start route" "${pricing_output}" "POST \`/api/license/trial/start\`"
- assert_contains "pricing doc documents hosted-signup redirect code" "${pricing_output}" "\`409 trial_signup_required\`"
- assert_contains "pricing doc documents retry burst" "${pricing_output}" "retry burst"
- assert_contains "pricing doc documents trial-rate-limited response" "${pricing_output}" "\`429 trial_rate_limited\`"
- assert_contains "pricing doc documents retry-after metadata" "${pricing_output}" "\`Retry-After\`"
- assert_not_contains "pricing doc no longer claims 24 hour limiter" "${pricing_output}" "24 hours"
-
- assert_contains "upgrade guide keeps hosted-signup-only wording" "${upgrade_output}" "rather than minting a local trial directly"
- assert_contains "upgrade guide documents hosted-signup redirect code" "${upgrade_output}" "\`409 trial_signup_required\`"
- assert_contains "upgrade guide documents retry burst" "${upgrade_output}" "retry burst"
- assert_contains "upgrade guide documents trial-rate-limited response" "${upgrade_output}" "\`429 trial_rate_limited\`"
- assert_contains "upgrade guide documents retry-after metadata" "${upgrade_output}" "\`Retry-After\`"
-
- assert_contains "integration readme documents trial-start route" "${integration_output}" "POST /api/license/trial/start"
- assert_contains "integration readme documents hosted-signup redirect code" "${integration_output}" "\`409 trial_signup_required\`"
- assert_contains "integration readme documents canonical trial-rate-limited response" "${integration_output}" "\`429 trial_rate_limited\`"
- assert_contains "integration readme documents reused-instance retry-after branch" "${integration_output}" "Retry-After"
- assert_contains "integration readme documents hosted-signup retry burst" "${integration_output}" "hosted-signup retry-burst contract"
- assert_contains "integration readme names pulse pro retry-after ui proof" "${integration_output}" "tests/58-self-hosted-trial-rate-limit-ui.spec.ts"
- assert_contains "integration readme documents pulse pro billing route proof" "${integration_output}" "/settings/system/billing"
-
- assert_contains "eval task documents retry-burst contract" "${eval_task_output}" "retry-burst contract"
- assert_contains "eval task documents canonical trial-rate-limited response" "${eval_task_output}" "\`429 trial_rate_limited\`"
- assert_contains "eval task documents retry-after metadata" "${eval_task_output}" "\`Retry-After\`"
-
- assert_contains "eval scenario documents trial-start route" "${eval_scenarios_output}" "POST /api/license/trial/start"
- assert_contains "eval scenario documents hosted-signup redirect code" "${eval_scenarios_output}" "409 trial_signup_required"
- assert_contains "eval scenario documents canonical trial-rate-limited response" "${eval_scenarios_output}" "429 trial_rate_limited"
- assert_contains "eval scenario documents retry-after metadata" "${eval_scenarios_output}" "Retry-After"
-
- assert_contains "high-risk matrix documents trial-start route" "${high_risk_matrix_output}" "POST /api/license/trial/start"
- assert_contains "high-risk matrix documents hosted-signup redirect code" "${high_risk_matrix_output}" "trial_signup_required"
- assert_contains "high-risk matrix documents canonical trial-rate-limited response" "${high_risk_matrix_output}" "trial_rate_limited"
- assert_contains "high-risk matrix documents retry-after metadata" "${high_risk_matrix_output}" "Retry-After"
- assert_contains "high-risk matrix names pulse pro retry-after ui proof" "${high_risk_matrix_output}" "tests/58-self-hosted-trial-rate-limit-ui.spec.ts"
-
- assert_contains "api contracts document trial-start route" "${api_contracts_output}" "/api/license/trial/start"
- assert_contains "api contracts document hosted-signup redirect code" "${api_contracts_output}" "trial_signup_required"
- assert_contains "api contracts document canonical trial-rate-limited response" "${api_contracts_output}" "trial_rate_limited"
- assert_contains "api contracts document retry-after metadata" "${api_contracts_output}" "Retry-After"
-
- assert_contains "source of truth documents trial-start route" "${source_of_truth_output}" "POST /api/license/trial/start"
- assert_contains "source of truth keeps hosted-signup-only contract" "${source_of_truth_output}" "must initiate hosted signup only"
- assert_contains "source of truth documents hosted-signup redirect code" "${source_of_truth_output}" "trial_signup_required"
- assert_contains "source of truth documents canonical trial-rate-limited response" "${source_of_truth_output}" "trial_rate_limited"
- assert_contains "source of truth documents retry-after metadata" "${source_of_truth_output}" "Retry-After"
- assert_contains "source of truth forbids local trial minting" "${source_of_truth_output}" "must not mint local trial"
-
- assert_contains "migration audit documents trial-start route" "${migration_audit_output}" "POST /api/license/trial/start"
- assert_contains "migration audit keeps hosted-signup-only contract" "${migration_audit_output}" "must initiate hosted signup only"
- assert_contains "migration audit documents hosted-signup redirect code" "${migration_audit_output}" "trial_signup_required"
- assert_contains "migration audit documents canonical trial-rate-limited response" "${migration_audit_output}" "trial_rate_limited"
- assert_contains "migration audit documents retry-after metadata" "${migration_audit_output}" "Retry-After"
- assert_contains "migration audit forbids local trial minting" "${migration_audit_output}" "may only redeem signed hosted trial activation tokens"
-
- assert_forbidden_patterns_absent
+ assert_file_contains "upgrade guide documents no general in-app trial" "${UPGRADE_DOC}" "does not expose a general in-app trial"
+ assert_file_contains "runbook documents unchanged entitlements" "${RUNBOOK}" "Entitlements remain unchanged"
+ assert_file_contains "integration README documents no trial CTAs" "${INTEGRATION_README}" "trial CTAs"
+ assert_file_contains "eval task documents no legacy acquisition payloads" "${EVAL_TASK_DOC}" "legacy"
+
+ for doc in "${RETIRED_CONTRACT_DOCS[@]}"; do
+ for pattern in "${FORBIDDEN_ACTIVE_PATTERNS[@]}"; do
+ assert_file_not_contains "${doc#${ROOT_DIR}/} excludes old active trial-start wording: ${pattern}" "${doc}" "${pattern}"
+ done
+ done
if (( failures > 0 )); then
- echo "trial-signup docs smoke tests failed: ${failures}" >&2
+ echo "trial-start retired docs smoke tests failed: ${failures}" >&2
exit 1
fi
- echo "trial-signup docs smoke tests passed."
+ echo "trial-start retired docs smoke tests passed."
}
main "$@"
diff --git a/tests/integration/README.md b/tests/integration/README.md
index 9dd0528d51..74ab1f5d9a 100644
--- a/tests/integration/README.md
+++ b/tests/integration/README.md
@@ -27,15 +27,12 @@ End-to-end Playwright tests that validate critical user flows against a running
- `tests/06-theme-visual.spec.ts` — visual regression baselines for light/dark auth surfaces:
- Logged-out login page (full page + form card)
- Authenticated Settings → Authentication page
-- `tests/07-trial-signup-return.spec.ts` — trial workflow contract:
- - Start hosted Pro trial initiation via `POST /api/license/trial/start` and verify the reused-instance contract
- - Verify the response either returns `409 trial_signup_required` with hosted `/start-pro-trial` handoff or `429 trial_rate_limited` with canonical `Retry-After` backoff when the local retry bucket is already exhausted
- - Verify local entitlements remain unchanged until activation
- - Verify duplicate initiation stays on the hosted-signup retry-burst contract
-- `tests/58-self-hosted-trial-rate-limit-ui.spec.ts` — Pulse Pro trial CTA retry-after UI contract:
+- `tests/07-trial-signup-return.spec.ts` — retired self-hosted trial-start route contract:
+ - Probe `POST /api/license/trial/start` and verify ordinary self-hosted v6 returns `404`
+ - Verify local entitlements remain unchanged after the retired route probe
+- `tests/58-self-hosted-trial-rate-limit-ui.spec.ts` — paid prompt visibility contract:
- Open `/settings/system/billing` on the real browser shell with free-tier entitlements
- - Stub `429 trial_rate_limited` on `POST /api/license/trial/start`
- - Verify the Pulse Pro CTA surfaces canonical `Retry-After` guidance even if `details.retry_after_seconds` disagrees
+ - Verify trial CTAs and paid-only navigation stay out of the default self-hosted UI
- `tests/08-cloud-hosting.spec.ts` — hosted cloud signup contract:
- Public `/cloud/signup` form creates a real Stripe sandbox checkout session
- Checkout completes and returns to hosted signup completion page
@@ -192,24 +189,18 @@ The harness understands these profiles:
- `PULSE_E2E_ENTITLEMENT_PROFILE=infra` for Pro/relay/reporting-style journeys.
### Snapshot-Clean Proxmox LXC Trial SAT
-For hosted trial initiation validation against a fresh LXC each run:
+For retired self-hosted trial-start validation against a fresh LXC each run:
- Runbook: `docs/operations/TRIAL_E2E_LXC_SNAPSHOT_RUNBOOK.md`
- Probe script: `tests/integration/scripts/trial-signup-contract.sh`
- Exercises `POST /api/license/trial/start` from a clean snapshot and proves
- the hosted-signup retry-burst contract: duplicate attempts keep returning
- `409 trial_signup_required` with hosted redirects while the burst remains
- open, then transition to `429 trial_rate_limited` plus `Retry-After`
- backoff metadata once the retry burst is exhausted and the limiter
- actually engages
+ ordinary self-hosted v6 returns `404` without mutating entitlements
- Pulse Pro browser proof: `tests/58-self-hosted-trial-rate-limit-ui.spec.ts`
- Exercises `/settings/system/billing` on the real browser shell and proves
- the rendered CTA surfaces canonical `Retry-After` guidance when
- `trial_rate_limited` is returned, including header precedence over a
- conflicting `details.retry_after_seconds` payload
+ trial CTAs and paid-only navigation stay out of the default self-hosted UI
- Full sandbox orchestration (multi-tenant + trial + cloud, with per-scenario snapshot reset):
- `tests/integration/scripts/run-lxc-sandbox-evals.sh`
- - Includes hosted trial initiation validation and cloud subscription cancellation lifecycle verification
+ - Includes retired self-hosted trial-start validation and cloud subscription cancellation lifecycle verification
Example:
```bash
diff --git a/tests/integration/evals/scenarios.json b/tests/integration/evals/scenarios.json
index 8d66d4cd96..8ee95eef7a 100644
--- a/tests/integration/evals/scenarios.json
+++ b/tests/integration/evals/scenarios.json
@@ -26,7 +26,7 @@
{
"id": "trial-signup",
"name": "Pro Trial Signup Return",
- "description": "Ensures self-hosted Pulse initiates hosted trial signup through POST /api/license/trial/start, preserves local entitlements until activation, returns 409 trial_signup_required while the hosted-signup retry burst remains open, and transitions to 429 trial_rate_limited with Retry-After backoff once the limiter engages.",
+ "description": "Ensures self-hosted Pulse no longer initiates hosted Pro trial acquisition from the ordinary runtime: POST /api/license/trial/start returns 404 and preserves local entitlements.",
"deterministic": {
"command": [
"npx",
diff --git a/tests/integration/evals/tasks/trial-signup.md b/tests/integration/evals/tasks/trial-signup.md
index 65351b9afb..5e1f7d6724 100644
--- a/tests/integration/evals/tasks/trial-signup.md
+++ b/tests/integration/evals/tasks/trial-signup.md
@@ -1,7 +1,7 @@
-# Scenario: Pro Trial Signup
+# Scenario: Retired Pro Trial Signup
## Goal
-Prove the self-hosted Pulse instance initiates the hosted trial flow correctly, does not mint local entitlement before activation, and enforces the hosted-signup retry-burst contract for duplicate initiation attempts.
+Prove the self-hosted Pulse instance no longer initiates a hosted Pro trial from the ordinary in-app runtime and does not mutate local entitlements when the retired route is probed.
## Environment
- Base URL: `{{base_url}}`
@@ -9,14 +9,11 @@ Prove the self-hosted Pulse instance initiates the hosted trial flow correctly,
- Password: `{{password}}`
## Required checks
-1. Verify pre-trial entitlements show `trial_eligible=true`.
-2. Start trial via `POST /api/license/trial/start`.
-3. If the first response is HTTP `409`, confirm code `trial_signup_required` and a hosted `action_url` that targets `/start-pro-trial`.
-4. If the first response is HTTP `429`, confirm code `trial_rate_limited` and that `Retry-After` matches `details.retry_after_seconds`.
-5. Verify post-initiation entitlements remain unactivated locally (`trial_eligible=true`, `subscription_state=expired`).
-6. Retry `POST /api/license/trial/start` immediately:
- - If the first response was `409`, accept either another `409 trial_signup_required` while the retry burst is still open or `429 trial_rate_limited` once the limiter engages.
- - If the first response was already `429`, confirm the retry remains `429 trial_rate_limited` with matching backoff metadata.
+1. Capture current entitlements.
+2. Probe `POST /api/license/trial/start`.
+3. Confirm the response is HTTP `404`.
+4. Confirm the response does not contain legacy hosted-signup or trial-rate-limit acquisition payloads.
+5. Verify post-probe entitlements match the pre-probe entitlement summary.
## Output contract
Write JSON to `{{result_json}}` with this shape:
diff --git a/tests/integration/scripts/trial-signup-contract.sh b/tests/integration/scripts/trial-signup-contract.sh
index eca0b31bc3..9fb6121bb3 100755
--- a/tests/integration/scripts/trial-signup-contract.sh
+++ b/tests/integration/scripts/trial-signup-contract.sh
@@ -1,14 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
-# Live trial-signup initiation contract probe for self-hosted Pulse + control-plane.
-# Intended to run inside the target environment (for example inside an LXC).
+# Retired trial-start contract probe for self-hosted Pulse.
+# This verifies ordinary self-hosted v6 runtimes do not expose in-app trial
+# acquisition. Signed activation handoffs still use /auth/trial-activate.
PULSE_BASE_URL="${PULSE_BASE_URL:-http://127.0.0.1:7655}"
PULSE_E2E_USERNAME="${PULSE_E2E_USERNAME:-admin}"
PULSE_E2E_PASSWORD="${PULSE_E2E_PASSWORD:-adminadminadmin}"
WAIT_TIMEOUT_SECONDS="${WAIT_TIMEOUT_SECONDS:-60}"
-MAX_DUPLICATE_TRIAL_ATTEMPTS="${MAX_DUPLICATE_TRIAL_ATTEMPTS:-10}"
if ! command -v curl >/dev/null 2>&1; then
echo "ERROR: curl is required"
@@ -24,10 +24,9 @@ trap 'rm -rf "${tmp_dir}"' EXIT
cookies_file="${tmp_dir}/cookies.txt"
login_body="${tmp_dir}/login.json"
-entitlements_body="${tmp_dir}/entitlements.json"
-start_body="${tmp_dir}/trial_start.json"
-second_start_body="${tmp_dir}/trial_start_second.json"
-second_start_headers="${tmp_dir}/trial_start_second.headers"
+entitlements_before_body="${tmp_dir}/entitlements_before.json"
+entitlements_after_body="${tmp_dir}/entitlements_after.json"
+trial_start_body="${tmp_dir}/trial_start.json"
wait_for_http() {
local url="$1"
@@ -54,10 +53,10 @@ assert_code() {
fi
}
-echo "[1/6] Waiting for Pulse API readiness at ${PULSE_BASE_URL}"
+echo "[1/5] Waiting for Pulse API readiness at ${PULSE_BASE_URL}"
wait_for_http "${PULSE_BASE_URL}/api/login"
-echo "[2/6] Login with configured test credentials"
+echo "[2/5] Login with configured test credentials"
login_code="$(
curl -sS -o "${login_body}" -w '%{http_code}' \
-c "${cookies_file}" \
@@ -73,126 +72,48 @@ if [ -z "${csrf_token}" ]; then
exit 1
fi
-echo "[3/6] Check pre-trial entitlements"
-entitlements_code="$(
- curl -sS -o "${entitlements_body}" -w '%{http_code}' \
+echo "[3/5] Capture entitlements before retired route probe"
+entitlements_before_code="$(
+ curl -sS -o "${entitlements_before_body}" -w '%{http_code}' \
-b "${cookies_file}" \
"${PULSE_BASE_URL}/api/license/entitlements"
)"
-assert_code "200" "${entitlements_code}" "GET /api/license/entitlements"
-trial_eligible="$(jq -r '.trial_eligible // empty' "${entitlements_body}")"
-if [ "${trial_eligible}" != "true" ]; then
- echo "ERROR: expected trial_eligible=true before trial start"
- exit 1
-fi
+assert_code "200" "${entitlements_before_code}" "GET /api/license/entitlements"
-echo "[4/6] Verify hosted trial signup initiation returns a control-plane redirect"
-start_code="$(
- curl -sS -o "${start_body}" -w '%{http_code}' \
+echo "[4/5] Verify ordinary self-hosted trial start route is not exposed"
+trial_start_code="$(
+ curl -sS -o "${trial_start_body}" -w '%{http_code}' \
-X POST \
-b "${cookies_file}" \
-H "X-CSRF-Token: ${csrf_token}" \
"${PULSE_BASE_URL}/api/license/trial/start"
)"
-assert_code "409" "${start_code}" "POST /api/license/trial/start"
+assert_code "404" "${trial_start_code}" "POST /api/license/trial/start"
-start_code_name="$(jq -r '.code // empty' "${start_body}")"
-if [ "${start_code_name}" != "trial_signup_required" ]; then
- echo "ERROR: expected code=trial_signup_required, got ${start_code_name:-<empty>}"
- exit 1
-fi
-action_url="$(jq -r '.details.action_url // empty' "${start_body}")"
-if [ -z "${action_url}" ]; then
- echo "ERROR: expected action_url in trial start response"
- exit 1
-fi
-if ! printf '%s' "${action_url}" | grep -q '/start-pro-trial'; then
- echo "ERROR: expected action_url to target hosted start-pro-trial page, got ${action_url}"
+if jq -e '.code == "trial_signup_required" or .code == "trial_rate_limited"' "${trial_start_body}" >/dev/null 2>&1; then
+ echo "ERROR: retired route returned legacy trial acquisition payload"
exit 1
fi
-echo "[5/6] Verify local entitlements remain unchanged before hosted activation"
-post_entitlements_code="$(
- curl -sS -o "${entitlements_body}" -w '%{http_code}' \
+echo "[5/5] Verify entitlements remain unchanged"
+entitlements_after_code="$(
+ curl -sS -o "${entitlements_after_body}" -w '%{http_code}' \
-b "${cookies_file}" \
"${PULSE_BASE_URL}/api/license/entitlements"
)"
-assert_code "200" "${post_entitlements_code}" "GET /api/license/entitlements (post-trial)"
-post_trial_eligible="$(jq -r '.trial_eligible // empty' "${entitlements_body}")"
-if [ "${post_trial_eligible}" != "true" ]; then
- echo "ERROR: expected trial_eligible=true before hosted activation completes"
- exit 1
-fi
-post_sub_state="$(jq -r '.subscription_state // empty' "${entitlements_body}")"
-if [ "${post_sub_state}" != "expired" ]; then
- echo "ERROR: expected subscription_state=expired before hosted activation, got ${post_sub_state:-<empty>}"
- exit 1
-fi
-
-echo "[6/6] Verify duplicate initiation stays on the retry-burst contract until the limiter engages"
-rate_limited_attempt=""
-second_start_code=""
-second_code_name=""
-retry_after_header=""
-retry_after_seconds=""
-
-for attempt in $(seq 2 "${MAX_DUPLICATE_TRIAL_ATTEMPTS}"); do
- second_start_code="$(
- curl -sS -D "${second_start_headers}" -o "${second_start_body}" -w '%{http_code}' \
- -X POST \
- -b "${cookies_file}" \
- -H "X-CSRF-Token: ${csrf_token}" \
- "${PULSE_BASE_URL}/api/license/trial/start"
- )"
- second_code_name="$(jq -r '.code // empty' "${second_start_body}")"
-
- if [ "${second_start_code}" = "409" ]; then
- if [ "${second_code_name}" != "trial_signup_required" ]; then
- echo "ERROR: expected code=trial_signup_required within retry burst, got ${second_code_name:-<empty>}"
- exit 1
- fi
- action_url="$(jq -r '.details.action_url // empty' "${second_start_body}")"
- if [ -z "${action_url}" ]; then
- echo "ERROR: expected action_url while retry burst still allows hosted signup"
- exit 1
- fi
- continue
- fi
-
- if [ "${second_start_code}" = "429" ]; then
- if [ "${second_code_name}" != "trial_rate_limited" ]; then
- echo "ERROR: expected code=trial_rate_limited once retry burst is exceeded, got ${second_code_name:-<empty>}"
- exit 1
- fi
- retry_after_header="$(
- awk 'tolower($1)=="retry-after:" {print $2}' "${second_start_headers}" | tr -d '\r' | tail -n1
- )"
- retry_after_seconds="$(jq -r '.details.retry_after_seconds // empty' "${second_start_body}")"
- if [ -z "${retry_after_header}" ]; then
- echo "ERROR: expected Retry-After header once retry burst is exceeded"
- exit 1
- fi
- if [ "${retry_after_seconds}" != "${retry_after_header}" ]; then
- echo "ERROR: expected details.retry_after_seconds=${retry_after_header}, got ${retry_after_seconds:-<empty>}"
- exit 1
- fi
- rate_limited_attempt="${attempt}"
- break
- fi
-
- echo "ERROR: expected HTTP 409 within retry burst or HTTP 429 once the limiter engages, got ${second_start_code}"
- exit 1
-done
-
-if [ -z "${rate_limited_attempt}" ]; then
- echo "ERROR: duplicate trial initiation never hit the retry limiter within ${MAX_DUPLICATE_TRIAL_ATTEMPTS} attempts"
+assert_code "200" "${entitlements_after_code}" "GET /api/license/entitlements (after retired route probe)"
+
+before_summary="$(jq -c '{subscription_state, tier, trial_eligible, trial_days_remaining, valid, is_lifetime}' "${entitlements_before_body}")"
+after_summary="$(jq -c '{subscription_state, tier, trial_eligible, trial_days_remaining, valid, is_lifetime}' "${entitlements_after_body}")"
+if [ "${before_summary}" != "${after_summary}" ]; then
+ echo "ERROR: retired route probe changed entitlement state"
+ echo "before=${before_summary}"
+ echo "after=${after_summary}"
exit 1
fi
-echo "PASS: hosted trial signup initiation contract validated"
+echo "PASS: self-hosted trial-start route is retired"
echo " login_code=${login_code}"
-echo " entitlements_before_code=${entitlements_code}"
-echo " trial_start_code=${start_code} (code=${start_code_name})"
-echo " post_trial_entitlements_code=${post_entitlements_code}"
-echo " retry_limiter_attempt=${rate_limited_attempt}"
-echo " final_trial_start_code=${second_start_code} (code=${second_code_name}, retry_after=${retry_after_header})"
+echo " entitlements_before_code=${entitlements_before_code}"
+echo " trial_start_code=${trial_start_code}"
+echo " entitlements_after_code=${entitlements_after_code}"
diff --git a/tests/integration/tests/07-trial-signup-return.spec.ts b/tests/integration/tests/07-trial-signup-return.spec.ts
index a13173d58a..d4447c32c9 100644
--- a/tests/integration/tests/07-trial-signup-return.spec.ts
+++ b/tests/integration/tests/07-trial-signup-return.spec.ts
@@ -10,71 +10,21 @@ type EntitlementPayload = {
is_lifetime?: boolean;
};
-type TrialStartPayload = {
- code?: string;
- details?: Record<string, string>;
-};
-
-function expectTrialRateLimited(payload: TrialStartPayload, retryAfterHeader?: string | null) {
- expect(payload.code).toBe('trial_rate_limited');
- const retryAfterSeconds = Number.parseInt(payload.details?.retry_after_seconds || '', 10);
- expect(retryAfterSeconds).toBeGreaterThan(0);
- if (retryAfterHeader) {
- expect(String(retryAfterSeconds)).toBe(retryAfterHeader);
- }
-}
-
-function expectHostedTrialRedirect(payload: TrialStartPayload) {
- expect(payload.code).toBe('trial_signup_required');
-
- const actionUrl = payload.details?.action_url ?? '';
- expect(actionUrl).toContain('/start-pro-trial');
- const parsedActionUrl = new URL(actionUrl);
- expect(parsedActionUrl.searchParams.get('org_id')).toBe('default');
- expect(parsedActionUrl.searchParams.get('return_url')).toContain('/auth/trial-activate');
-}
-
-test.describe.serial('Trial signup return flow', () => {
- test('initiates hosted trial signup and preserves local entitlements until activation', async ({ page }, testInfo) => {
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only trial workflow coverage');
+test.describe.serial('Retired self-hosted trial start route', () => {
+ test('does not expose in-app trial acquisition and preserves local entitlements', async ({ page }, testInfo) => {
+ test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only commercial route coverage');
await ensureAuthenticated(page);
const preRes = await apiRequest(page, '/api/license/entitlements');
expect(preRes.ok(), `entitlements pre-check failed: HTTP ${preRes.status()}`).toBeTruthy();
const pre = (await preRes.json()) as EntitlementPayload;
- test.skip(
- pre.trial_eligible !== true,
- `Skipping trial flow because trial_eligible is ${String(pre.trial_eligible)} in this environment.`,
- );
-
- expect(
- pre.trial_eligible,
- 'Expected trial_eligible=true before test.',
- ).toBe(true);
- expect(pre.tier).toBe('free');
- expect(pre.valid ?? false).toBe(false);
- expect(pre.is_lifetime ?? false).toBe(false);
- // Start hosted trial via API.
const startRes = await apiRequest(page, '/api/license/trial/start', {
method: 'POST',
});
- expect(
- [409, 429],
- `trial start failed: expected 409 or 429, got HTTP ${startRes.status()}`,
- ).toContain(startRes.status());
+ expect(startRes.status(), `retired trial start route must not be exposed: HTTP ${startRes.status()}`).toBe(404);
- const startPayload = (await startRes.json()) as TrialStartPayload;
- // Playwright lowercases response header keys; this still reads the canonical Retry-After header.
- const startRetryAfterHeader = startRes.headers()['retry-after'] ?? null;
- if (startRes.status() === 409) {
- expectHostedTrialRedirect(startPayload);
- } else {
- expectTrialRateLimited(startPayload, startRetryAfterHeader);
- }
-
- // Verify commercial entitlements remain unchanged until the hosted flow returns.
const postRes = await apiRequest(page, '/api/license/entitlements');
expect(postRes.ok(), `entitlements post-check failed: HTTP ${postRes.status()}`).toBeTruthy();
const post = (await postRes.json()) as EntitlementPayload;
@@ -83,28 +33,6 @@ test.describe.serial('Trial signup return flow', () => {
expect(post.valid ?? false).toBe(pre.valid ?? false);
expect(post.is_lifetime ?? false).toBe(pre.is_lifetime ?? false);
expect(post.trial_days_remaining ?? 0).toBe(pre.trial_days_remaining ?? 0);
- expect(post.trial_eligible).toBe(true);
-
- // Verify UI still reflects the unactivated local state.
- await page.goto('/settings/system/billing');
- await expect(page.getByRole('heading', { name: 'Plans & Activation' }).first()).toBeVisible();
- await expect(page.getByText(/No Pro license is active/i)).toBeVisible();
-
- // Verify duplicate initiation stays on the owned retry-burst contract.
- const secondRes = await apiRequest(page, '/api/license/trial/start', {
- method: 'POST',
- });
- const secondPayload = (await secondRes.json()) as TrialStartPayload;
- // Playwright lowercases response header keys; this still reads the canonical Retry-After header.
- const secondRetryAfterHeader = secondRes.headers()['retry-after'] ?? null;
- if (startRes.status() === 429) {
- expect(secondRes.status()).toBe(429);
- expectTrialRateLimited(secondPayload, secondRetryAfterHeader);
- } else if (secondRes.status() === 409) {
- expectHostedTrialRedirect(secondPayload);
- } else {
- expect(secondRes.status()).toBe(429);
- expectTrialRateLimited(secondPayload, secondRetryAfterHeader);
- }
+ expect(post.trial_eligible).toBe(pre.trial_eligible);
});
});
diff --git a/tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts b/tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts
index f7e8bd38a8..b1612ac0a0 100644
--- a/tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts
+++ b/tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts
@@ -395,9 +395,7 @@ base.describe('Demo mode commercial boundary', () => {
await hiddenNotFound('**/api/license/entitlements');
await hiddenNotFound('**/api/license/activate');
await hiddenNotFound('**/api/license/clear');
- // Demo mode must fail closed on the trial-start route before either
- // `trial_signup_required` or `trial_rate_limited` plus `Retry-After`
- // can surface.
+ // Demo mode must keep the retired trial-start route closed.
await hiddenNotFound('**/api/license/trial/start');
await hiddenNotFound('**/api/license/monitored-system-ledger**');
await hiddenNotFound('**/api/admin/orgs/**/billing-state');
diff --git a/tests/integration/tests/71-self-hosted-pro-trial-sandbox.spec.ts b/tests/integration/tests/71-self-hosted-pro-trial-sandbox.spec.ts
index e7216ef0a4..d94f22f37d 100644
--- a/tests/integration/tests/71-self-hosted-pro-trial-sandbox.spec.ts
+++ b/tests/integration/tests/71-self-hosted-pro-trial-sandbox.spec.ts
@@ -1,187 +1,15 @@
import { expect, test } from '@playwright/test';
import { apiRequest, ensureAuthenticated } from './helpers';
-import { completeStripeSandboxCheckout } from './stripe-sandbox';
-import { preferredPlaywrightRouteBaseURL } from './runtime-defaults';
-type EntitlementPayload = {
- subscription_state?: string;
- tier?: string;
- trial_eligible?: boolean;
- trial_days_remaining?: number;
- valid?: boolean;
- is_lifetime?: boolean;
-};
+test.describe.serial('Retired self-hosted Pro trial sandbox path', () => {
+ test('does not start a hosted Stripe trial from an ordinary self-hosted runtime', async ({ page }, testInfo) => {
+ test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only commercial route coverage');
-type TrialStartPayload = {
- code?: string;
- details?: Record<string, string>;
-};
+ await ensureAuthenticated(page);
-type Tenant = {
- id?: string;
- email?: string;
- state?: string;
-};
-
-type StripeSessionResponse = {
- id: string;
- subscription?: string | { id?: string };
-};
-
-function explicitCloudBaseURL(): string {
- return String(process.env.PULSE_CLOUD_BASE_URL || '').trim();
-}
-
-function cloudBaseURL(): string {
- return preferredPlaywrightRouteBaseURL(process.env, [
- explicitCloudBaseURL(),
- ]);
-}
-
-function requiredEnv(name: string): string {
- const value = String(process.env[name] || '').trim();
- if (value === '') {
- throw new Error(`Missing required env var: ${name}`);
- }
- return value;
-}
-
-function trialIdentity() {
- const suffix = `${Date.now()}-${Math.floor(Math.random() * 1_000_000)}`;
- return {
- name: `Pulse Trial E2E ${suffix}`,
- email: `trial-${suffix}@customer-pulse-e2e.test`,
- company: `Pulse Trial E2E ${suffix}`,
- };
-}
-
-async function listControlPlaneTenants(
- request: import('@playwright/test').APIRequestContext,
- baseURL: string,
- adminKey: string,
-): Promise<Tenant[]> {
- const response = await request.get(`${baseURL}/admin/tenants`, {
- headers: {
- 'X-Admin-Key': adminKey,
- Accept: 'application/json',
- },
- });
- expect(response.ok(), `control-plane tenant list failed: HTTP ${response.status()}`).toBeTruthy();
- const payload = (await response.json()) as { tenants?: Tenant[] };
- return Array.isArray(payload.tenants) ? payload.tenants : [];
-}
-
-async function stripeRequest<T>(secretKey: string, path: string, method = 'GET') {
- const response = await fetch(`https://api.stripe.com${path}`, {
- method,
- headers: {
- Authorization: `Bearer ${secretKey}`,
- Accept: 'application/json',
- },
- });
- const payload = (await response.json().catch(() => ({}))) as Record<string, unknown>;
- if (!response.ok) {
- const message =
- ((payload.error as Record<string, unknown> | undefined)?.message as string | undefined) ||
- `Stripe API error (${response.status})`;
- throw new Error(message);
- }
- return payload as T;
-}
-
-test.describe.serial('Self-hosted Pro trial Stripe sandbox activation', () => {
- test('completes checkout, returns to Pulse, and activates the local trial entitlement', async ({ page }, testInfo) => {
- test.setTimeout(180_000);
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only Stripe checkout workflow coverage');
- test.skip(
- explicitCloudBaseURL() === '',
- 'Set PULSE_CLOUD_BASE_URL to run self-hosted Pro trial sandbox activation coverage.',
- );
-
- const requiredVars = ['PULSE_CP_ADMIN_KEY'] as const;
- const missingVars = requiredVars.filter((name) => String(process.env[name] || '').trim() === '');
- test.skip(missingVars.length > 0, `Missing required env var(s): ${missingVars.join(', ')}`);
-
- const cpBaseURL = cloudBaseURL();
- const cpAdminKey = requiredEnv('PULSE_CP_ADMIN_KEY');
- const identity = trialIdentity();
- const stripeSecretKey = String(process.env.PULSE_E2E_STRIPE_API_KEY || '').trim();
- let subscriptionID = '';
-
- try {
- await ensureAuthenticated(page);
-
- const preRes = await apiRequest(page, '/api/license/entitlements');
- expect(preRes.ok(), `entitlements pre-check failed: HTTP ${preRes.status()}`).toBeTruthy();
- const pre = (await preRes.json()) as EntitlementPayload;
- test.skip(
- pre.trial_eligible !== true,
- `Skipping full trial activation because trial_eligible is ${String(pre.trial_eligible)} in this environment.`,
- );
- expect(pre.tier).toBe('free');
- expect(pre.valid ?? false).toBe(false);
- expect(pre.is_lifetime ?? false).toBe(false);
-
- const startRes = await apiRequest(page, '/api/license/trial/start', {
- method: 'POST',
- });
- expect(startRes.status(), `trial start failed: HTTP ${startRes.status()}`).toBe(409);
- const startPayload = (await startRes.json()) as TrialStartPayload;
- expect(startPayload.code).toBe('trial_signup_required');
-
- const actionURL = startPayload.details?.action_url ?? '';
- expect(actionURL).toContain('/start-pro-trial');
- const parsedActionURL = new URL(actionURL);
- expect(parsedActionURL.origin).toBe(new URL(cpBaseURL).origin);
- expect(parsedActionURL.searchParams.get('return_url')).toContain('/auth/trial-activate');
- expect(parsedActionURL.searchParams.get('instance_token') || '').toMatch(/^tsi1_/);
-
- await page.goto(actionURL);
- await expect(page.getByRole('heading', { name: /start your 14-day pro trial/i })).toBeVisible();
- await page.locator('#name').fill(identity.name);
- await page.locator('#email').fill(identity.email);
- await page.locator('#company').fill(identity.company);
- await page.getByRole('button', { name: /continue to secure trial setup/i }).click();
-
- const checkout = await completeStripeSandboxCheckout(page, {
- email: identity.email,
- cardholderName: identity.name,
- });
- if (stripeSecretKey !== '' && checkout.checkoutSessionID) {
- const session = await stripeRequest<StripeSessionResponse>(
- stripeSecretKey,
- `/v1/checkout/sessions/${encodeURIComponent(checkout.checkoutSessionID)}?expand[]=subscription`,
- );
- subscriptionID = typeof session.subscription === 'string'
- ? session.subscription.trim()
- : (session.subscription?.id || '').trim();
- }
-
- await page.waitForURL(/\/trial-signup\/complete\?session_id=/, { timeout: 120_000 });
- await expect(page.getByRole('heading', { name: /trial entitlement ready/i })).toBeVisible();
- await page.getByRole('link', { name: /return to pulse/i }).click();
- await page.waitForURL(/\/settings\/system-pro\?trial=activated/, { timeout: 120_000 });
-
- const postRes = await apiRequest(page, '/api/license/entitlements');
- expect(postRes.ok(), `entitlements post-activation failed: HTTP ${postRes.status()}`).toBeTruthy();
- const post = (await postRes.json()) as EntitlementPayload;
- expect(post.subscription_state).toBe('trial');
- expect(post.trial_days_remaining ?? 0).toBeGreaterThan(0);
- expect(post.trial_eligible).toBe(false);
-
- const tenants = await listControlPlaneTenants(page.request, cpBaseURL, cpAdminKey);
- const matchingTenant = tenants.find((tenant) => tenant.email === identity.email);
- expect(
- matchingTenant,
- 'self-hosted Pro trial checkout must not create a hosted Cloud tenant',
- ).toBeUndefined();
- } finally {
- if (stripeSecretKey !== '' && subscriptionID !== '') {
- await stripeRequest(stripeSecretKey, `/v1/subscriptions/${encodeURIComponent(subscriptionID)}`, 'DELETE')
- .catch((error) => {
- console.warn(`Stripe sandbox subscription cleanup failed: ${error instanceof Error ? error.message : String(error)}`);
- });
- }
- }
+ const startRes = await apiRequest(page, '/api/license/trial/start', {
+ method: 'POST',
+ });
+ expect(startRes.status(), `retired trial start route must not be exposed: HTTP ${startRes.status()}`).toBe(404);
});
});