fix(kyc): treat a completed DFX_APPROVAL winner as a no-op in the race recovery#4369
Draft
Danswar wants to merge 1 commit into
Draft
fix(kyc): treat a completed DFX_APPROVAL winner as a no-op in the race recovery#4369Danswar wants to merge 1 commit into
Danswar wants to merge 1 commit into
Conversation
…e recovery checkDfxApproval's duplicate-key recovery adopted an OnHold winner and no-opped on an InReview winner, but a winner that auto-completed via the kycLevel >= LEVEL_50 branch in initiateStep fell through to rethrow the original error even though the concurrent insert had actually succeeded.
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.
Problem
Follow-up to #4296 (review comment).
checkDfxApproval's duplicate-key recovery adopts a concurrent winner that isisOnHold(promotes it to manual review) or no-ops on a winner that isisInReview. It did not account for a winner whoseDFX_APPROVALstep auto-completed via thekycLevel >= LEVEL_50branch ininitiateStep— that case fell through tothrow e, surfacing the raw duplicate-key error to the loser even though the concurrent insert had actually succeeded.Fix
Treat
winner?.isCompletedthe same aswinner?.isInReview: the winner already advanced pastOnHold, so there's nothing left for the loser to do.Tests
Added a unit test in
kyc.service.spec.tscovering the completed-winner path (winner notOnHold, notInReview, butisCompleted), asserting a clean no-op with no further repo writes.