Skip to content

fix: make transfer lifecycle transitions concurrency-safe - #137

Open
tokenjunkielabs wants to merge 6 commits into
RemitFlow:mainfrom
tokenjunkielabs:main
Open

tokenjunkielabs wants to merge 6 commits into
RemitFlow:mainfrom
tokenjunkielabs:main

Conversation

@tokenjunkielabs

Copy link
Copy Markdown

Fixes #133.

This makes terminal transfer mutations concurrency-safe within the backend's current store boundary and gives clients an explicit optimistic-concurrency contract.

What changed

  • transfers now carry a monotonically increasing resource version;
  • single-transfer responses expose that version as a strong ETag;
  • claim/cancel require If-Match plus the existing Idempotency-Key convention;
  • lifecycle mutation checks expected version + allowed transition before provider work, re-checks immediately before commit, and returns explicit 409 conflict details on stale state;
  • terminal claim/cancel operations have a separate actor-scoped replay ledger so retries replay the first terminal result;
  • mock Stellar settlement/claimable-balance adapters accept stable operation keys and return the same provider artifact on retry;
  • provider failure occurs before terminal state commit and releases the reservation, preserving safe retry;
  • archive/unarchive advance the same resource version so a stale terminal mutation cannot silently commit after another mutation;
  • added focused regression source for race, duplicate callback, worker-module reload, rollback/retry, and one-terminal-outcome behavior;
  • documented the HTTP/storage concurrency contract and the required durable CAS boundary for a future database-backed store.

Claimant fork head: 373c6fb23d130df6f754ba7ad850c105e9ab0d94.

@tokenjunkielabs

Copy link
Copy Markdown
Author

Maintainer review requested for claimant-owned bounty carrier fixing #133. This PR is OPEN and GitHub currently reports it mergeable at exact head 373c6fb23d130df6f754ba7ad850c105e9ab0d94. Claimant-side payout setup is complete. Please merge if the concurrency-safe transfer lifecycle implementation meets #133, or leave concrete change requests here; on acceptance, please complete the bounty award/payment path tied to the issue.

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.

fix(backend): make transfer lifecycle transitions concurrency-safe

1 participant