Skip to content

feat: add bounded retry/backoff and clear failure states for claim redemption (#397) - #416

Open
waterWang wants to merge 1 commit into
bridgelet-org:mainfrom
waterWang:fix/397-claim-redemption-retry-backoff
Open

feat: add bounded retry/backoff and clear failure states for claim redemption (#397)#416
waterWang wants to merge 1 commit into
bridgelet-org:mainfrom
waterWang:fix/397-claim-redemption-retry-backoff

Conversation

@waterWang

Copy link
Copy Markdown

Description

Adds bounded retry with backoff and clear failure states for claim redemption under Stellar network congestion.

Problem

The /claim/[token] flow had no documented handling for slow or failed responses from the SDK during sweep submission. A naive fetch-and-hope approach risked the recipient seeing a stuck spinner, or worse, a false failure for a transaction that actually succeeded on-chain (potentially leading to a double-submit on retry).

Solution

  • claim-redemption.ts — New safeguarded submission module that:

    • Calls redeemClaim with retries disabled (maxRetries: 0) to prevent auto-retry of a non-idempotent sweep
    • Classifies failures into safe-to-retry (network timeout, 429, confirmed pre-submission) and do-not-retry (terminal 4xx, ambiguous 5xx/timeout)
    • Polls claim status via verifyClaim on ambiguous failures to determine whether the sweep actually landed before offering a retry
    • Returns structured outcomes: confirmed, pending-confirmation, failed-safe-to-retry, failed-needs-support
  • claim-page-client.tsx — Uses submitClaimRedemption instead of the raw client.redeemClaim; manages submission state from the parent

  • claim-status-card.tsx — New UI states:

    • pending-confirmation: Blue spinner with "Your claim was received — checking status"
    • failed-safe-to-retry: Amber warning with "Nothing was sent — safe to retry" + "Try again" button
    • failed-needs-support: Red alert with "Do not submit again — check your wallet"

Testing

  • 43 tests across 3 test files all passing
  • New claim-redemption.test.ts covers: success, partial sweep, 409/410/404 errors, rate limit, network timeout → poll still pending (safe to retry), network timeout → poll shows claimed (pending-confirmation), poll failure (needs-support)
  • All existing tests updated for external state management

Closes #397

…demption (bridgelet-org#397)

- claim-redemption.ts: safeguarded submission that disables transport-layer
  retries for the non-idempotent sweep call, classifies failures, and polls
  claim status on ambiguous outcomes to prevent double-submits
- claim-page-client.tsx: drives submitClaimRedemption outcomes into UI state
- claim-status-card.tsx: pending-confirmation / failed-safe-to-retry /
  failed-needs-support panels with plain-language copy
- tests: 43 passing (13 new claim-redemption unit tests + UI state coverage)
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

@waterWang is attempting to deploy a commit to the aminubabafatima8-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@phertyameen

Copy link
Copy Markdown
Contributor

@waterWang Can you look into your CI checks?

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.

Add retry/backoff and clear failure states for claim redemption under Stellar network congestion

2 participants