Skip to content

fix(dashdex): show a plain message when the coin list fails to load - #1375

Merged
romchornyi merged 15 commits into
developfrom
fix/select-coin-error-copy
Nov 12, 2026
Merged

romchornyi merged 15 commits into
developfrom
fix/select-coin-error-copy

Conversation

@romchornyi

@romchornyi romchornyi commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Fixes #1371. When the Dash DEX coin list fails to load, Select coin shows the error's localizedDescription. For a non-2xx answer that is the HTTP client's response description, so the user sees "Status Code: 403, Data Length: 4545" with an empty "Error:" line under it. This was seen on a TestFlight build when the edge in front of the SwapKit API refused /swapTo with an HTML page; any other load failure (timeout, 5xx, decoding) reaches the user the same way.

Stacked on #1297, which changes the same catch in SelectCoinViewModel.loadCoins. Retarget to develop once #1297 merges.

What was done?

  • SelectCoinViewModel.loadCoins now puts loadFailedMessage in errorMessage on any load failure: "Couldn't load the coin list. Please try again, or try a different network." Retry stays below it. The failure detail (status, path, HTML title or JSON excerpt) still goes to the app log through SwapKitFailureDetail from fix(dashdex): show which provider can swap each coin right now #1297.
  • Offline is unchanged: the load does not start and the "No internet connection" toast shows.
  • One new localization key, added to all 43 catalogs with the English text.
Before (#1297 head) After

Captured on the iPhone 17 simulator (Debug, mainnet) with an invalid SwapKit key, so /swapTo answers 401 — the same failure path as the 403 seen on TestFlight.

How Has This Been Tested?

  • New SelectCoinViewModelTests.testAFailedLoadShowsAPlainMessage: a pool fetch that fails with a "Status Code: 403, …" error leaves the plain message, not the HTTP text. It failed before the change and passes after it.
  • Every swap suite (SwapRouteAvailabilityTests, SwapKitQuoteDecodingTests, SwapKitQuoteBoundaryTests, SwapKitErrorCopyTests, SwapKitFailureDetailTests, SwapAddressValidatorTests, SelectCoinViewModelTests, BuySwapOrderTests), 199 tests, pass on the iPhone 17 simulator (dashwallet-dashpay, Debug). SwiftLint reports no new findings on the changed Swift files; the accessibility check is clean.
  • No Maestro flow: the screen only reaches this state when the swap service refuses or fails the coin list request, which a flow cannot force without depending on live network state, and offline the load is skipped. Manual check: put an invalid API_KEY in the local SwapKit-Info.plist (or map /swapTo to a 403 in a proxy), open Dash DEX → Sell → Select coin, and expect the message above with Retry; this is how the captures above were made.

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
  • ADR (ADR-0001): not needed: N3
  • Nothing in this PR (files, commit messages, branch name, description, comments, attachments, linked issues) holds customer data, unfixed vulnerability detail, secrets, or step-by-step attack detail against keys, PIN or encryption; such content is left out and handled privately with the maintainers (ADR-0001, rule 2)

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone
  • If workflow-lint warned that a release-only step or .xcode-version changed, or a .platform-ref bump changed platform's Rust version, I ran the affected workflow by hand from this branch on the final commit (release-dashpay-testflight.yml with wallet_ref = that commit and release_channel: internal-only; appstore-schema-release.yml with dry_run: true) and linked the run here; a later push needs a new run

🤖 Generated with Claude Code

romchornyi and others added 13 commits November 2, 2026 21:48
The coin picker labelled and offered coins from SwapKit's static
/tokens lists, so a coin stayed selectable while neither NEAR nor Maya
could route it, and the address screen then reported a 404
noRoutesFound as a connection problem.

Probe each coin with a quote forced to one provider (about $50 of the
sold asset, at most two requests in flight, cached): NEAR is checked on
sentinel coins first and treated as down for every coin when they have
no route; Maya is checked per coin. Both usable -> "Multiple", one ->
that provider, none -> the existing halted row. Buy is included.

The address screen reads the error body: a refused address keeps the
address copy, a missing route is re-checked without the address, and
only a transport failure says "check your connection".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: b74eae0efdd70d3ee1a0a80343f3a5dfc106651a
…hecks

SDD-Published-From: ed9c59385523bdfdc167485480c5aced6e69ce52
…ecovery

PR feedback round 10:
- Re-check a no-route on the address screen at the address quote's amount
  without the address; a below-minimum there lets the holder continue
  instead of blaming the address (thread 4483087473).
- A probe that returns after its coin got a newer answer no longer
  overwrites it (thread 4483087481).
- When NEAR recovers, the other sentinels' no-routes from the outage are
  dropped so their coins are checked in the same refresh; a no-route from
  the recovery round itself is kept (thread 4483087490).
- Tests for the re-check wiring, the stale probe and the recovery; ADR-0008
  updated.

SDD-Published-From: 6b816f1cd4a6a5863876e92346a3e486174c9838
…nswers

- The address check counts a refusal only from a provider the quote asked
  for, so an unrequested provider's error cannot block a valid address.
- The NEAR sentinel round reads the answers stored since it started, both
  to decide when to stop and for the verdict, so an older probe answer
  overtaken by a newer one (e.g. from the address quote) no longer
  declares NEAR down, and a no-route overtaken by a halt makes the round
  ask the third sentinel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: 9f2cf3bb437c434f74a7e704a00b72a71abbb30e
Develop took ADR-0006 for the App Connect decision and an open PR takes
0009, so the live-route ADRs move to 0010 (probes), 0011 (store) and 0012
(sentinels), per ADR-0001 rule 3. The decision index keeps develop's 0006
row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: 661ec85865014cb4590d9232a8f961da2d643585
Develop regenerated the string catalogs, so the swap service message is
added to them again in their new order. The decision index keeps
develop's 0009 row above the swap ADRs 0010-0012.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: f1c510a3c7d0c8acb65c7f38c7132b9f0f6b8b85
Review: a NEAR "down" verdict took its boundary from the clock when the
sentinel round finished, so a coin's route recorded while the round was
still asking was hidden as "no route". The verdict now keeps the
sequence at the start of the round that first found the outage; a
coin's answer asked or recorded after it wins, one from before it does
not. Spec wording, ADR-0012 and tests pin both sides.

QA: the coin picker showed "Status Code: 403, Data Length: 4545" and the
exported logs held no trace of it. A failed coin-list load and a failed
route check now log the HTTP status, the path and a short body excerpt
(an HTML page by its title); NEAR verdict changes and sentinel rounds
that settle nothing are logged too. No key, query or address is logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: af4a07dcbc494f1d6c12dff7d7162e7fc81926fb
Develop added ADRs 0007 and 0023-0026; the decision index keeps them
beside the swap ADRs 0010-0012 and lists both new areas.

Review: a picker closed while the round that finds a NEAR outage still
waits on its last sentinel; the round still settles and a coin's route
recorded meanwhile stays usable. A regression test pins it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: 5a607298ca6034ea4ff276829a239370d9d77705
A quote to the user's address that carried a route never looked at the
provider errors, so a halted provider beside the route (Maya halted
while NEAR routes) was not recorded; a route from one Maya flavour still
outweighs the other flavour's halt. The swap live routes summary now
words two guarantees as the code keeps them: an earlier conclusive
answer keeps applying after an inconclusive re-check, and the address
screen re-checks a "no route" outside the picker.

Review round 26 on #1297: thepastaclaw 4525313507, CodeRabbit 4524711754
and 4524711764.

SDD-Published-From: 8b5e623ae43ab4ee53a336d6576f9cba18f0dc42
Closes the PR #1297 review round of 2026-11-10 16:01Z: an older
overlapping coin list load no longer commits its pools or starts route
checks after a newer one (thread r4527231138); the address check passes
only on a route a requested provider carries (r4527231147); the README
states the halted, expiry and address guarantees as the code keeps them
(r4527231218, r4526558156, r4526558173).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: ee3e6c411eeb6bb191b121b6cabaf1c629501ae0
When a quote records a route for the coin while the address screen's
no-route re-check is asking, the re-check now reports that newer answer
instead of its own older no-route (review: re-check ignores a newer
stored answer). The README names every quote that sends the entered
address (review: address claim overstated).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: 04e23df4567e99102ce7691bc0c5a7b9d60e3def
Select coin put the error's localizedDescription on screen, so a refused
request showed "Status Code: 403, Data Length: 4545" to the user. It now
shows "Couldn't load the coin list. Please try again, or try a different
network."; the failure detail still goes to the log.

Fixes #1371

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 11, 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 2 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: 9a87308a-7c88-40fc-affd-41b38f5c7821
Commits

Reviewing files that changed from the base of the PR and between b338a5f and 0146122.

Files ignored due to path filters: 2

  • docs/review/select-coin-error/after.png is excluded by !**/*.png
  • docs/review/select-coin-error/before.png is excluded by !**/*.png
Files selected for processing: 45

  • DashWallet/Sources/UI/Swap/SelectCoin/SelectCoinViewModel.swift
  • DashWallet/ar.lproj/Localizable.strings
  • DashWallet/bg.lproj/Localizable.strings
  • DashWallet/ca.lproj/Localizable.strings
  • DashWallet/cs.lproj/Localizable.strings
  • DashWallet/da.lproj/Localizable.strings
  • DashWallet/de.lproj/Localizable.strings
  • DashWallet/el.lproj/Localizable.strings
  • DashWallet/en.lproj/Localizable.strings
  • DashWallet/eo.lproj/Localizable.strings
  • DashWallet/es.lproj/Localizable.strings
  • DashWallet/et.lproj/Localizable.strings
  • DashWallet/fa.lproj/Localizable.strings
  • DashWallet/fi.lproj/Localizable.strings
  • DashWallet/fil.lproj/Localizable.strings
  • DashWallet/fr.lproj/Localizable.strings
  • DashWallet/hr.lproj/Localizable.strings
  • DashWallet/hu.lproj/Localizable.strings
  • DashWallet/id.lproj/Localizable.strings
  • DashWallet/it.lproj/Localizable.strings
  • DashWallet/ja.lproj/Localizable.strings
  • DashWallet/ko.lproj/Localizable.strings
  • DashWallet/mk.lproj/Localizable.strings
  • DashWallet/ms.lproj/Localizable.strings
  • DashWallet/nb.lproj/Localizable.strings
  • DashWallet/nl.lproj/Localizable.strings
  • DashWallet/pl.lproj/Localizable.strings
  • DashWallet/pt.lproj/Localizable.strings
  • DashWallet/ro.lproj/Localizable.strings
  • DashWallet/ru.lproj/Localizable.strings
  • DashWallet/sk.lproj/Localizable.strings
  • DashWallet/sl.lproj/Localizable.strings
  • DashWallet/sl_SI.lproj/Localizable.strings
  • DashWallet/sq.lproj/Localizable.strings
  • DashWallet/sr.lproj/Localizable.strings
  • DashWallet/sv.lproj/Localizable.strings
  • DashWallet/th.lproj/Localizable.strings
  • DashWallet/tr.lproj/Localizable.strings
  • DashWallet/uk.lproj/Localizable.strings
  • DashWallet/vi.lproj/Localizable.strings
  • DashWallet/zh-Hans.lproj/Localizable.strings
  • DashWallet/zh-Hant-TW.lproj/Localizable.strings
  • DashWallet/zh.lproj/Localizable.strings
  • DashWallet/zh_TW.lproj/Localizable.strings
  • DashWalletTests/SelectCoinViewModelTests.swift
Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • 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

@romchornyi romchornyi changed the title Show a plain message when the swap coin list fails to load fix(dashdex): show a plain message when the coin list fails to load Nov 11, 2026
@thepastaclaw

thepastaclaw commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Review in progress — actively reviewing now (commit 0146122) · triage: low
████████░░░░░░░░░░░░ 39% · about 30 min left · running for 19 min
✅ triage → ✅ Phase 1 → ⏳ verify 1 → ▫️ gate → ▫️ Phase 2 → ▫️ verify 2 → ▫️ publish
Estimated from recent reviews of this tier · updated 12:07 UTC · live progress

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 2 only (queue backlog)

Verified the base-to-head changes at c989616 and found no in-scope issues. The picker displays localized recovery guidance while retaining diagnostic logging, retry behavior, and stale-request protection; all 43 catalog changes are limited to the intended addition. Validation was static, with no local builds or tests run; current CI passes simulator tests, target membership, workflow lint, and accessibility checks on this head, with only the automated review pending.

Review provenance

Source: reviewer 1: 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 makes a small, contained behavioral change to coin-list error presentation, with a focused regression test, localization entries, and screenshots, without changing transaction or networking logic.
  • Phase 1 reviewers: not run (skipped for throughput: 11 PRs queued, above the 10 limit)
  • 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

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

Approving. The change is small and does what it says: every coin-list load failure now shows one localized message, the cause still goes to the log through SwapKitFailureDetail (#1297), and the stale-generation guard runs before errorMessage is set, so a late failure can't overwrite a newer load. Retry (loadCoins(force: true)) and the offline skip are unchanged.

What I checked:

  • SelectCoinViewModel.loadCoins: the catch is the only place errorMessage gets a value, so nothing else in the picker can still show raw HTTP text.
  • The test calls the real loadCoins() with a LocalizedError whose text matches the client's non-2xx description, through ScriptedPoolsProvider.fetchPools(direction:). If the line went back to error.localizedDescription, the test would fail.
  • All 43 Localizable.strings catalogs: each has the key exactly once, and plutil -lint passes on every one.
  • CI on c989616f: unit tests, target membership, accessibility and workflow lint are all green.

Non-blocking:

  1. Wording: see the inline comment on "try a different network".
  2. Follow-up, out of scope here: OrderPreviewViewModel still sends error.localizedDescription to the user in setFailure(...) and pendingSwapAlertMessage (around lines 339, 403, 443–455). A non-2xx answer on the quote or order path would probably show the same "Status Code: …" text there. That might be worth its own issue.

Merge order: this is stacked on #1297, which currently has CHANGES_REQUESTED. Retarget to develop after #1297 merges, as the description says.

I only read the code and checked CI. I didn't run it locally.


/// What the picker shows when the coin list fails to load; the cause goes to the log.
static let loadFailedMessage = NSLocalizedString(
"Couldn't load the coin list. Please try again, or try a different network.",

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.

Nit, non-blocking: on this screen "network" could also mean a chain. The picker labels each coin with its routing network ("Maya", "NEAR", "Multiple networks" from networkLabels), so "try a different network" might read as "pick a coin on another chain". If the intent is the internet connection (the edge refusing based on where the request comes from), something like "…or try a different internet connection (Wi‑Fi or mobile data)" would be clearer. Changing it means updating the key in all 43 catalogs, so it's fine to leave as is.

@romchornyi
romchornyi changed the base branch from fix/swap-live-route-availability to develop November 12, 2026 11:16
# Conflicts:
#	DashWallet/Sources/UI/Swap/SelectCoin/SelectCoinViewModel.swift
#	DashWalletTests/SelectCoinViewModelTests.swift
@romchornyi
romchornyi merged commit 0c6bb7a into develop Nov 12, 2026
6 of 7 checks passed
@romchornyi
romchornyi deleted the fix/select-coin-error-copy branch November 12, 2026 12:16
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.

Select coin shows the raw HTTP error text when the Dash DEX coin list fails to load

3 participants