Skip to content

fix(explore-dash): report a DashSpend payment the merchant acknowledged before it failed as in progress - #1408

Open
romchornyi wants to merge 1 commit into
feat/external-send-servicesfrom
fix/dashspend-acked-payment
Open

romchornyi wants to merge 1 commit into
feat/external-send-servicesfrom
fix/dashspend-acked-payment

Conversation

@romchornyi

@romchornyi romchornyi commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

After #1407, a BIP70 payment whose request expired, or whose broadcast failed, after the merchant had already acknowledged the Payment is reported as BIP70Error.failedAfterAcknowledgement. SendCoinsService.payWithDashUrl did not map it, so DashSpend showed a plain error without the txid while the merchant may still fulfil the order.

What was done?

  • failedAfterAcknowledgement maps to DashSpendError.paymentStatusUnknown with its txid — the same handling broadcastOutcomeUnknown already gets: DashSpend records the purchase against the txid and shows it in progress.
  • SendCoinsService takes its BIP70PaymentService through an injectable factory (default unchanged) so the mapping is tested.

Stacked on #1407.

Stack

This replaces the single PR #1358 (+21k lines), split by layer so each part can be reviewed and merged on its own. Merge in order:

# PR What
0 #1405 chore(l10n): drop unused keys and sort the catalogs as BartyCrouch writes them (keeps the diffs below clean)
1 #1406 Domain: destinations, the parser, the pair policy, amount rules, send outcomes — pure logic, no UI
2 #1407 Services: the send executor over the existing spend seams, fee estimates, identity lookup, asset-lock recovery, BIP70 checks
3 #1408 DashSpend: a payment the merchant acknowledged before it failed is shown as in progress
4 #1409 The new Send screens and entry points
5 #1358 Routes that need the open dashpay/platform PRs (#5860, #5863, #5865) and the pin bump

How Has This Been Tested?

  • PaymentProtocolTests.testPayWithDashUrlReportsAFailureAfterTheAcknowledgementAsInProgressWithTheTxid; full suite 2587 tests, 0 failures, 1 skipped
  • By hand needs a merchant that acknowledges and then a failing broadcast — not reproducible on demand

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved error reporting for BIP70 payments that fail after being sent. The app now indicates that the payment status is unknown and includes the transaction reference, rather than presenting the failure as a definitive payment rejection.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f487675e-b85f-4a34-aadc-50fc067d8e2c
Commits

Reviewing files that changed from the base of the PR and between ea8976d and 1d37be1.

Files selected for processing: 2

  • DashWallet/Sources/Models/Transactions/SendCoinsService.swift
  • DashWalletTests/PaymentProtocolTests.swift

No actionable comments were generated in the recent review.

Walkthrough

SendCoinsService now accepts an injectable BIP70 service factory. When a payment fails after acknowledgement, payWithDashUrl throws paymentStatusUnknown with the reversed display hash and failure reason.

Changes: BIP70 Payment Failure

Layer / File(s) Summary
Factory injection and failure mapping
DashWallet/Sources/Models/Transactions/SendCoinsService.swift, DashWalletTests/PaymentProtocolTests.swift
SendCoinsService uses an injectable factory that defaults to BIP70PaymentService.makeForCurrentWallet. The Dash URL payment path maps failedAfterAcknowledgement to paymentStatusUnknown. The integration test checks the reversed transaction hash and confirms the wallet calls build and then broadcast.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: llbartekll, jeanpierreroma

Merge Risk: Minimal · previous review a4ec0

This change makes a DashSpend payment that the merchant acknowledged before it failed show as in progress with its transaction ID, instead of a plain error. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a DashSpend payment that the merchant acknowledged before failing is now reported as in progress. The change maps BIP70Error.failedAfterAcknowledgement to DashSpendErr…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a DashSpend payment that the merchant acknowledged before failing is now reported as in progress. The change maps BIP70Error.failedAfterAcknowledgement to DashSpendError.paymentStatusUnknown with the txid in SendCoinsService.payWithDashUrl. The raw summary confirms this mapping, the injectable BIP70 factory, and the matching test. The title is specific and accurate, and it stays within the fix(explore-dash) scope.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4db9621d-489f-4c84-86aa-cdbe147e399a
Commits

Reviewing files that changed from the base of the PR and between 610e22d and a4ec0bf.

Files selected for processing: 2

  • DashWallet/Sources/Models/Transactions/SendCoinsService.swift
  • DashWalletTests/PaymentProtocolTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@thepastaclaw

thepastaclaw commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

♻️ No change to this PR's diff since commit ee6d07f (an empty commit, a merge of the base or a rebase onto it): that review stands — approved; @thepastaclaw review asks for a review of this commit (commit 1d37be1)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

The implementation correctly maps BIP70 failures after merchant acknowledgement into the existing in-progress DashSpend state and preserves the wire-order transaction ID. Two non-blocking issues remain: the PR title fails the repository's allowed-scope check, and comments now overstate that every payment-status-unknown case was broadcast. The legacy interactive BIP70 path has a related pre-existing gap, but it is outside this DashSpend-focused diff and should be handled separately.

🟡 1 suggestion(s) | 💬 1 nitpick(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

2 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: PR title uses a scope rejected by the semantic-title workflow
.github/workflows/semantic-pull-request.yml:41-54

The exact head fails both Validate PR title checks because the PR title uses fix(dashspend):, while the workflow allows explore-dash but not dashspend. Retitle the PR using an existing allowed scope, such as fix(explore-dash):, so the required title check can pass. This is a PR metadata issue rather than a code defect.

source: glm-5.3-flash (phase1-reviewer: general)

💬 Nitpick: paymentStatusUnknown documentation excludes the new acknowledged-but-unbroadcast case
DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendError.swift:38-41

The new SendCoinsService catch arm maps failedAfterAcknowledgement to paymentStatusUnknown, but that error can be raised when the request expires after acknowledgement and before the wallet broadcasts, particularly because the DashSpend flow calls payWithDashUrl(..., awaitAcceptance: false). The case comment therefore incorrectly says the payment was broadcast. The corresponding DashSpendPayViewModel comment at lines 356–358 also says the payment left the device, which is not true for the expiry-after-acknowledgement path. Update both comments to describe the shared invariant: the merchant holds the signed transaction, while the wallet's broadcast/acceptance outcome is unknown.

source: glm-5.3-flash (phase1-reviewer: general)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: low by gpt-6.1-sol (effort low) — This is a small, well-contained mapping change in SendCoinsService with focused unit-test coverage and no changes to payment execution, funds movement, cryptography, or storage.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 99% left, weekly 57% left; passed over gemini-3.8-flash-high (antigravity quota lookup failed)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `.github/workflows/semantic-pull-request.yml`:
- [SUGGESTION] .github/workflows/semantic-pull-request.yml:41-54: PR title uses a scope rejected by the semantic-title workflow
  The exact head fails both `Validate PR title` checks because the PR title uses `fix(dashspend):`, while the workflow allows `explore-dash` but not `dashspend`. Retitle the PR using an existing allowed scope, such as `fix(explore-dash):`, so the required title check can pass. This is a PR metadata issue rather than a code defect.

In `DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendError.swift`:
- [NITPICK] DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendError.swift:38-41: paymentStatusUnknown documentation excludes the new acknowledged-but-unbroadcast case
  The new `SendCoinsService` catch arm maps `failedAfterAcknowledgement` to `paymentStatusUnknown`, but that error can be raised when the request expires after acknowledgement and before the wallet broadcasts, particularly because the DashSpend flow calls `payWithDashUrl(..., awaitAcceptance: false)`. The case comment therefore incorrectly says the payment was broadcast. The corresponding `DashSpendPayViewModel` comment at lines 356–358 also says the payment left the device, which is not true for the expiry-after-acknowledgement path. Update both comments to describe the shared invariant: the merchant holds the signed transaction, while the wallet's broadcast/acceptance outcome is unknown.
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Legacy interactive BIP70 flow still flattens acknowledged failures — BIP70InteractiveCoordinator converts failedAfterAcknowledgement into a generic NSError, and DWPaymentProcessor presents it as a plain payment error without recording or surfacing the transaction ID. This is a real adjacent payment-flow gap, but the coordinator and Objective-C interactive path are unchanged by this DashSpend-specific fix and the error-producing behavior comes from the stacked service change. It should not block this PR.
    • Follow-up: A follow-up PR should update the legacy interactive BIP70 coordinator and delegate flow to preserve the acknowledged transaction ID, record the pending payment, and present an in-progress result for failedAfterAcknowledgement.

@romchornyi
romchornyi force-pushed the fix/dashspend-acked-payment branch from ee6d07f to db9f501 Compare November 13, 2026 13:40
@romchornyi romchornyi changed the title fix(dashspend): report a payment the merchant acknowledged before it failed as in progress fix(explore-dash): report a DashSpend payment the merchant acknowledged before it failed as in progress Nov 13, 2026
@romchornyi
romchornyi force-pushed the fix/dashspend-acked-payment branch from db9f501 to d17c09b Compare November 13, 2026 16:19
@romchornyi
romchornyi force-pushed the fix/dashspend-acked-payment branch from d17c09b to 4df936f Compare November 13, 2026 19:06
@romchornyi
romchornyi force-pushed the fix/dashspend-acked-payment branch 2 times, most recently from e86a8bb to 403e169 Compare November 14, 2026 01:35
@romchornyi
romchornyi force-pushed the fix/dashspend-acked-payment branch 2 times, most recently from e0ac376 to a4ec0bf Compare November 15, 2026 22:39
@romchornyi
romchornyi force-pushed the fix/dashspend-acked-payment branch from a4ec0bf to f7d4443 Compare November 16, 2026 00:16
@romchornyi
romchornyi force-pushed the fix/dashspend-acked-payment branch 2 times, most recently from 23cdb94 to ea8976d Compare November 16, 2026 14:07
…failed as in progress

A gift-card payment whose Payment the merchant acknowledged, and whose broadcast
then failed or whose request then expired, reached DashSpend as a plain error
without the txid, while the merchant holds the signed bytes and may fulfil the
order. payWithDashUrl now maps it to the same in-progress error as an unknown
broadcast outcome, carrying the txid, so the purchase is recorded and the card
details screen opens. The BIP70 service it pays through can be injected, so the
mapping is tested against a fake wallet and merchant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: 5d5b668099682851d541bb92b75d2c6c0a8d87ca
@romchornyi
romchornyi force-pushed the fix/dashspend-acked-payment branch from ea8976d to 1d37be1 Compare November 16, 2026 15:04

This branch has not been deployed

No deployments
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.

2 participants