Repository navigation
[PM-39805] fix: Expose SM migration-grace service accounts on subscription response - #7901
Conversation
…ption response Post-migration organizations overstated billable additional machine accounts: the subscription GET response carried no grace value, so the client computed additional = SmServiceAccounts - BaseServiceAccount without subtracting the permanently-free migration-grace allotment. Surface the grace count (already written to Stripe subscription metadata during migration and consumed on the write path) as a flat SmServiceAccountsGrace field on the organization subscription response, mapped from metadata via the existing GetMigrationGraceServiceAccounts extension. Null on self-host and no-gateway paths; left intact under hideSensitiveData since it is a non-sensitive count.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed this bugfix that surfaces the Secrets Manager migration-grace service-account count on the organization subscription response so clients can exclude permanently-free grace accounts from the billable additional-machine-accounts figure. The change reads the count from Stripe subscription metadata via No security, correctness, breaking-change, or performance concerns identified. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7901 +/- ##
==========================================
+ Coverage 61.28% 61.37% +0.08%
==========================================
Files 2226 2226
Lines 98296 98301 +5
Branches 8884 8886 +2
==========================================
+ Hits 60242 60330 +88
+ Misses 35934 35841 -93
- Partials 2120 2130 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-39805
📔 Objective
After a Teams Starter 2023 → Teams (Monthly) migration, the Secrets Manager subscription response priced the permanent migration-grace service accounts as billable. The web vault's "Additional machine accounts" field showed 55 (30 grace + 25 paid) at $55/month, while the billing summary and Stripe correctly billed 25 @ $25/month — two conflicting machine-account costs for the same subscription.
The grace allotment (e.g. 30 = source SM baseline 50 − target baseline 20) is written to Stripe subscription metadata as
migration_grace_service_accountsat migration, but was never surfaced on the subscription response, so the client could not exclude it.This PR exposes that count on the subscription/organization response via
SubscriptionInfo.ServiceAccountGrace(read throughSubscriptionExtensions.GetMigrationGraceServiceAccounts), letting the client subtract the free, permanent grace from the billable additional-machine-accounts figure. The field then reports 25 @ $1 = $25, matching the billing summary and Stripe.Unit tests added in
StripePaymentServiceTests(Core.Test) andOrganizationsControllerTests(Api.Test).