Repository navigation
[PM-39816] fix: Raise migrated Password Manager seats to cover Secrets Manager seats - #7904
Conversation
…s Manager seats The Teams Starter migration recomputed Password Manager seats from occupied members while passing Secrets Manager seats through untouched, so an org with more SM seats than occupied members migrated into SM > PM, violating the current Teams invariant SM <= PM. Floor the billed/persisted PM seat count on the SM seats at the three migration seat-count sites so the migration completes with PM >= SM. The clamp gates on the shared packaged-source path, so it also covers the Teams 2019 -> current migration, which lands on the same target and hits the same invariant via the same latent reconcile bug. Tests lock in the behavior for both Teams Starter PlanTypes (21, 16) and Teams 2019. Stripe-facing sites (Phase-2 schedule, renewal email) floor on the surviving Stripe SM seat line quantity (the exact billed value); the cycle-time DB reconcile floors Organization.Seats on Organization.SmSeats. A drift warning in the scheduler surfaces any DB<->Stripe SM divergence. Gated by the existing PM35215_BusinessPlanPriceMigration flag.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the Teams Starter / Teams 2019 → current Teams migration bugfix that raises the migrated Password Manager seat count to cover Secrets Manager seats (enforcing the SM ≤ PM invariant) at all three migration sites: the Phase-2 Stripe schedule ( Code Review DetailsNo findings. The three seat-count sites bind SM to the correct domain source (Stripe line for the billing-facing sites, |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7904 +/- ##
=======================================
Coverage 61.28% 61.28%
=======================================
Files 2226 2226
Lines 98296 98313 +17
Branches 8884 8889 +5
=======================================
+ Hits 60241 60255 +14
+ Misses 35935 35934 -1
- Partials 2120 2124 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|



🎟️ Tracking
PM-39816 — QA bug under parent PM-37512 (Support migration of Teams Starter), epic PM-37496.
📔 Objective
The Teams Starter → current Teams migration recomputed the Password Manager (PM) seat count from occupied members (floored at 1) while passing the Secrets Manager (SM) seat count through untouched. When an org held more SM seats than occupied PM members, the migration produced SM seats > PM seats, violating the current Teams invariant that SM ≤ PM.
This raises the billed/persisted PM seat count to cover SM at the three migration seat-count sites, so the migration completes (never aborts) with PM ≥ SM:
PriceIncreaseScheduler)SubscriptionUpdatedHandler)UpcomingInvoiceHandler)The SM source is bound per domain: the Stripe-facing sites (Stage 1, renewal email) floor PM on the surviving Stripe SM seat line quantity (the exact billed value); the DB reconcile floors
Organization.SeatsonOrganization.SmSeats. The two agree in normal operation; binding each site to its own domain keeps both the Stripe and DB invariants correct under DB↔Stripe drift, and a drift warning in Stage 1 surfaces any divergence.The clamp lives on the shared packaged-source path, so it also covers the Teams 2019 → current migration (same target plan, same latent reconcile bug). Tests lock in both Teams Starter PlanTypes (21, 16) and Teams 2019.
Server-only, webhook-driven, gated by the existing
PM35215_BusinessPlanPriceMigrationflag — purely additive (orgs without SM seats are unaffected). Preventive: a data-warehouse check found 0 production orgs currently in the SM > PM state.Tests: unit coverage proving PM ≥ SM after migration at all three sites for both Teams Starter PlanTypes and Teams 2019, plus the SM-with-zero-occupied edge and the DB-below-Stripe-line drift case.