Repository navigation
fix(cash-link): show "Already collected" when a claim loses the race at submit - #1675
Merged
Merged
Conversation
…at submit When several people claim the same cash link, the account query can still return CLAIM_STATE_NOT_CLAIMED after another claim has been accepted, so the pre-claim checks pass and SubmitIntent rejects with STALE_STATE. One Bugsnag event (6ab9844f) shows the query returning NOT_CLAIMED 17 ms before the rejection. ReceiveGiftCardTransactor passed that StaleState through, and CashLinkDelegate only matches ReceiveGiftTransactorError, so the user saw "Failed to collect". Map the "already claimed" and "expired" StaleState reasons to AlreadyClaimed and Expired, the errors the pre-claim checks already return. Other StaleState reasons still go through logAndFail.
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.
Bugsnag 6ab9844f396a2e95206cba57:
SubmitIntentError$StaleState: gift card balance has already been claimed, 108 events from 12 users, mostly on 2026.9.4.When several people claim the same cash link, the losers can get past the pre-claim checks and are rejected at submit. In one event,
GetTokenAccountInfosreturnedCLAIM_STATE_NOT_CLAIMEDwith the balance still on the card at 12:23:40.953, and the submit at 40.970 was rejected as already claimed. The client had nothing newer to check against.ReceiveGiftCardTransactorpassed thatStaleStatestraight through.CashLinkDelegateonly matchesReceiveGiftTransactorErrorsubtypes, so these users saw "Failed to collect" instead of "Already collected".ReceiveGiftCardTransactor: map the "already claimed" and "expired"StaleStatereasons toAlreadyClaimedandExpired, the errors the pre-claim checks already return. OtherStaleStatereasons still go throughlogAndFail.AlreadyClaimed, plus cases forExpiredand for other reasons passing through.CashLinkDelegateTestchecks thatAlreadyClaimedshows the "Already collected" alert.The
StaleStateis still reported to Bugsnag at info level byInternalTransactionRepository, so the race stays countable.