[PM-37084] Business Aware Schedule Recovery and Cancellation#7686
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7686 +/- ##
==========================================
- Coverage 60.51% 60.50% -0.02%
==========================================
Files 2139 2140 +1
Lines 94608 94693 +85
Branches 8462 8472 +10
==========================================
+ Hits 57253 57291 +38
- Misses 35349 35391 +42
- Partials 2006 2011 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This review covers a refactor of price-increase scheduling and business-plan migration recovery: a new Code Review Details
|
| var cohort = await cohortRepository.GetByIdAsync(assignment.CohortId); | ||
| if (cohort?.MigrationPathId is null) return true; | ||
|
|
||
| var scheduled = await priceIncreaseScheduler.ScheduleBusinessPriceIncrease(subscription, cohort); | ||
| if (!scheduled) | ||
| { | ||
| return true; | ||
| } | ||
| var migrationPath = MigrationPaths.FromId(cohort.MigrationPathId.Value); | ||
| if (migrationPath is null) return true; | ||
|
|
There was a problem hiding this comment.
⛏ Seems like some logging would be useful for these null cases here, no? Otherwise, we might not see an email and not know why. I know it's unlikely given the scheduling succeeded, but just to have our bases covered.
| return false; | ||
| } | ||
|
|
||
| if (!IsTrackABusinessPlanType(organization.PlanType)) |
There was a problem hiding this comment.
❌ If we made this check more like this one: https://github.com/bitwarden/server/blob/billing/pm-37084/business-aware-schedule-recovery/src/Billing/Services/Implementations/UpcomingInvoiceHandler.cs#L235-L243, we wouldn't have to change it again when the next cohort is worked on. The cohort would act as the gate rather than these plan type checks.
|



🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-37084
📔 Objective
Introduces significant improvements and refactoring to the subscription price increase scheduling logic, particularly around business plan migrations and test clock handling. The changes centralize and streamline the scheduling of price increases, add new guard options, and improve testability and metadata handling. Below are the most important changes grouped by theme:
Business Plan Price Increase Scheduling Refactor:
ScheduleForSubscriptioninIPriceIncreaseSchedulerand its implementation, which centralizes the logic for scheduling deferred price increases based on subscription owner type, with optional guards via the newOrganizationPriceIncreaseOptionsrecord. This includes robust eligibility checks and error handling.UpcomingInvoiceHandlerto useScheduleForSubscription, and added logic to wait for Stripe test clocks to advance before proceeding, improving test reliability.Metadata and Feature Flag Handling:
MetadataKeysconstants, including a newCancellingUserIdkey, and improved feature flag checks for cancellation and migration flows inSubscriberService.Test Clock and Stripe Integration Improvements:
"customer.discount"instead of just"customer"), and added test clock handling to ensure correct sequencing in test environments.Scheduler Invocation and Release Consistency:
📸 Screenshots
Screen.Recording.2026-05-21.at.2.42.23.PM.mov