Repository navigation
fix(customer): reject delete while a subscription has not ended - #5515
Conversation
Customer deletion only rejected subscriptions active now, so a scheduled subscription survived the delete and later started for a deleted customer. Both delete checks now cover every subscription that is not deleted and has no end or an end in the future.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Overview
Customer deletion only rejected subscriptions that were active at that moment. A scheduled subscription survived the delete and later started for a deleted customer.
Both delete checks now reject any subscription that is not deleted and has no end or an end in the future:
DeleteCustomertransaction uses a new adapter query,ListNotEndedSubscriptionIDs.activeSubscriptionFilteris unchanged, because customer expansions and the plan-key filter use it.ValidateDeleteCustomerlists subscriptions active from now onward instead of active at now.API-visible change: deleting a customer that has a scheduled subscription now fails. Both error messages now say "active or scheduled subscriptions". The error code
deleting_customer_with_active_subscriptionsis unchanged.Notes for reviewer
Createchecks the customer before its own transaction, and the delete takes no subscription lock.golangci-linton the changed packages.

Confidence Score: 5/5
The PR appears safe to merge within its stated scope.Summary
Customer deletion now rejects active or scheduled subscriptions until they end or are deleted.
Acknowledged scope exclusions from
tothandras: subscription creation racing with customer deletion remains deferred because creation checks the customer before its transaction and deletion takes no subscription lock. Billing cleanup for customers deleted before their subscriptions started will follow separately.Reviews (1) · Last reviewed commit: "fix(customer): reject delete while a sub..." · Reviewed by Greptile
Summary by CodeRabbit