Skip to content

Revert trial plang change - #5478

Merged
tspenov merged 1 commit into
masterfrom
revert-trial-plan-change-block
Dec 4, 2026
Merged

tspenov merged 1 commit into
masterfrom
revert-trial-plan-change-block

Conversation

@tspenov

@tspenov tspenov commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Changes

Ticket

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have tried to find clearer solution before commenting hard-to-understand parts of code
  • I have added tests that prove my fix is effective or that my feature works

Summary by CodeRabbit

  • New Features
    • Trial subscribers can change plans when the destination plan is eligible, including downgrades and certain plan interval changes.
  • Bug Fixes
    • Trial access continues after an eligible plan change. Upgrades and changes to unsupported plans are refused with a message explaining that the option isn’t available during the free trial.

@tspenov
tspenov requested a review from IvanIvanoff as a code owner December 4, 2026 07:54
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The billing code now permits selected plan changes during a trial. It allows same-product trial plans, same-name plans, and ranked destinations no higher than the current plan. Subscription updates apply this check and return a target-specific error for disallowed changes. Tests cover the policy and Stripe update behavior.

Changes: Trial Plan Changes

Layer / File(s) Summary
Plan change eligibility
lib/sanbase/billing/billing.ex, test/sanbase/billing/billing_test.exs
Billing adds product-specific plan ranks and checks whether a requested change is allowed during a trial. Tests cover allowed changes, upgrades, unranked plans, and cross-product changes.
Subscription update enforcement
lib/sanbase/billing/subscription/subscription.ex, test/sanbase_web/graphql/billing/subscribe_api_test.exs
Subscription updates use the eligibility check and return an error for disallowed changes. API tests cover allowed and refused changes and verify Stripe update behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Subscription
  participant Billing
  participant Stripe
  Subscription->>Billing: Check current and target plans
  Billing-->>Subscription: Return eligibility result
  Subscription->>Stripe: Apply allowed plan update
Loading
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@tspenov
tspenov merged commit d2ab50f into master Dec 4, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant