Skip to content

fix(dashpay): resync before failing an accept whose request isn't in memory#829

Merged
QuantumExplorer merged 1 commit into
swift-sdk-integrationfrom
fix/accept-contact-request-resync
Jul 16, 2026
Merged

fix(dashpay): resync before failing an accept whose request isn't in memory#829
QuantumExplorer merged 1 commit into
swift-sdk-integrationfrom
fix/accept-contact-request-resync

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Summary

Accepting a pending contact request could fail with "Contact request not found" for a perfectly real request (QA repro: tap Accept on a pending row shortly after launch).

Root cause: the pending rows the Contacts screen renders come from SwiftData, which persists across sessions — but acceptContactRequest resolves the live ContactRequest handle from the SDK's in-memory state, which is per-session and only populated by a DashPay sync pass (15s background loop / explicit syncNow). Tapping Accept before this session's first pass lands → in-memory miss → bogus error.

Fix: on a miss, run one dashPaySyncNow pass and retry the lookup; only a miss after a fresh pass throws requestNotFound (genuinely revoked/consumed). The lookup is factored into a helper so both attempts share the exact same read.

Test plan

  • Clean dashpay simulator build (arm64); installed on QA-iPhone16
  • Fresh launch with a persisted pending request → Accept succeeds (resync path, "resyncing before accept" in the CONTACTS log category)
  • Accept of a request revoked on-chain still errors after the resync

🤖 Generated with Claude Code

…memory

Accepting a pending contact request resolved the live ContactRequest
handle from the SDK's in-memory state, which is per-session — but the
pending row the UI renders comes from SwiftData, which persists across
sessions. Tap Accept before this session's first DashPay sync pass has
repopulated the in-memory list (fresh launch, or the 15s background
loop hasn't landed yet) and the lookup missed, surfacing the bogus
"Contact request not found" error for a perfectly real request.

On a miss, run a dashPaySyncNow pass and retry the lookup once; only a
miss after a fresh pass is a genuinely revoked/consumed request.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ca2c2a7d-2195-4ab1-838d-06d7ca10061e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/accept-contact-request-resync

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@QuantumExplorer
QuantumExplorer merged commit 64fd42f into swift-sdk-integration Jul 16, 2026
2 checks passed
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