Skip to content

fix(wallet): a failed transfer's toast stays until it is closed - #1177

Merged
romchornyi merged 7 commits into
developfrom
fix/transfer-error-toast-stays
Oct 10, 2026
Merged

romchornyi merged 7 commits into
developfrom
fix/transfer-error-toast-stays

Conversation

@romchornyi

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

A failed internal transfer is announced by a toast that disappeared after 3 seconds. The failure reason is the one thing the history does not show, and 3 seconds was not enough to read it — on testnet the toast was gone before the user could see what went wrong.

What was done?

  • A failure toast no longer times out. It carries DashUIKit's close button and stays until the user closes it or the next transfer replaces it. Progress, success and "submitted" notices still time out as before.
  • The close tap clears only the notice it was drawn for, so a newer outcome is not swept away by a stale tap.
  • VoiceOver gets a named Close action on the toast: the DashUIKit revision pinned on develop draws the close glyph without a label, and for a failure it is the only way out.
  • The rule lives on InternalTransferRunner.Notice.isFailure; the notice docs describe the failure exemption.

Trade-off, deliberate: since a failure is closed only by hand, it also stays if the user switches wallet or network, or later completes the transfer through recovery, until they close it. Clearing it automatically on those events was tried and dropped — the wallet-change notification also fires on rebuilds of the same wallet, and recovery could clear an unrelated, still-true failure.

How Has This Been Tested?

  • dashpay scheme builds for the simulator (Xcode 27, iOS 26.5 SDK, arm64).
  • Still to check by hand: a failed transfer's toast stays until closed with ✕; "Transfer started" / "Transfer complete" still go away on their own. The failure that prompted this was an identity top-up reported as failed by a broadcast retry (AlreadyExists, platform#4998).
  • Five local review passes.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

jeanpierreroma and others added 6 commits October 1, 2026 14:45
The failure reason is the one thing the history does not show, and three
seconds was not enough to read it. Failure toasts now carry a close button
and no timer; progress and success notices still time out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The failure rule lives on the runner's Notice. A sticky failure is cleared
when a recovery of the pending lock succeeds and on a wallet or network
switch; the notice docs say what the code now does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clearing a failure on recovery or on wallet/network notifications retired the
wrong failure or a still-true one; the toast now stays until the user closes it
or the next transfer replaces it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lure; failures go unstamped

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tap clears only its own notice

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The DashUIKit pinned on develop draws the toast's close glyph without a label;
a named Close action on the toast gives VoiceOver the way out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

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 19 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

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0abbc9ba-8f57-4d01-a5ed-b7fa57884aa3

📥 Commits

Reviewing files that changed from the base of the PR and between 173a8f4 and b13f6a4.

📒 Files selected for processing (4)
  • DashWallet.xcodeproj/project.pbxproj
  • DashWallet/Sources/UI/Payments/InternalTransfer/Confirm/InternalTransferRunner.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/Confirm/InternalTransferToastModifier.swift
  • DashWalletTests/InternalTransferNoticeTests.swift
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@thepastaclaw

thepastaclaw commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ Final review complete — no blockers (commit b13f6a4) · triage: low

@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 failure exemption and dismissal callback match the PR's intended behavior, and no blocking defect was confirmed. Two nonblocking improvements remain: register the VoiceOver Close action only where it works, and add focused regression coverage for persistence, timer cancellation, and dismissal. Runtime accessibility behavior remains unverified; the installed Xcode 16.4 toolchain is older than the pinned DashUIKit package's Swift tools 6.3 requirement.

🟡 2 suggestion(s)

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

🟡 Suggestion: Add focused regression coverage for persistent failure notices
DashWallet/Sources/UI/Payments/InternalTransfer/Confirm/InternalTransferToastModifier.swift:61-78

The PR adds failure persistence and explicit dismissal without adding regression tests, and its description leaves the manual smoke check outstanding. Cover a started notice replaced by a failure before its timer expires, an old failure when Home reappears, normal expiration of non-failure notices, explicit failure dismissal, and a captured dismissal callback after a different notice replaces it. Exercise the production presentation rules through focused tests or a UI harness rather than duplicating those rules in a test-only implementation. Also verify the Close action with VoiceOver on a compatible simulator or device: the pinned DashUIKit close button is unlabeled, so the named action's discoverability matters to this flow. The documented test-target breakage makes this a nonblocking coverage suggestion, not a demand to repair unrelated test infrastructure.

source: glm-5.3-flash (phase1-reviewer: general); gpt-6.1-sol (phase2-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 UI notification lifecycle change affecting only transfer toast dismissal and failure-state handling, without changing funds movement, signing, networking, or persistence.
  • 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 73% left; passed over gemini-3.8-flash-high (antigravity below 15% reserve: weekly 13% left, 5h 100% left)
  • 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. Verify each finding against the current code and only fix it if needed.

In `DashWallet/Sources/UI/Payments/InternalTransfer/Confirm/InternalTransferToastModifier.swift`:
- [SUGGESTION] DashWallet/Sources/UI/Payments/InternalTransfer/Confirm/InternalTransferToastModifier.swift:52-54: Register the Close accessibility action only for failure notices
  The named Close action is attached unconditionally, but its handler dismisses only failures. For started, busy, succeeded, and submitted notices, the modifier therefore declares an accessibility action that does nothing when invoked. Automatic expiration does not make that advertised action functional. Apply the accessibility action only to failure toasts, matching the condition already used for onDismiss, so VoiceOver is not offered an ineffective Close control on other notices.
- [SUGGESTION] DashWallet/Sources/UI/Payments/InternalTransfer/Confirm/InternalTransferToastModifier.swift:61-78: Add focused regression coverage for persistent failure notices
  The PR adds failure persistence and explicit dismissal without adding regression tests, and its description leaves the manual smoke check outstanding. Cover a started notice replaced by a failure before its timer expires, an old failure when Home reappears, normal expiration of non-failure notices, explicit failure dismissal, and a captured dismissal callback after a different notice replaces it. Exercise the production presentation rules through focused tests or a UI harness rather than duplicating those rules in a test-only implementation. Also verify the Close action with VoiceOver on a compatible simulator or device: the pinned DashUIKit close button is unlabeled, so the named action's discoverability matters to this flow. The documented test-target breakage makes this a nonblocking coverage suggestion, not a demand to repair unrelated test infrastructure.

Comment on lines +52 to +54
.accessibilityAction(named: Text(NSLocalizedString("Close", comment: ""))) {
if notice.isFailure { dismiss(notice) }
}

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.

🟡 Suggestion: Register the Close accessibility action only for failure notices

The named Close action is attached unconditionally, but its handler dismisses only failures. For started, busy, succeeded, and submitted notices, the modifier therefore declares an accessibility action that does nothing when invoked. Automatic expiration does not make that advertised action functional. Apply the accessibility action only to failure toasts, matching the condition already used for onDismiss, so VoiceOver is not offered an ineffective Close control on other notices.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in b13f6a4 — the Close action is now registered through accessibilityActions only when the notice is a failure, the same condition as the close glyph.

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.

Resolved (re-reviewed at b13f6a40): Confirmed your fix in b13f6a4: accessibilityActions registers Close only inside the notice.isFailure condition, matching the close glyph's onDismiss condition. Non-failure notices no longer advertise an ineffective Close action.

… rules

The VoiceOver Close action was attached to every transfer toast, but only
a failure can be closed — on the others it did nothing. It is now
registered only for failures, the same condition as the close glyph.

The display-time and dismissal rules move out of the view onto
InternalTransferRunner (Notice.remainingDisplayTime, dismissal(of:clears:))
so the toast and InternalTransferNoticeTests exercise the same code:
failures have no timer, a notice seen late gets the rest of its window,
one whose window passed unseen expires at once, and a stale close leaves
a newer notice in place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@romchornyi

Copy link
Copy Markdown
Contributor Author

Regression coverage (the out-of-diff suggestion) is in b13f6a4: the display-time and dismissal rules moved from the view onto InternalTransferRunner (Notice.remainingDisplayTime, dismissal(of:clears:)), and the toast calls them, so the new InternalTransferNoticeTests exercise the production rules rather than a copy. Covered: failures have no timer (also when Home reappears much later), a fresh notice gets the full window, a notice seen late gets the rest of its window, one whose window passed unseen expires at once, a failure replacing "Transfer started" stops the countdown, and a stale close leaves a newer notice in place. 9/9 pass on an iOS 26.5 simulator. Not covered: the SwiftUI timer task itself and a VoiceOver pass on a device.

@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.

Re-review — Final validation — Phase 1 + Phase 2

Independently reviewed the complete base-to-head diff at b13f6a4, the runner's notice transitions, HomeView integration, test-target membership, and the pinned DashUIKit Toast implementation; no actionable in-scope defects were found. Both prior suggestions are fixed: Close accessibility actions are failure-only, and the new regression tests exercise the production timing and dismissal rules. Validation is static: the supplied exact-head CI snapshot passes accessibility, PR-title, and CodeRabbit checks but contains no build or XCTest results; SwiftUI timer lifecycle and device VoiceOver behavior remain unverified.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: gemini-3.8-flash-high (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: 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) — The diff is a small, contained change to transfer-toast persistence, stale-dismissal protection, and accessibility with focused tests, without changing funds movement or other critical surfaces.
  • Phase 1 reviewers: gemini-3.8-flash-high — general (completed, effort high); agent phase1-reviewer
  • Phase 1 model: gemini-3.8-flash-high — antigravity quota: weekly 42% left, 5h 32% left
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • 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, 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. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@llbartekll llbartekll left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. A failure is now the only notice without a timer. The stale-tap guard works because Notice is Equatable and the toast captures the notice it was drawn for. Moving the timing and dismissal rules onto InternalTransferRunner means the tests exercise production code and not a copy. I checked against the pinned DashUIKit (83cf65a): Toast(style:message:onDismiss:) exists and draws the close button only when onDismiss is set. "Close" already exists in en.lproj/Localizable.strings, so this adds no new string.

Two non-blocking notes are inline: the VoiceOver workaround will become redundant after the next DashUIKit bump, and one test checks less than its name says.

A third note, also non-blocking, extends the trade-off in the description. InternalTransferRunner.shared lives for the whole process, so an unclosed failure also survives a wallet wipe: the next wallet's Home would show the deleted wallet's failure. Before this PR, that notice would have expired as soon as Home reappeared. A wipe isn't ambiguous the way the wallet-change notification is, so clearing notice there would be safe if it ever matters. Not needed for this PR.

Reviewed statically at b13f6a40f (diff, runner and HomeView integration, DashUIKit Toast source). I didn't build it locally or check VoiceOver on a device.

style: style(for: notice),
message: message(for: notice),
onDismiss: notice.isFailure ? { dismiss(notice) } : nil)
// The pinned DashUIKit draws the close glyph unlabelled,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking: DashUIKit master already labels this button. dashpay/DashUIKit#18 (b5b765b) added .accessibilityLabel("Close") to the Toast close button. Package.resolved tracks master at 83cf65a, so the next package update will give VoiceOver both a labelled Close button and this Close action, and this comment will no longer be true. A TODO(dashuikit-pin): drop once the pin includes DashUIKit#18 here would make sure it gets removed with that bump.

}
}

func testFailureReplacingAStartedNoticeStopsTheCountdown() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: this test only re-checks two values that testFailureHasNoTimer and testFreshNoticeGetsTheWholeWindow already cover. What actually stops the countdown is .task(id: runner.notice) cancelling when the notice changes, and nothing here runs that. Consider renaming it to what it checks, or dropping it, so the coverage list doesn't claim more than it tests.

@romchornyi
romchornyi merged commit 310d873 into develop Oct 10, 2026
3 checks passed
@romchornyi
romchornyi deleted the fix/transfer-error-toast-stays branch October 10, 2026 19:31
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.

4 participants