fix(subscription): make billing account teardown retryable - #1844
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
rohilsurana
left a comment
There was a problem hiding this comment.
The teardown logic checks out: the early return syncs local state when the provider already canceled, and dropping SyncWithProvider is safe because deleting the Stripe customer later cancels anything still live on the provider. One edge case inline.
Also, no tests cover the new Cancel branch, which is the one piece of real logic in this stack. The concrete Stripe client makes unit tests hard here, so a short note in the PR on how this was verified against Stripe test mode would help.
DeleteByCustomer failed and could not be run again when the provider side was already gone: - a subscription already canceled on the provider now just syncs the local state instead of failing the cancel call - a subscription missing on the provider counts as canceled - offline accounts skip the provider entirely; only local records go - drop the SyncWithProvider call, which failed outright when the provider customer was already deleted Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
createOrGetSchedule returns no schedule for incomplete_expired subscriptions, so Cancel fell through to the provider cancel call, which Stripe rejects for that terminal status. Sync the local state instead, the same as for provider-canceled subscriptions. An incomplete subscription still goes through the real cancel, which Stripe allows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
76ff77c to
d2242b3
Compare
Coverage Report for CI Build 30970563182Coverage decreased (-0.003%) to 47.481%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions167 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
Part of #1835. Stacked on the kyc delete PR.
DeleteByCustomerfailed and could not be run again when the provider side was already gone. That mattered for org delete: after a halfway failure, the Stripe customer was deleted but local rows remained, and every retry died on the first provider call.Changes
SyncWithProvidercall, which failed outright when the provider customer was already deleted.🤖 Generated with Claude Code