Skip to content

feat: add guarded Stripe plan migration - #816

Merged
filipdjokic merged 2 commits into
developfrom
codex/stripe-plan-migration
Sep 29, 2026
Merged

filipdjokic merged 2 commits into
developfrom
codex/stripe-plan-migration

Conversation

@Eengineer1

Copy link
Copy Markdown
Member

Summary

  • add a Stripe-driven, idempotent migration from Explorer to Basic and legacy/non-Explorer plans to Build
  • give moved subscriptions one calendar month of trial with no proration, while leaving canceled history untouched
  • add dry-run counts, account/product guards, explicit execution confirmation, canary selection, and time-ordered JSONL audit logs
  • keep discounted subscriptions blocked for review unless an override is scoped to explicit customer IDs
  • replace the legacy Stripe CLI scripts with wrappers around the guarded migration and update the production runbook
  • fix the external database Compose migration command to use the existing npm run migrate script

Current production dry run

  • 244 customers evaluated
  • 237 require migration: 221 Basic and 16 Build
  • 222 in-place updates and 15 paused-subscription replacements
  • 7 already on target, 0 blocked
  • 3 remaining customers have a default payment method; 234 do not

No Stripe mutations are performed by the PR or by the default command.

Verification

  • npm run test:unit -- --runInBand (18 suites, 148 tests)
  • npm run build:app
  • standalone strict TypeScript check for the migration script
  • production .env.production dry run
  • verified unscoped discount overrides are rejected

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Execution can revoke scheduled cancellations and replacement subscriptions may lose source-level payment methods.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adds a guarded, Stripe-driven migration from Explorer/legacy plans to Basic/Build, with dry runs, audit logging, canaries, and production safeguards.

Changes:

  • Adds migration planning, execution, validation, and unit tests.
  • Replaces legacy scripts with guarded wrappers and updates runbooks.
  • Corrects the external-database migration command.
File Description
tests/​unit/​admin/​subscription-migration-plan.test.ts Tests migration planning and calendar-month behavior.
src/​types/​environment.d.ts Adds migration environment variables.
src/​services/​admin/​subscription-migration-plan.ts Implements migration planning.
scripts/​README.md Documents the authoritative command.
scripts/​README-SUBSCRIPTION-MIGRATION.md Retires bulk subscription creation.
scripts/​README-SUBSCRIPTION-ACTIVATION.md Retires database-driven activation.
scripts/​MIGRATION-EXPLORER-PLAN.md Provides the production runbook.
scripts/​migrate-studio-plans.ts Implements guarded Stripe migration execution.
scripts/​find-subscriptions-to-activate.sql Marks subscription query as audit-only.
scripts/​find-customers-without-subscriptions.sql Marks customer query as audit-only.
scripts/​create-stripe-subscriptions.sh Wraps the guarded migration command.
scripts/​activate-subscriptions.sh Wraps the guarded migration command.
package.json Registers the migration command.
example.env Documents migration configuration.
docker/​with-external-db/​docker-compose-with-db.yml Corrects the database migration command.
.gitignore Excludes production environment and audit outputs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/migrate-studio-plans.ts
Comment thread scripts/migrate-studio-plans.ts
@filipdjokic
filipdjokic merged commit e4e495d into develop Sep 29, 2026
12 checks passed
@filipdjokic
filipdjokic deleted the codex/stripe-plan-migration branch September 29, 2026 14:59
cheqd-bot Bot pushed a commit that referenced this pull request Sep 29, 2026
## [3.17.0-develop.7](3.17.0-develop.6...3.17.0-develop.7) (2026-09-29)

### Features

* add guarded Stripe plan migration ([#816](#816)) ([e4e495d](e4e495d))
@cheqd-bot

cheqd-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 3.17.0-develop.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

cheqd-bot Bot pushed a commit that referenced this pull request Sep 29, 2026
## [3.17.0](3.16.1...3.17.0) (2026-09-29)

### Features

* **account:** add GET /account/balances with CHEQ/USD conversion ([bfc013e](bfc013e))
* **account:** add GET /account/balances with CHEQ/USD conversion ([#814](#814)) ([6a2510e](6a2510e))
* Add Faucet API access headers ([#810](#810)) ([59d9f7e](59d9f7e))
* add guarded Stripe plan migration ([#816](#816)) ([e4e495d](e4e495d))
* Align Basic/Build plans and add testnet faucet API ([#811](#811)) ([7b00c1f](7b00c1f))
* Start Basic plan as trial for new Studio accounts ([#812](#812)) ([52c2249](52c2249))

### Bug Fixes

* Add missing body parameters for faucet topup requests ([#813](#813)) ([a61bfd5](a61bfd5))
* Improve error-handling for faucet requests ([89ed790](89ed790))
* revert semantic-release version for node 20 ([0915874](0915874))
* **test:** correct no-auth spec matching in Playwright projects ([348251a](348251a))
* **test:** move credential verify test out of no-auth suite ([36bae65](36bae65))
@cheqd-bot

cheqd-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 3.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@cheqd-bot cheqd-bot Bot added the released label Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants