Skip to content

Make claim/fund/deposit flows idempotent and resilient to interruption #6

Closed

Description

@chonilius

Problem

src/app/issues/[id]/IssueActions.tsx and src/app/milestones/MilestoneActions.tsx are Client Components that presumably orchestrate the multi-step flow of "call backend to build an unsigned XDR transaction → prompt Freighter to sign → submit signed transaction back to backend → poll/await confirmation → update UI." Nowhere in the currently visible architecture is there evidence of idempotency keys, optimistic-UI rollback, or handling for the user closing the Freighter popup, the tab being closed mid-flow, or the backend accepting the signed transaction but the Stellar network taking longer than the component's lifetime to confirm it. A contributor who double-clicks "claim," or whose Freighter popup times out and they retry, risks either a duplicate escrow-affecting call to the backend or a UI stuck permanently in a loading state with no recovery path other than a full page reload — which itself risks losing track of whether the first attempt actually succeeded.

Why this is hard

  • You need to actually trace the current claim/fund/deposit flow end to end in IssueActions.tsx and MilestoneActions.tsx to identify every point where a network call, wallet popup, or state transition can be interrupted, since none of this is documented and the flow spans client state, apiRequest calls, and signTransaction.
  • Idempotency needs backend cooperation (an idempotency key header the backend deduplicates on) — this is a cross-repo concern; you'll need to design the frontend contract (generate and persist a UUID per claim attempt, resend on retry) and file/coordinate the corresponding backend requirement, while making the frontend degrade sensibly if the backend doesn't yet support it.
  • Recovering from "tab closed mid-flow": on remount, the component has no persisted record of an in-flight claim. You need a durable (localStorage/sessionStorage keyed by bounty id) record of "attempt in progress since T" that the component checks on mount and reconciles against the backend's actual bounty status rather than assuming success or failure.
  • Distinguish and handle each interruption point differently: user rejects the Freighter prompt (safe, just reset), Freighter popup times out (ambiguous — must re-check backend state before allowing retry), backend accepts signed XDR but Stellar network confirmation is slow (must poll, not just assume success), backend call itself fails after wallet already signed (the signed transaction may or may not have been submitted — must not silently discard a valid signed transaction).

Scope

  • Map and document the current claim and fund/deposit flows in the PR description.
  • Add a persisted per-action attempt record (bounty/milestone id, timestamp, client-generated idempotency key) with reconciliation on mount.
  • Add idempotency key generation and attach it to the relevant apiPost calls; document the backend requirement if not already supported.
  • Add distinct recovery UI for each interruption scenario above instead of one generic loading/error state.
  • Add a bounded poll-for-confirmation step after signed-transaction submission instead of assuming immediate success.

Acceptance criteria

  • Simulate each interruption point (mock Freighter rejection, mock slow/failed backend call after signing, simulate remount mid-flow) and confirm no duplicate submission and correct recovery UI.

Activity

  1. added
    very hard
    bug
    architecture
    on Jul 15, 2026
  2. added
    GrantFox OSS
    Maybe Rewarded
    Official Campaign | FWC26
    on Jul 15, 2026
  3. added
    Stellar Wave
    on Aug 25, 2026
  4. stephaniepez21-art commented on Aug 25, 2026

    @stephaniepez21-art

    @stephaniepez21-art has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    hello maintainer ill love to work on this pls assign.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @stephaniepez21-art to this issue.

  5. Morrison26-gif commented on Aug 25, 2026

    @Morrison26-gif

    @Morrison26-gif has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi Maintainer, I’ve looked over the requirements and acceptance criteria and believe I can implement a solution that aligns with what’s expected. Kindly consider assigning it to me.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Morrison26-gif to this issue.

  6. luciachizaram commented on Aug 25, 2026

    @luciachizaram
    Contributor

    @luciachizaram has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Please assign this issue to me

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @luciachizaram to this issue.

  7. drips-wave commented on Aug 25, 2026

    @drips-wave

    Congratulations, @luciachizaram! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @luciachizaram: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  8. added 2 commits that reference this issue on Aug 25, 2026
    64586c8
    8c25540
  9. drips-wave commented on Aug 25, 2026

    @drips-wave

    This issue has been completed by @luciachizaram as part of the Stellar Wave Program's 8th Wave 🥳

    😎 @luciachizaram: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  10. removed
    Stellar Wave
    on Oct 15, 2026
  11. added
    Stellar Wave
    on Oct 15, 2026
  12. removed
    Stellar Wave
    on Oct 15, 2026
  13. added
    Stellar Wave
    on Oct 15, 2026
  14. removed
    Stellar Wave
    on Oct 15, 2026
  15. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSMaybe RewardedOfficial Campaign | FWC26Stellar Wavearchitecturebugvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions