fix: check account exists before calling BillingService.delete_account#37551
Open
ifer47 wants to merge 1 commit into
Open
fix: check account exists before calling BillingService.delete_account#37551ifer47 wants to merge 1 commit into
ifer47 wants to merge 1 commit into
Conversation
The account existence check was placed after the billing service deletion call. If the account doesn't exist, the billing service would still have executed its deletion logic (which may be irreversible) before we discover the account is missing and bail out. Move the existence check before the billing service call so we return early without making any external changes when the account is not found. Co-Authored-By: zhipu/glm-5 <zai-org@claude-code-best.win>
Contributor
Pyrefly Type Coverage
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
delete_account_task, the account existence check was placed after the billing service deletion call. If the account doesn't exist,BillingService.delete_account()would have already been executed (which may make irreversible external changes) before the task discovers the account is missing and returns early.Before
After
Test plan
BillingService.delete_accountwith a non-existent account ID would have caused side effects (the current code path would have hit this in production for any stale Celery task retry)🤖 Generated with Claude Code Best