Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughTrial subscriptions now follow the existing 48-hour update-time check for upgrade eligibility. Active trial subscriptions now use ChangesTrial Subscription Plan Changes
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Active trials now follow the subscription update path and the same 48-hour upgrade threshold. The endpoint’s handling of Stripe trials is not visible here, but no actionable merge blocker is established. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. I’m a rabbit, and I hop with cheer, Comment |
Issue ticket number and link
N/A — found while testing billing locally.
Documentation
Select exactly one:
Fixes which billing endpoint the plans page calls; nothing user-facing to document.
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
E2E tests
Optional: override the image tags used by the Playwright e2e workflow.
Defaults to
mainwhen omitted.management-cloud-tag: main
reverse-proxy-tag: main
Summary
Since netbirdio/netbird-cloud#508, a Team account can start a Business trial. Its Team Stripe subscription stays active underneath (
plan_tier: "trial",active: true,price_idset).Upgrading during that trial went through
subscribe(checkout), because the plans page only usedchangeSubscriptionwhenactive && !isTrial. Checkout creates a second Stripe subscription. Management then stores only the new subscription ID, so the Team subscription is never cancelled and keeps billing for the current period.Changes
PlansAndBillingTab: update in place whenever the subscription is active, trial or not. A trial started from Free is inactive and still goes through checkout.canUpgradeinBillingProviderandPlanCard: drop the blanket "trials can always upgrade" exception. It dates from when trials only existed on top of Free, where upgrading is a checkout and not rate limited; the!activecheck above it still covers that case. A trial on top of Team is now subject to the same 48-hour lock management enforces on in-place updates (starting the trial bumpsupdated_at), so the button is disabled with the usual tooltip instead of failing with a 412.Not affected
AWSChoosePlan: AWS subscriptions never reportremaining_trial, soisTrialis always false there.ErrAccountAlreadySubscribed).Follow-ups in management (separate PR)
checkoutSessionhas no equivalent of thatIsActive()guard, so other clients can still double-subscribe.updated_at, so a Team user who starts a Business trial must wait 48 hours before upgrading.Testing
Locally against cloud management with Stripe test mode: Team → start Business trial → upgrade to Business should update the existing subscription (one subscription on the Stripe customer), after the 48-hour lock.
Summary by CodeRabbit