Skip to content

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
developfrom
fix/kyc-approval-completed-winner-noop
Draft

fix(kyc): treat a completed DFX_APPROVAL winner as a no-op in the race recovery#4369
Danswar wants to merge 1 commit into
developfrom
fix/kyc-approval-completed-winner-noop

Conversation

@Danswar

@Danswar Danswar commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

Follow-up to #4296 (review comment).

checkDfxApproval's duplicate-key recovery adopts a concurrent winner that is isOnHold (promotes it to manual review) or no-ops on a winner that is isInReview. It did not account for a winner whose DFX_APPROVAL step auto-completed via the kycLevel >= LEVEL_50 branch in initiateStep — that case fell through to throw e, surfacing the raw duplicate-key error to the loser even though the concurrent insert had actually succeeded.

Fix

Treat winner?.isCompleted the same as winner?.isInReview: the winner already advanced past OnHold, so there's nothing left for the loser to do.

Tests

Added a unit test in kyc.service.spec.ts covering the completed-winner path (winner not OnHold, not InReview, but isCompleted), asserting a clean no-op with no further repo writes.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant