Skip to content

feat(identity): fund-first onboarding — friendly labels, F1 avatar, empty-wallet guard - #869

Merged
lklimek merged 49 commits into
docs/platform-wallet-migration-designfrom
feat/identity-onboarding-ux
Jul 8, 2026
Merged

lklimek merged 49 commits into
docs/platform-wallet-migration-designfrom
feat/identity-onboarding-ux

Conversation

@lklimek

@lklimek lklimek commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Why this PR exists

  • Problem: The Identity onboarding didn't match the redesign spec (docs/ai-design/2026-04-22-identity-dashpay-redesign/design-spec.md §B.1/§B.9/§B.10/§B.11). The F1 onboarding had no avatar, the create wizard was alias-first instead of fund-first, and the funding/load controls used engineering jargon ("Wallet Balance", "Unused Evo Funding Locks", "By Identity ID", "asset lock") that the Everyday-User persona (docs/personas/everyday-user.md) can't parse.
  • What breaks without it: A first-time user clicking "Create my first identity" had to name the identity before choosing how to fund it, then met developer terminology on the flagship onboarding path. Two follow-up review rounds also found: a zero-balance wallet could get stranded on a dead-end funding screen with no explanation; the balance gate itself could be bypassed by unspendable (immature/CoinJoin-locked) funds; and two "Max amount" buttons could offer more than was actually spendable. A later audit also found that important banners (e.g. "this saved wallet couldn't be reopened") could silently auto-dismiss after a few seconds, before the user had a chance to read them. Separately, the "Send to" address field offered no way to narrow a long autocomplete list beyond plain substring text, making it hard to find a specific address once a user had several wallets and address categories loaded.

What was done

  • A1 — F1 avatar: abstract avatar silhouette + soft Dash-blue radial gradient above "Welcome to Identities." (paint_abstract_avatar in src/ui/identity/avatar.rs, wired in onboarding.rs). §B.1.
  • A2 — friendly labels + default: FundingMethod::Display → "From your wallet (recommended)" / "Recover an unfinished funding" / "Use a Platform address"; Load-Identity tabs → "Identity ID & private key" / "From my wallet" / "My username" with a jargon-free caption; UseWalletBalance becomes the recommended pre-selected default when the wallet has balance. §B.9/§B.11.
  • A4 — fund-first reorder: Create wizard is now 1. Choose funding → 2. amount/selection → 3. optional local alias → Create. No username step (deferred per §B.10). §B.10.
  • QA hardening (from an adversarial review pass): balance-gated default with §B.1 insufficient-funds / no-wallet banners so an empty wallet never lands on a dead-end; de-jargoned the "unfinished funding" recovery screen (raw TxID/Vout now Advanced-only); fixed a stale "pick a username" CTA tooltip; disabled the recovery-screen Create button when nothing is selected; Top-Up screen pre-select parity; restored all three funding methods in docs/user-stories.md IDN-001.
  • Second review round (13 automated findings triaged, 10 confirmed and fixed, 3 retracted as false positives): the insufficient-funds gate now checks .spendable() credits instead of .total via a shared spendable_covers_minimum() helper; the Top-Up wizard gained its own insufficient-funds banner (previously silently no-op'd on low balance); Create-Identity's funding pre-selection now requires fee-sufficiency, not just a non-zero balance; "alias" terminology standardized; Top-Up gets a context-appropriate funding-method label; a Title-Case label inconsistency fixed; Top-Up's own asset-lock recovery screen got the same de-jargoning pass as its sibling; design-spec doc synced with shipped copy.
  • Third review round (re-verification with a call-tree walk found one fix incomplete plus one new instance of an already-fixed bug class): the RwLock panic-on-poison fix only patched the exact flagged lines — sibling reads on the same locks, one call away, still panicked; extended the defensive handling to those 3 sites (show_wallet_balance in both wizards, a second funding_method read in Top-Up). Also found and fixed both wizards' "Max amount" buttons still computing from .total + a bare * 1000 instead of .spendable() + the shared max_amount_after_fee_reserve() helper.
  • Fourth round — frontend TODO triage: the Create-Identity wallet picker (render_wallet_selection in add_new_identity_screen/mod.rs) listed only each wallet's alias, so users chose a wallet blind and discovered insufficient funds only later, deep in the funding flow. It now shows each wallet's spendable balance next to its alias (alias — X DASH), in both the ComboBox's selected text and every entry — same .spendable()-not-.total convention as the Max-amount fixes above.
  • Fifth round — banner auto-dismiss audit: audited every MessageBanner call site across the PR (~300 sites, 64 files) and classified each by whether it reports something that genuinely affects the user (data loss, a major feature not working) versus routine noise (success confirmations, validation hints, in-progress status). Added BannerHandle::disable_auto_dismiss() and OptionBannerExt::raise_persistent() so a banner can stay on screen until manually dismissed instead of vanishing on the default 5s/9s timer. Made 49 sites persistent — dominated by a single recurring class: any try_open_wallet_no_password "this wallet's saved data looks damaged" error (38 of the 49), plus failed identity/key removal, failed key persistence, lost connection, and the generic backend-task-error fallthrough in app.rs that catches send/broadcast/asset-lock failures for screens that don't override display_task_error. Left alone: successes, validation nudges, and .with_elapsed() in-progress waits.
  • Sixth round — search tags + pills on the address picker: the shared AddressInput autocomplete (src/ui/components/address_input.rs, used by Send, Shield, Unshield, and a wallets-screen dialog) gained a github-style search DSL: type:core|platform|shielded|identity and wallet:<name>, repeatable per key (OR), combinable across keys (AND), plain words still do free-text search as before. Each suggestion row now shows a wallet pill and a type pill instead of a plain "[alias] " text prefix, plus the address and an optional name in parens. The empty-state hint is now a live legend of the tags actually usable in that instance (capped at 5 wallets, with a visible "+N more" past that), replacing a static "enter an address" hint. Independently adversarially reviewed (parser edge cases, panic risk, the 5-wallet boundary, the two other callers' compatibility, i18n) — 4 low-severity polish items found, none blocking.

Also included

  • Unrelated tokens-screen bugfix, bundled into this PR at the maintainer's request rather than the identity-onboarding scope above: src/ui/tokens/add_token_by_id_screen.rs drove its status machine off substring-matching banner text (msg.contains("DataContract successfully saved"), "Contract not found", etc.) — a "never parse error strings" violation. Investigation found the branches were dead code under the current BackendTaskSuccessResult routing: SavedContract/ContractNotFound/TokenNotFound/FetchedTokenBalances all bypass display_message and land in display_task_result, which had no handling for them. Net effect before the fix: clicking "Import Token" never reached the success screen, and the contract-ID → token-ID fallback search never fired. Replaced with typed-variant dispatch: SavedContract → Complete; ContractNotFound disambiguated via a new SearchKind (in-flight contract-ID lookup → retry as token ID; contract missing behind an already-found token → genuine error) so the two cases no longer collide; TokenNotFound → a calm, jargon-free error banner. display_message now reacts only to message type, never text.

Testing

  • cargo build, cargo clippy --all-features --all-targets -- -D warnings, cargo +nightly fmt --all -- --check — all clean.
  • cargo test --all-features --workspace: 1329 lib tests passed (0 failed, 1 ignored), 192 kittest passed, 10 backend-e2e-adjacent/e2e passed, 3 legacy-table-surface passed, all doc-tests passed.
  • Banner-timer audit specifically re-verified with the targeted kittest suites (migration_banner, progress_overlay, skipped_wallets_banner): 66/66 passed, included in the totals above.
  • Address-search-tags feature specifically re-verified with its dedicated kittest suite (6/6) plus 72 inline unit tests covering the tag parser, wallet/type pill population, and the 5-wallet trim boundary, included in the totals above.
  • Manually verified on testnet (headless GUI): F1 avatar, fund-first step order, de-jargoned recovery screens on both wizards, corrected tooltip, and the empty-wallet default (no dead-end) on both Create-Identity and Top-Up.
  • The two frontend-TODO fixes (wallet-balance picker, add-token typed outcomes) were each built and verified independently in isolated worktrees, then re-verified together on the merged branch — all passing.

Breaking changes

None — presentation-layer plus balance-source correctness fixes (labels, layout, an enum default, added banners, .total → .spendable() at several call sites, banner persistence, address-picker search/rendering). No backend/DB/secret/finality logic touched.

Known deviations / follow-ups

  • Persona-gating not implemented (spec §B.11 would hide the wallet-derivation load mode behind Advanced for Alex) — intentionally deferred by product decision; all load modes stay visible.
  • No username step in the create flow — deferred per §B.10's "username can be registered later from Settings".
  • Funding pre-selection staleness: the fee-sufficiency check that drives pre-selection is computed once when the screen/wallet is set (new_with_wallet) and not recomputed on a later wallet switch — marked with TODO(bilby) in add_new_identity_screen/mod.rs. Safely fixing this needs to track whether the user manually chose a funding method, so a wallet switch never clobbers an explicit choice — open GitHub review thread awaiting a product decision on the intended behavior before implementing.
  • Test-coverage gaps (deferred): no kittest/e2e exercising the full AddNewIdentityScreen wizard end-to-end; avatar-wiring in onboarding::render not asserted.
  • Address-search-tags polish (non-blocking, low severity): the "change" address annotation and the "+N more" trim indicator are hardcoded English literals rather than i18n-extractable placeholders; tracked as a follow-up.

Base / stacking

Targets docs/platform-wallet-migration-design. PR #860 (through its subsequent platform-pin bump to 44c20e3, its simplification-audit fixes, and its balance-derivation single-sourcing fix — the latter independently adversarially reviewed twice) and PR #871 are both fully merged into this branch's history via that base — current base commit 8bd1d1d2. No pending overlap remains; re-synced and re-verified (fmt/clippy/full test suite: 1327 lib + 187 kittest + 10 e2e + doctests, 0 failed) after each base update, most recently for this merge.

Checklist

  • Conventional commits
  • Build / clippy / fmt clean
  • Tests pass (1329 lib + 192 kittest + doc-tests, re-verified after each base sync and after each of the last two rounds)
  • User stories updated (IDN-001, IDH-001)
  • Rebase check vs base branch — resolved, base fully merged into this branch
  • Product decision needed on funding-pre-selection staleness (open review thread) before that item can close

🤖 Co-authored by Claudius the Magnificent AI Agent

lklimek and others added 2 commits July 1, 2026 11:30
…atar

Per docs/ai-design/2026-04-22-identity-dashpay-redesign/design-spec.md:

- F1 onboarding (§B.1): render an abstract avatar silhouette on a soft
  Dash-blue radial glow above the "Welcome to Identities." heading, via a
  new paint_abstract_avatar() helper (reuses the existing type-glyph and
  monogram-painting conventions in ui/identity/avatar.rs).
- Friendly funding labels (§B.9): relabel FundingMethod::Display to
  jargon-free Alex-facing copy ("From your wallet (recommended)", "Recover
  an unfinished funding", "Use a Platform address", "Select how to fund"),
  and make UseWalletBalance the pre-selected default. Applied consistently
  everywhere the enum is rendered, including the Top Up Identity screen,
  which shares the same enum and previously hardcoded its own drifted
  labels (one of which leaked "asset lock" jargon).
- Friendly load-identity tabs (§B.11): concise Alex-facing tab labels
  ("Identity ID & key", "From my wallet", "My username") with the fuller
  jargon-free description shown as a caption under the tab row. No
  persona-gating changes — all methods and modes stay visible.
- Fund-first wizard reorder (§B.10): the funding-method chooser is now the
  first everyday-facing step; the optional local alias moves to its own
  step right before the Create/Register button for whichever funding
  method is chosen. The WaitingForAssetLock wait UI and its
  WalletFundedScreenStep logic are untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…set-lock recovery screen

Addresses Marvin's QA findings on 7369d38:

- QA-001 [HIGH]: the pre-selected "From your wallet" default was a dead end
  for a fresh, zero-balance wallet (looked chosen but the ComboBox never
  actually offered it). Gate the default on `snapshot_has_balance` via a new
  shared, unit-tested `default_funding_state()` — falls back to unselected
  when the wallet has nothing to fund with. Add §B.1's exact "not enough
  Dash" / "need a wallet" banners with a link to the Wallets screen so the
  user always has a next step instead of a silent stop.
- QA-002 [HIGH]: de-jargon the "Recover an unfinished funding" sub-screen —
  it still said "asset lock", "TxID", "Vout", and "chain-lock" to Alex right
  after the friendly relabel. Raw TxID/Vout now hide behind Advanced Options;
  all remaining Alex-facing strings talk about "unfinished funding" instead.
- QA-004 [MEDIUM]: the onboarding CTA tooltip described a username step that
  has never existed and now contradicts the fund-first flow. Rewritten to
  match the actual wizard.
- QA-005 [MEDIUM]: the asset-lock recovery screen's Create button was always
  enabled and silently no-op'd with nothing selected. Disabled via
  `add_enabled`, mirroring the Platform-address screen's existing pattern.
- QA-006 [MEDIUM]: apply the same balance-gated §B.9 default to the Top Up
  Identity screen, which renders the same chooser but previously always
  started unselected.
- QA-007 [LOW]: restored the two non-wallet-balance funding methods to
  IDN-001's acceptance criteria in docs/user-stories.md.
- QA-009 [LOW, optional]: restored "private" to the Load-Identity tab label
  so it matches its own caption.
- QA-010 [LOW]: inline format-string capture in render_alias_input.

QA-003 (the "By wallet derivation" load-identity tab isn't gated behind
Advanced for Alex per §B.11's visibility column) is a known, intentional
deviation, not a regression — the user explicitly declined persona-gating
for this PR. Not fixed here.

The WaitingForAssetLock wait UI and WalletFundedScreenStep matching logic in
by_using_unused_balance.rs remain untouched — only string/label/gating
changes were made around them.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

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: c8a2417f-d9e7-40ad-809c-ef21a5d43e23

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 feat/identity-onboarding-ux

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.

lklimek and others added 2 commits July 1, 2026 14:58
…70 date

TransactionInstantLocked only carries a txid, not a TransactionRecord, so
the event bridge was dropping it on the floor for tx-history purposes:
the accumulated record stayed status=Unconfirmed forever even after the
backend moved the balance to Confirmed. The UI rendered that as "Pending"
with a 1970-01-01 date (unset block timestamp), even though the tx was
already InstantSend-locked and later block-confirmed.

Add SnapshotStore::mark_instant_locked to upgrade the tracked record's
status in place on the InstantLock event, without regressing a
Confirmed/ChainLocked status if a block confirmation raced it. Render a
"Pending…" placeholder instead of the Unix epoch when a tx has no block
timestamp yet.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
/// caller's own no-wallet gate).
fn render_insufficient_wallet_balance_banner(&self, ui: &mut egui::Ui) -> Option<AppAction> {
let selected_wallet = self.selected_wallet.as_ref()?;
let seed_hash = selected_wallet.read().unwrap().seed_hash();

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.

New .read().unwrap() on a shared RwLock — panics on poison

Same pattern recurs in top_up_identity_screen/mod.rs:164 (wallet.read().unwrap()). A panic anywhere else while holding this lock poisons it for every reader, including this new code path, taking down the UI thread. Consider .unwrap_or_else(PoisonError::into_inner) or the existing safe-read helper already used elsewhere in this file.

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.

Verified: both .read().unwrap() sites panic on lock poisoning as described. Correcting my own finding: the "safe-read helper already used elsewhere in this file" claim was wrong — that defensive match .read() { Ok/Err } pattern actually lives in the sibling by_using_unused_asset_lock.rs, not in this file. Recommend porting that pattern here and to top_up_identity_screen/mod.rs:164. Not fixed yet — leaving open.

🤖 Co-authored by Claudius the Magnificent AI Agent

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.

Re-verified with a call-tree walk, and this one isn't actually closed: the two lines you flagged are no longer bare .read().unwrap() (commit db2b79d7), but the panic risk survives via sibling reads on the same lock, one call away:

  • show_wallet_balance() — in both this file and its Top-Up counterpart — still does a bare .read().unwrap() on self.selected_wallet, and runs immediately before the now-safe banner code in the render order.
  • top_up_identity_screen/mod.rs:179 does a bare .read().unwrap() on the same self.funding_method lock, a few lines after the line that was fixed.

Since RwLock poisoning is sticky, either sibling read still panics the UI thread under the exact condition this thread was raised about. Leaving open — extending the fix to cover these now.

🤖 Co-authored by Claudius the Magnificent AI Agent

// with, matching the same availability gate the ComboBox itself
// applies in `render_funding_method` (`has_balance`), so the visibly
// "selected" method is never one the dropdown wouldn't actually offer.
let wallet_has_balance = selected_wallet.as_ref().is_some_and(|wallet| {

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.

Pre-selection threshold doesn't match the sufficiency threshold

wallet_has_balance here pre-selects UseWalletBalance/ReadyToCreate on any positive balance, but the new insufficient-funds banner requires the balance to cover the estimated fee. A dust-balance wallet gets pre-selected into "ready to create" and then immediately blocked by the banner — a confusing, self-contradicting first impression.

Separately: this is computed once at construction time (new_with_wallet), so if the screen opens before wallet sync completes, the pre-selection can go stale relative to the real balance.

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.

Verified both sub-claims: snapshot_has_balance triggers on any positive balance including dust, with no fee comparison, so a dust-balance wallet gets pre-selected into ReadyToCreate and then immediately blocked by the new insufficient-funds banner — a confusing first impression. Also confirmed pre-selection is computed once in new_with_wallet and never recomputed on wallet switch or sync completion. Recommend gating pre-selection on the same fee-sufficiency check the banner uses. Not fixed yet — leaving open.

🤖 Co-authored by Claudius the Magnificent AI Agent

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.

Confirmed sub-claim (a) fixed in d4c1728e: pre-selection now requires fee-sufficiency (via spendable_covers_minimum), not just any positive balance — verified the code path and its call-tree.

Sub-claim (b), staleness on wallet-switch, is deliberately deferred — a TODO(bilby) documents the exact gap: recomputing safely needs to track whether the user manually picked a funding method, so a wallet switch never clobbers an explicit choice, and that's a UX call rather than something safe to guess at in a bug-fix pass.

Leaving this thread open pending your direction: should switching wallets ever silently change an already-selected funding method, or only ever refresh the pre-selection while the user hasn't touched it yet? Happy to implement either once there's a call.

🤖 Co-authored by Claudius the Magnificent AI Agent

@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

Automated review — consolidated from two independent passes (Opus: 11 findings, Sonnet 5: 9 findings), cross-verified against source and git history, 0 confirmed false positives. 10 inline comments posted on this PR's diff; 3 additional findings couldn't be anchored to a changed line and are noted here instead:

  • Residual jargon: by_using_unused_balance.rs:20 — the "Wallet Balance: {:.8} DASH" label wasn't included in this PR's friendly-copy relabeling pass, unlike its siblings.
  • Title-Case nit: by_platform_address.rs:106 — ComboBox::from_label("Platform Address") retains Title-Case, out of step with the PR's new casing convention elsewhere.
  • Top-Up sub-screens keep old jargon: top_up_identity_screen/by_using_unused_asset_lock.rs (not touched by this PR) still says "Select an unused asset lock" / "asset lock" throughout — if the friendly-copy pass is meant to eventually cover the Top-Up wizard's own sub-screens too, this file is still pending it.

🤖 Co-authored by Claudius the Magnificent AI Agent

@lklimek

lklimek commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Re-verification of the 3 unanchored findings from the consolidated review comment above:

  • by_using_unused_balance.rs:20 (Wallet Balance label) — retracting: the premise was wrong. No sibling screen's balance label was relabeled either (by_platform_address.rs's equivalent label is equally untouched) — this is uniform non-treatment across all three funding screens, not an inconsistency singling this one out. No action needed.
  • by_platform_address.rs:106 (Title-Case ComboBox label) — confirmed present, but it's pre-existing code this PR didn't touch (the string predates this PR). Real minor inconsistency, but fixing it here would be scope creep — better as a follow-up cleanup.
  • top_up_identity_screen/by_using_unused_asset_lock.rs (stale jargon) — confirmed: file is untouched by this PR and still says "asset lock" throughout, unlike the friendlier wording its create-identity sibling got. Confirmed out of this PR's scope; worth a follow-up if the de-jargoning pass is meant to eventually cover the Top-Up wizard's own sub-screens.

🤖 Co-authored by Claudius the Magnificent AI Agent

lklimek and others added 13 commits July 1, 2026 20:43
…total

`render_insufficient_wallet_balance_banner` computed available credits from
`snapshot_balance().total`, which per its own doc comment includes immature
and CoinJoin-locked funds the coin selector can never actually spend — an
under-funded wallet could slip past the "not enough Dash" gate. Switch to
`.spendable()` and replace the bare `* 1000` with the shared
`spendable_covers_minimum` helper (now in `funding_common.rs` so Top-Up can
reuse it), which uses `CREDITS_PER_DUFF` and `saturating_mul` to avoid
overflow.

Also replace the wallet `.read().unwrap()` in this function with the
defensive `match`/`Err` pattern already used in the sibling
`by_using_unused_asset_lock.rs`, so a poisoned lock degrades to a message
instead of panicking the UI thread.

Adds unit tests for the arithmetic, including the boundary case where the
balance is exactly at, one credit under, and one credit over the minimum.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ection

The QA-006 wallet-switch pre-selection read `self.funding_method.read().unwrap()`
directly, which panics the UI thread if the lock is ever poisoned. Read it
defensively instead: on `Err`, treat the funding method as already set and
skip the auto-recommendation rather than crash.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Top-Up's wallet-balance step had no insufficient-funds messaging at all: the
`UseWalletBalance` arm of `top_up_identity_clicked` just returned
`AppAction::None` for a zero amount, a silent dead end matching the exact bug
class fixed on Create-Identity. Port the same gate here: a
`render_insufficient_wallet_balance_banner` (using
`estimate_identity_topup()` and the shared `spendable_covers_minimum`
helper) that shows a jargon-free "not enough Dash" message with a link to
Wallets, plus a `has_valid_amount` check so the fee estimate and Top Up
button only render once a positive amount is entered.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
`wallet_has_balance` fed into `default_funding_state()` on ANY positive
balance, dust included, with no fee-sufficiency check — a dust wallet got
pre-selected into `ReadyToCreate` and was then immediately blocked by the
"not enough Dash" banner. Reuse the same sufficiency check the banner makes
(spendable balance vs. estimated identity-creation fee, via the shared
`spendable_covers_minimum` helper) so the visibly "selected" method is never
one the banner blocks on the very next render.

Left TODOs on the known staleness gap: this pre-selection is computed once
in `new_with_wallet` and never recomputed on a later wallet switch
(`update_wallet` / the wallet-switch handler in `render_wallet_selection`
don't touch it). Fixing that safely needs to track "user manually chose a
method" so a switch never clobbers an explicit choice — deferred pending UX
confirmation rather than guessed at here.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…kname"

The optional local-identity-label step said "alias" in its heading and field
label, but its function doc comment and on-screen caption both said
"nickname" — two terms for the same thing shown to the user at once.
Standardize on "alias" everywhere; the caption still clarifies it is not a
DPNS username.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Top-Up's funding-method chooser reused `FundingMethod`'s `Display` impl,
whose `UseUnusedAssetLock` wording ("Recover an unfinished funding") is apt
for Create-Identity's interrupted-setup framing but odd for Top-Up — an
identity being topped up already exists and was never mid-funding. Add
`FundingMethod::top_up_label()`, matching `Display` for every variant except
`UseUnusedAssetLock` ("Use an existing funding transaction"), and switch
every `format!("{}", FundingMethod::...)` call site in the Top-Up screen to
use it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
`ComboBox::from_label("Platform Address")` was Title-Case, inconsistent with
this PR's sentence-case copy convention elsewhere in the same flow ("Use a
Platform address", "From your wallet (recommended)").

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This file wasn't touched by the earlier de-jargon pass and still said "asset
lock" throughout, while its sibling
`add_new_identity_screen/by_using_unused_asset_lock.rs` got friendlier
"unfinished funding" wording. Mirror the same relabeling here: loading/error/
empty states, the picker heading, and the not-ready-yet warning now all talk
about "unfinished funding" instead of asset locks or chain-locks.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The spec still showed the literal [Go to Receive] button text; the shipped
code deliberately uses "Go to Wallets" since this app has no separate
top-level Receive screen — the link goes to Wallets, where the receiving
address lives. Update the spec to match, with a note explaining why.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
db2b79d fixed two flagged `.read().unwrap()` panics in the funding-method
gate, but sibling reads on the same locks — one call away — were still
bare and still panicked, defeating the graceful-degradation goal.

- `show_wallet_balance` in both Create-Identity and Top-Up's
  by_using_unused_balance.rs ran before the already-fixed insufficient-balance
  banner but itself read the wallet lock with a bare `.unwrap()`, so a
  poisoned lock never reached the banner's defensive handling. Now reads
  defensively and shows "Wallet is busy. Try again in a moment." on poison.
- Top-Up's `render_wallet_selection` re-read the same `funding_method` lock
  a few lines after the fixed first read. Since RwLock poisoning is sticky,
  this second bare read would panic moments after the first one gracefully
  degraded. Now skips the wallet auto-selection entirely when the first read
  already failed, instead of attempting a doomed second read.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
top_up_funding_amount_input computed the "Max" amount from the wallet's
`total` balance and a bare `* 1000` duffs-to-credits conversion — the same
bug class already fixed elsewhere in this PR. `total` counts immature and
locked funds that coin selection cannot touch, so an under-funded or
partially-locked wallet could offer a "Max" amount that isn't actually
spendable.

Extracts the fee-reserved conversion into
`funding_common::max_amount_after_fee_reserve`, built on `spendable()` and
the shared `CREDITS_PER_DUFF` constant, alongside `spendable_covers_minimum`.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…not total

render_funding_amount_input computed the "Max" button's amount from
DetWalletBalance.total (includes immature/CoinJoin-locked duffs) and a bare
`* 1000` duffs->credits conversion — the same bug class already fixed on the
insufficient-funds banner and the Top-Up wizard's own Max button. Reuse
spendable() and the max_amount_after_fee_reserve() helper so an under-funded
wallet's "Max" never offers more than is actually spendable, with a
fee-reserved hint mirroring the Top-Up wizard's equivalent input.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ialog

The wallet picker in the Create-Identity screen listed only each wallet's
alias, so users chose a wallet blind and discovered insufficient funds
only later, deep in the funding flow. Show each wallet's spendable balance
next to its alias — in both the ComboBox's selected text and every entry —
so funding sufficiency is visible up front.

Balances use the wallet's spendable amount (never total), matching the
fund-safety convention already established for the Max/insufficient-balance
gates in this same screen: only spendable funds can pay for identity
creation, so showing the total would invite the very surprise this label
prevents.

The label is composed by a pure `format_wallet_picker_label` helper
(unit-tested) and a poison-tolerant `wallet_picker_label` that reads the
balance from the display snapshot; a poisoned wallet lock degrades to a
plain "Unnamed Wallet" label rather than panicking, consistent with the
screen's existing RwLock discipline. Only the picker's label text changed;
selection and click behavior are untouched.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
lklimek and others added 14 commits July 7, 2026 10:28
…m inflation

Bypasses key-wallet entirely: derives 20,000 candidate addresses (10k
external + 10k internal, BIP44 account 0) directly from the wallet's
public xpub via a hard brute-force index cap (no gap-limit/discovery
logic), then queries Insight's bulk addrs/utxo endpoint for real on-chain
state. True balance: 20.36908682 DASH (10 funded addresses out of 20,000
checked) — matches §10's cold-rescan figure to 8 decimal places. Key-wallet
itself reported 229.98547073 DASH for the same wallet moments earlier
(§16): an 11.29x, 209.6-DASH phantom discrepancy, independently confirmed
with zero reliance on key-wallet's own state. Full per-address CSV and
query script preserved under /data/artifacts/dash-evo-tool/2026-07-07/.
Verification only, no source changes.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…-order processing bug

Traces the actual mechanism from the real cold-rescan log instead of
further guessing: block heights are processed in essentially arbitrary
order during rescan (parallel-filters), and for the specific failing
outpoint, its real spend was logged as processed 0.87s BEFORE the
transaction that created it — inserted as fresh/spendable despite its
own spend already being observed. Both land in the same committed batch,
distinguishing this from the CoinJoin gap-limit precedent's cross-batch
mechanism (related theme, different specific bug). Confirms via a new,
fully self-verified (no secret, no network) deterministic test in
rust-dashcore (key-wallet-manager/tests/out_of_order_spend_repro_test.rs,
committed 906fd47d on repro/pr3549-rdc) — RED, actually run twice.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…lock finality

Reran test_tc004_create_registration_asset_lock on feat/identity-onboarding-ux
post-merge (5e90202, the balance-categorization display fix). Still fails:
same FinalityTimeout shape, a third independent instance of the
already-spent-UTXO-selection mechanism (funding input confirmed spent for
real 31,106 confirmations/~54 days prior via Insight), reported spendable
balance still ~250 DASH vs ~20.37 DASH true (§19). Verification only.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ismiss

BannerHandle::disable_auto_dismiss() and OptionBannerExt::raise_persistent()
let a banner stay visible until manually dismissed, instead of vanishing on
the default 5s/9s timer. Some banners genuinely affect the user (data loss,
a major feature not working) and must not disappear before they're read.

Fixes the first confirmed case: raise_skipped_wallets_banner's "N saved
wallet(s) couldn't be opened" message was auto-dismissing after 9s via
OptionBannerExt::raise, even though it reports wallets the user cannot
currently access.

Foundation for auditing the rest of the ~210 set_global call sites across
the PR for the same class of bug.
Every banner surfacing try_open_wallet_no_password() errors now disables
auto-dismiss. That helper errors on exactly one path — a no-password
wallet whose saved data is damaged and cannot be opened ("Re-add it from
its recovery phrase to restore it."). That is data the user can no longer
access, identical to the already-persistent raise_skipped_wallets_banner
precedent, so the banner must not vanish on the 9s timer before the user
notices. The inline "Wallet is locked. Please unlock" affordance is a
separate wallet_needs_unlock() path and does not cover this case.

Audited every set_global / set_global_with_error / raise / replace /
set_message site in the 11 assigned DashPay + DPNS screens. Only these
seven damaged-wallet sites qualify as important; success confirmations,
progress notices, input-validation errors, QR retry errors, alias-label
failures, and the existing with_elapsed vote/refresh progress banners
(cleared on completion, terminal outcome shown elsewhere) keep their
default timers.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016tKDqE5RvAzFhMdN7r7cFB
try_open_wallet_no_password only returns Err when a no-password wallet's
saved data is damaged ("Re-add it from its recovery phrase to restore
it") — the same data-loss class the persistent-banner API was built for.
For a no-password wallet the on-screen "Unlock Wallet" recovery UI never
shows (wallet_needs_unlock requires uses_password), so this banner is the
user's only signal, and each site fires once behind wallet_open_attempted.
Letting it vanish after 9s is exactly the reported bug.

Chain disable_auto_dismiss() on all 13 token-screen wallet-open error
banners (burn, claim, destroy-frozen-funds, direct-purchase, freeze,
mint, pause, resume, set-price, transfer, unfreeze, update-config,
token-creator) so they persist until the user dismisses them. Validation,
lookup, and progress (with_elapsed) banners are left on their default
timers.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016tKDqE5RvAzFhMdN7r7cFB
Audit the identity/key/identity-hub screens and stop the auto-dismiss
timer on banners that report something the user genuinely needs to act
on: damaged-wallet recovery notices, identity/key data that failed to
load, key add/remove/backup failures, and a transfer blocked by a
missing signing key. These could vanish after 9s before the user reads
them, with no way to recall them. Routine input-validation errors,
success/info notices, and in-progress (with_elapsed) waits keep their
default timer.

18 call sites switched to disable_auto_dismiss across 10 files.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016tKDqE5RvAzFhMdN7r7cFB
…lets/tools/app

Audited every MessageBanner::set_global / .raise / set_message call site in the
contracts_documents, wallets, tools, app, and network-chooser screens. Banners
reporting genuinely user-affecting failures (data loss, a core feature broken,
funds/asset-lock/broadcast outcomes, connectivity down) must not vanish on the
5/9s timer before the user can read them — especially async results that land
when the user is not watching. Made these persistent via disable_auto_dismiss():

- app.rs: generic backend-task error banner (the fallthrough for unhandled send/
  shield/asset-lock/contract/document failures), migration-failed banner (has a
  "Retry now" action), network-context-creation failure, SPV-start failure,
  Disconnected, SPV-sync-failed, and cold-start "wallet stuck" banners.
- create_asset_lock / send / document_action screens: the damaged-wallet
  "saved data looks damaged — re-add from recovery phrase" open failure.

Left untouched: successes, info/progress notices, with_elapsed live-wait banners,
routine input/format/insufficient-balance validation shown where the user types,
and no-side-effect tool-screen lookup failures.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016tKDqE5RvAzFhMdN7r7cFB
cargo +nightly fmt --all wraps the raise_persistent signature across
multiple lines (line-length); this was flagged but deliberately left
untouched by each banner-audit worktree agent since it fell outside
their assigned file scope.

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

Code Review

Incremental review for ec2d2e5d. The latest delta (866bbf5f..ec2d2e5d) adds the wallet balance categorization work, persistent-banner API/call sites, backend-e2e retest docs/tests, and changelog/formatting updates. Cumulatively, all three prior suggestions from 866bbf5f are still valid at the current head and are carried forward; the latest delta adds one new in-scope suggestion for account-summary/address-table consistency.

Source: reviewers: opus (claude-general failed: usage limit), gpt-5.5 (codex-general), opus (claude-rust-quality failed: usage limit), gpt-5.5 (codex-rust-quality); verifier: gpt-5.5 (recovered after opus verifier failed: usage limit); specialists: rust-quality.

Prior reconciliation:

  • P1 from 866bbf5f is STILL VALID and carried forward: both funding-wizard show_wallet_balance labels still read .total while sibling gates use .spendable().
  • P2 from 866bbf5f is STILL VALID and carried forward: Top-Up asset-lock recovery still leaves the primary button enabled when no funding is selected.
  • P3 from 866bbf5f is STILL VALID and carried forward: Top-Up wallet pre-selection still uses snapshot_has_balance() instead of the spendable/fee-sufficient predicate.
  • Correction: the poster initially emitted two auto-resolution replies for P1/P3; those replies were corrected because both findings remain valid at ec2d2e5d.

New findings in latest delta:

  • src/ui/wallets/account_summary.rs:322-340: snapshot-only funded addresses are now counted in account tab totals, but the selected account address table still renders only wallet.known_addresses, so the expanded row list can omit the address that explains the new tab total.

Carried-forward prior findings:

  • src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs:22-24 and src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs:21: show_wallet_balance() still displays snapshot_balance(...).total, while the surrounding funding gates use .spendable() to decide whether identity creation/top-up can proceed.
  • src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs:136-142: the Top-Up asset-lock flow always enables the Top Up Identity button, but top_up_identity_clicked(FundingMethod::UseUnusedAssetLock) returns AppAction::None when self.funding_asset_lock is None.
  • src/ui/identities/top_up_identity_screen/mod.rs:166-171: the single-wallet Top-Up default still passes snapshot_has_balance() into default_funding_state, so dust/immature/otherwise insufficient funds can recommend UseWalletBalance and then immediately hit the spendable/fee-sufficient insufficient-funds banner.

🟡 4 suggestion(s)

🤖 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 `src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs`:
- [SUGGESTION] src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs:22-24: Carried forward: wallet funding label shows total instead of spendable balance
  Prior finding P1 is STILL VALID. `show_wallet_balance()` displays `snapshot_balance(...).total`, while the surrounding funding gate uses `.spendable()` to decide whether identity creation can proceed. The Top-Up mirror has the same issue at `src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs:21`, so wallets with immature or locked funds can show a positive Wallet Balance immediately before the flow says the wallet does not have enough Dash. Display the same spendable balance that the funding checks use.

In `src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs`:
- [SUGGESTION] src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs:136-142: Carried forward: Top-Up asset-lock button remains enabled with no selection
  Prior finding P2 is STILL VALID. The Top-Up asset-lock screen always enables the `Top Up Identity` button, but `top_up_identity_clicked(FundingMethod::UseUnusedAssetLock)` returns `AppAction::None` when `self.funding_asset_lock` is `None`. That lets the primary action silently do nothing until the user selects unfinished funding. Gate the button on `self.funding_asset_lock.is_some()` so the required selection state is visible in the UI.

In `src/ui/identities/top_up_identity_screen/mod.rs`:
- [SUGGESTION] src/ui/identities/top_up_identity_screen/mod.rs:166-171: Carried forward: Top-Up pre-selects wallet funding for dust balances
  Prior finding P3 is STILL VALID. The single-wallet Top-Up default still passes `snapshot_has_balance()` into `default_funding_state`, which only means the wallet has a positive total balance. The later insufficient-funds banner uses `spendable_covers_minimum(spendable_duffs, estimate_identity_topup())`, so a wallet with dust, immature funds, or otherwise insufficient spendable funds can be recommended and then immediately blocked. Use the same spendable and fee-sufficient predicate for the default recommendation.

In `src/ui/wallets/account_summary.rs`:
- [SUGGESTION] src/ui/wallets/account_summary.rs:322-340: New: snapshot-only address totals have no matching table rows
  The latest delta adds a second summary pass for funded addresses present in the wallet-backend snapshot but missing from `wallet.watched_addresses`, so those balances now appear in the account tab totals. The selected account's address table still builds rows only from `wallet.known_addresses.iter()` in `src/ui/wallets/wallets_screen/address_table.rs:135-137` and then filters that list by account. Any address counted only by this new snapshot pass can make a tab show funds while the expanded address list for that tab omits the row that accounts for them. Extend the table's data source with the same snapshot address balances/paths used by the summary, or register those snapshot addresses into the wallet metadata before rendering.

lklimek and others added 3 commits July 7, 2026 16:38
Rework the shared AddressInput autocomplete for usability with many
addresses across categories.

- Search DSL: GitHub-style `type:core|platform|shielded|identity` and
  `wallet:<name>` tags plus free text. Type values prefix-match the kind
  (restricted to enabled kinds), wallet values substring-match the owning
  wallet; tags of the same key OR, distinct keys and free text AND.
  Unrecognized `key:value` shapes and bare `type:`/`wallet:` degrade to
  free text / no-op so half-typed tags never blank the list. Parsing is
  centralized in ParsedQuery so a third tag key is one match arm.
- Structured entries: AddressEntry now carries wallet_name and name_label
  instead of a baked composite string. Core/Platform always get a wallet
  name (no more multi-wallet text prefix); Identity/Shielded get none.
  name_label holds the DPNS/alias for identities and "change" for change
  addresses.
- Pill rendering: each row paints [wallet pill] address (name) [type pill]
  balance, using theme tokens (accent-tinted wallet pill vs neutral type
  pill, full-radius). Rows also expose an accessible label for a11y/tests.
- Dynamic placeholder: when no explicit hint is set, the field shows a
  live `type:… wallet:…` legend built from enabled kinds and loaded
  wallets (capped at five with a "(+N more)" indicator). Send Dash screen
  drops its static hint to pick this up.
- Tests: query-parser and entry-population unit tests in-module; new
  tests/kittest/address_input.rs covers the dynamic legend, pill/name
  presence per kind, and tag-query filtering.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016tKDqE5RvAzFhMdN7r7cFB

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

Code Review

Incremental review for 5671b9c4. The latest delta (ec2d2e5d..5671b9c4) adds the AddressInput tag-search UI/test work plus changelog/docs updates. Cumulatively, all four prior suggestions from ec2d2e5d are still valid at the current head and are carried forward; the latest delta adds one new in-scope suggestion for tag-query validation.

Source: reviewers: opus (claude-general, failed: usage limit), gpt-5.5 (codex-general), opus (claude-rust-quality, failed: usage limit), gpt-5.5 (codex-rust-quality); verifier: gpt-5.5 (recovered after opus verifier failed: usage limit); specialists: rust-quality.

Prior reconciliation:

  • P1 from ec2d2e5d is STILL VALID and carried forward: the identity-create and Top-Up wallet-balance labels still display total balance while their funding gates use spendable balance.
  • P2 from ec2d2e5d is STILL VALID and carried forward: the Top-Up asset-lock button is still enabled when no asset lock is selected and dispatches to a no-op.
  • P3 from ec2d2e5d is STILL VALID and carried forward: the single-wallet Top-Up default still uses a total-positive balance predicate instead of the spendable/fee-sufficient predicate.
  • P4 from ec2d2e5d is STILL VALID and carried forward: account summaries still count snapshot-only funded addresses that the selected account address table cannot render.

Carried-forward prior findings:

  • src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs:22-24: Wallet funding label shows total instead of spendable balance.
  • src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs:136-142: Top-Up asset-lock button remains enabled with no selection.
  • src/ui/identities/top_up_identity_screen/mod.rs:166-171: Top-Up pre-selects wallet funding for insufficient balances.
  • src/ui/wallets/account_summary.rs:322-340: Snapshot-only address totals have no matching table rows.

New findings in latest delta:

  • src/ui/components/address_input.rs:1207-1208: Tag searches are still validated as destination addresses.

🟡 5 suggestion(s)

🤖 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 `src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs`:
- [SUGGESTION] src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs:22-24: Wallet funding label shows total instead of spendable balance
  This funding step displays `snapshot_balance(...).total`, while the insufficient-funds gate immediately below it checks `snapshot_balance(...).spendable()` with `spendable_covers_minimum()`. `DetWalletBalance::total` intentionally includes immature or locked funds that coin selection cannot use, so the screen can show a positive Wallet Balance and then block the same wallet as unable to fund identity creation. The Top-Up wallet-balance screen has the same mismatch, so funding-adjacent labels should display the spendable amount used by the gate.

In `src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs`:
- [SUGGESTION] src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs:136-142: Top-Up asset-lock button remains enabled with no selection
  The required funding choice is stored as `Option<OutPoint>`, but the primary `Top Up Identity` button is always enabled. When `funding_asset_lock` is `None`, `top_up_identity_clicked(FundingMethod::UseUnusedAssetLock)` returns `AppAction::None`, so clicking the main action silently does nothing instead of showing that a funding item must be selected. Gate the button on the option state so the UI enforces the same invariant required by task construction.

In `src/ui/identities/top_up_identity_screen/mod.rs`:
- [SUGGESTION] src/ui/identities/top_up_identity_screen/mod.rs:166-171: Top-Up pre-selects wallet funding for insufficient balances
  The single-wallet Top-Up default still passes `snapshot_has_balance()` into `default_funding_state`, which only proves that confirmed or unconfirmed total balance is positive. Later in the same flow, wallet funding is correctly blocked with `spendable_covers_minimum(spendable_duffs, estimate_identity_topup())`. A wallet with dust, immature, locked, or otherwise insufficient spendable funds can therefore be recommended for wallet funding and then immediately rejected. Use the same spendable and fee-sufficient predicate for the default recommendation.

In `src/ui/wallets/account_summary.rs`:
- [SUGGESTION] src/ui/wallets/account_summary.rs:322-340: Snapshot-only address totals have no matching table rows
  The summary pass counts funded addresses present in the wallet-backend snapshot but missing from `wallet.watched_addresses`, so those balances can appear in account tab totals. The selected account's address table still builds rows only from `wallet.known_addresses.iter()` before filtering by account. Any address counted only by this snapshot pass can make a tab show funds while the expanded address list omits the row that accounts for them. Extend the table data source with the same snapshot address/path data or register those addresses into wallet metadata before rendering.

In `src/ui/components/address_input.rs`:
- [SUGGESTION] src/ui/components/address_input.rs:1207-1208: Tag searches are still validated as destination addresses
  The latest delta makes `type:` and `wallet:` valid search tags for filtering autocomplete rows, but the validation state still treats the same `input_text` as a final address after `has_blurred` is set. Typing a query such as `type:core wallet:alpha` is longer than three characters, so the text-change path sets `has_blurred = true`; this branch then calls `validate_input()`, `detect_address_type()` returns `Unknown`, and the component displays the invalid-address warning while matching rows are being shown. Suppress final address validation while the focused input contains recognized search tags, or validate only after the user selects a row or leaves the field without a matching selection.

lklimek added 4 commits July 8, 2026 10:39
…esign' into feat/identity-onboarding-ux

# Conflicts:
#	CHANGELOG.md
…0-into-869

# Conflicts:
#	src/ui/wallets/wallets_screen/mod.rs
…o feat/identity-onboarding-ux

# Conflicts:
#	CHANGELOG.md
@lklimek
lklimek merged commit 6fd0abf into docs/platform-wallet-migration-design Jul 8, 2026
4 checks passed
@lklimek
lklimek deleted the feat/identity-onboarding-ux branch July 8, 2026 13:41

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

Code Review

Source: reviewers: claude-general (opus, failed rc=1), codex-general (gpt-5.5), claude-rust-quality (opus, failed rc=1), codex-rust-quality (gpt-5.5); verifier: gpt-5.5; specialists: rust-quality

At f39d08b, all five prior findings are still valid and remain in scope for this PR's cumulative UI and wallet-backend migration changes. The latest delta only removes a blank line from CHANGELOG.md, so there are no new latest-delta code findings; one additional cumulative Top-Up balance-label mismatch is also valid.

Prior reconciliation:

  • prior-1: STILL VALID — Create Identity wallet funding label still displays total balance while the funding gate uses spendable balance.
  • prior-2: STILL VALID — Top-Up asset-lock action remains enabled with no selected unfinished funding and still no-ops.
  • prior-3: STILL VALID — Top-Up still recommends wallet funding from a positive-balance predicate instead of the spendable/fee-sufficient predicate.
  • prior-4: STILL VALID — account summaries still count snapshot-only funded addresses that the expanded address table cannot render.
  • prior-5: STILL VALID — AddressInput tag queries are still validated as final destination addresses.

Carried-forward prior findings:

  • src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs:22-24: wallet funding label shows total instead of spendable balance.
  • src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs:136-142: Top-Up asset-lock button remains enabled with no selection.
  • src/ui/identities/top_up_identity_screen/mod.rs:166-172: Top-Up pre-selects wallet funding for insufficient balances.
  • src/ui/wallets/account_summary.rs:280-293: snapshot-only address totals have no matching table rows.
  • src/ui/components/address_input.rs:1207-1208: tag searches are validated as destination addresses.

New findings in latest delta (67b81031..f39d08b0):

  • None. The latest code delta only removes one line from CHANGELOG.md.

Additional cumulative finding:

  • src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs:21-23: the Top-Up wallet-balance label has the same total-vs-spendable mismatch as the carried-forward Create Identity finding.

🟡 6 suggestion(s)

5 additional finding(s) omitted (not in diff).

🤖 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 `src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs`:
- [SUGGESTION] src/ui/identities/add_new_identity_screen/by_using_unused_balance.rs:22-24: Create Identity balance label shows unusable funds
  This panel displays `snapshot_balance(...).total`, but the immediately following insufficient-funds gate uses `snapshot_balance(...).spendable()` with the fee-aware minimum check. `total` can include immature or locked funds that coin selection cannot spend, so the screen can show a positive wallet balance and then block the same wallet as unable to create the identity. Display the spendable amount used by the gate.

In `src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs`:
- [SUGGESTION] src/ui/identities/top_up_identity_screen/by_using_unused_balance.rs:21-23: Top-Up balance label shows unusable funds
  The Top-Up wallet-balance panel has the same mismatch: it displays `snapshot_balance(...).total`, while the funding gate below checks `snapshot_balance(...).spendable()` against the estimated top-up fee. A wallet with locked or immature funds can therefore look funded in the label and still fail the next check. Use the spendable balance consistently in this funding UI.

In `src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs`:
- [SUGGESTION] src/ui/identities/top_up_identity_screen/by_using_unused_asset_lock.rs:136-142: Top-Up asset-lock action stays enabled with no selection
  The required unfinished-funding choice is stored as `Option<OutPoint>`, but the primary `Top Up Identity` button is always enabled. When `funding_asset_lock` is `None`, clicking it calls `top_up_identity_clicked(FundingMethod::UseUnusedAssetLock)`, which returns `AppAction::None`, leaving a dead primary action with no feedback. Disable the action until an unfinished funding item is selected.

In `src/ui/identities/top_up_identity_screen/mod.rs`:
- [SUGGESTION] src/ui/identities/top_up_identity_screen/mod.rs:166-172: Top-Up preselects wallet funding without enough spendable balance
  The single-wallet Top-Up default feeds `snapshot_has_balance()` into `default_funding_state`, but that predicate only proves the wallet has some confirmed or unconfirmed total. The later Top-Up wallet flow blocks on `spendable_covers_minimum(spendable_duffs, estimate_identity_topup())`, so a wallet with dust, locked funds, immature funds, or too little spendable balance can be recommended and then immediately rejected. Use the same spendable and fee-aware predicate before recommending wallet funding.

In `src/ui/wallets/account_summary.rs`:
- [SUGGESTION] src/ui/wallets/account_summary.rs:280-293: Snapshot-only address totals have no matching table rows
  `collect_account_summaries()` now counts funded addresses present in the wallet-backend snapshot but missing from `address_paths` by bucketing them under `Other(Unknown)`. The expanded address table still builds rows only from `wallet.known_addresses`, then filters that row set by account. A snapshot-only funded address can therefore make the Other/System tab show a non-zero balance while the table has no row explaining which address holds those funds.

In `src/ui/components/address_input.rs`:
- [SUGGESTION] src/ui/components/address_input.rs:1207-1208: Tag searches are validated as destination addresses
  The component accepts `type:` and `wallet:` as autocomplete search tags, but after blur it validates the same non-empty query text as a final destination address unless the user selected an autocomplete entry. A query like `type:core wallet:alpha` can filter suggestions correctly and still show the invalid-address warning because `detect_address_type()` treats the tag syntax as unknown. Keep tag-containing input on the search path unless the user selects a suggestion or enters an actual address.

Comment on lines +166 to +172
let wallet_has_balance = {
let wallet_read = wallet.read().unwrap();
self.app_context
.snapshot_has_balance(&wallet_read.seed_hash())
};
let (recommended, _) = default_funding_state(wallet_has_balance);
*self.funding_method.write().unwrap() = recommended;

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.

🟡 Suggestion: Top-Up preselects wallet funding without enough spendable balance

The single-wallet Top-Up default feeds snapshot_has_balance() into default_funding_state, but that predicate only proves the wallet has some confirmed or unconfirmed total. The later Top-Up wallet flow blocks on spendable_covers_minimum(spendable_duffs, estimate_identity_topup()), so a wallet with dust, locked funds, immature funds, or too little spendable balance can be recommended and then immediately rejected. Use the same spendable and fee-aware predicate before recommending wallet funding.

Suggested change
let wallet_has_balance = {
let wallet_read = wallet.read().unwrap();
self.app_context
.snapshot_has_balance(&wallet_read.seed_hash())
};
let (recommended, _) = default_funding_state(wallet_has_balance);
*self.funding_method.write().unwrap() = recommended;
let wallet_can_afford_top_up = match wallet.read() {
Ok(wallet_read) => {
let spendable_duffs = self
.app_context
.snapshot_balance(&wallet_read.seed_hash())
.spendable();
let minimum_credits = self.app_context.fee_estimator().estimate_identity_topup();
crate::ui::identities::funding_common::spendable_covers_minimum(
spendable_duffs,
minimum_credits,
)
}
Err(_) => false,
};
let (recommended, _) = default_funding_state(wallet_can_afford_top_up);
*self.funding_method.write().unwrap() = recommended;

source: ['codex']

lklimek added a commit that referenced this pull request Jul 16, 2026
* refactor(ui): trim dev-history comments and dedupe identity home helpers

Rewrite sprint/wave/task-numbering comments in home.rs and hub_screen.rs as
present-tense invariants (git blame covers history); PR #842 kept as the one
citable regression reference. Move the duplicated network_label helper from
home.rs/import_single_key.rs into ui/theme.rs next to network_label_color.
Rename home.rs's format_credits_as_dash to format_credits_short to stop
colliding in name (but not behavior) with model::fee_estimation's version.
Drop the #[cfg(test)]-only forwarding shim and the dead-code import-pinning
stub in home.rs.

* refactor(wallet_backend): delete dead one-impl PersistedWalletLoader seam

The `loader: Arc<dyn PersistedWalletLoader>` field injected the backend
into itself through a trait object: the sole production impl,
`UpstreamFromPersisted`, was a unit struct whose whole body was
`backend.load_from_persistor_seedless(ctx).await`. No test substituted a
loader double — the cold-boot tests drive `load_from_persistor_seedless`
directly — so the seam bought nothing.

Remove the `PersistedWalletLoader` trait, the `UpstreamFromPersisted`
unit struct, the `loader` field and its constructor parameter, and the
two object-safety/`Default` compile-check tests. `register_persisted_wallets`
now calls `self.load_from_persistor_seedless(ctx)` directly. The
DET-opaque `LoadedWallets` / `PersistedLoadSkip` outcome types stay in
`loader.rs`. Stale doc/comment references to the removed type point at
`load_from_persistor_seedless` instead. No behavior change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* test(wallet_backend): dedupe InMemoryKv test fake across 14 files

Consolidate 13 byte-for-byte (or near-identical) copies of the
in-memory KvStore test fake into one canonical `kv_test_support`
module, following the existing `leak_test_support` shared-fixture
pattern. The shared fixture's `list_keys` always sorts — matching
kv.rs's own doc comment (which the duplicated unsorted copies
silently violated) and the 5 copies that already sorted explicitly;
no caller depended on unsorted (insertion) order.

`single_key.rs`'s fixture is a structurally different fake (global-only
BTreeMap<String, Vec<u8>> with scope assertions) and is left as-is.
`FailingKv` in kv.rs is not duplicated elsewhere and is left in place.

Registering the shared module requires one additive line in
wallet_backend/mod.rs (mirroring the leak_test_support declaration) so
context/ and backend_task/migration/ can reach it too.

* refactor(wallet_backend): split god-impl into shielded/identity_ops/payments

The single `impl WalletBackend` block in `mod.rs` spanned ~3,100 lines
across many domains. Following the pattern `hydration.rs` / `dashpay.rs`
already established (each an additional `impl WalletBackend` block in its
own sibling file), relocate three domain groups verbatim — no visibility,
ownership, or behavior change:

- `shielded.rs`   — the 14 Orchard shielded-pool methods (already fenced).
- `identity_ops.rs` — register/top-up identity, ensure-managed, and the
  platform-address funding methods (incl. the private
  `provision_identity_funding_account` helper).
- `payments.rs`   — send_payment / create_asset_lock_proof /
  broadcast_transaction / assert_can_sign and the
  `derive_private_key_from_held` helper (the funds-signing path).

Domain-exclusive private helpers stay in `mod.rs` (`map_shielded_op_error`,
`map_identity_*`, `map_platform_address_fund_error`, `DEFAULT_BIP44_ACCOUNT`)
and are reached from the sibling modules via `use super::` — child modules
see ancestor privates, exactly as `dashpay.rs` reaches `self.inner.*`.
Shared methods (`hd_scope`, `resolve_wallet`) remain in `mod.rs`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(wallets): remove redundant balance-consistency health check

The end-of-SPV-sync health check compared each wallet's authoritative
Core/Platform totals against a second, independently derived per-category
total and warned the user when they disagreed. A runtime detector that
tells the user the app's own bookkeeping disagrees with itself is a
symptom, not a fix — the follow-up commit makes the per-account breakdown
single-sourced, so the two figures can no longer diverge by construction.

Removes:
- AppState::run_wallet_balance_health_check + the dedupe signature/banner
  fields and BALANCE_HEALTH_WARNING copy
- collect_wallet_balance_mismatches / balance_health_signature and their tests
- BackendTaskSuccessResult::WalletBalanceHealthCheckRequested and the
  EventBridge SyncComplete emitter that produced it
- the model::wallet::balance_consistency module (no other callers)

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(wallets): single-source the per-account balance breakdown

The wallets screen derived its per-account breakdown a second time from
the legacy in-memory `Wallet` model (watched_addresses + per-address
platform_address_info), in parallel with the backend's authoritative
totals. The two derivations had diverged in shipped history, which is
what motivated the (now removed) health check.

Source the breakdown entirely from the backend:

- collect_account_summaries now takes only the display snapshot's
  address_balances + address_paths (no `&Wallet`) and computes the Core
  per-category totals from that single dataset. Platform credits leave
  the breakdown entirely: the Platform tab reads the one authoritative
  figure, AppContext::platform_balance_duffs — the exact value the wallet
  header shows — so the tab and header can no longer disagree.
- The Platform tab is shown from the coordinator snapshot signal
  (a positive balance or a completed platform-address sync), preserving
  the empty/receive tab without consulting the legacy model.

Behavior is preserved for the numbers users see; the change is the data
source. The legacy `Wallet` model's balance/UTXO fields are no longer read
by the breakdown (see report for its remaining uses).

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* docs(context): correct platform_sync_info doc to "sync completed", not "funds found"

The cursor advances on every successful platform-address sync pass regardless
of whether it found funded addresses (see event_bridge summary_ok_sync_cursors),
so `Some` means "a sync pass completed," not "a funded address was reported."
The old wording misleads anyone reasoning about the Platform-tab visibility gate
that reads this accessor (QA-005).

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(wallets): read header total and per-account breakdown from one snapshot generation

QA-001: the snapshot's headline balance and its UTXO-derived per-address
breakdown were two independently-refreshed fields. `recompute` always read the
lock-free `wallet.balance()` atomics for `.balance`, but only refreshed
`.address_balances` when `try_state()` won the lock — on contention it carried a
stale breakdown forward beside a fresh total. The wallet-header total
(`core_balance_duffs` -> `.balance.total`) and the Core tab sum
(`collect_account_summaries` over `.address_balances`) could therefore disagree
for the duration of any lock-contention window. The atomics are also maintained
by a separate event handler that can lag the wallet state under its own map
contention, so even off-contention the two sources could skew.

Fix: derive the headline balance from `state.balance()` (the stored
`WalletCoreBalance`, refreshed alongside every UTXO mutation under the same
wallet-manager write lock) read from the SAME `try_state()` guard as
`state.utxos()`. Balance and breakdown now reflect one generation of wallet
state. On contention, carry the ENTIRE prior (already-consistent) snapshot
forward — balance included — instead of splicing a fresh total onto a stale
breakdown. The non-blocking property is preserved: `try_state()` still yields
`None` under contention and never blocks the event callback.

QA-003: replace the tautological pinned test. The old
`two_funded_bip44_accounts_keep_distinct_per_account_totals` summed hand-fed
literals back to themselves and asserted zero Platform facts. Add
`header_total_reconciles_with_core_tab_breakdown_through_real_accessors`, which
publishes a realistic snapshot through the real `publish` seam — including a
funded address outside the generated-path window — and asserts the Core-tab sum
from `collect_account_summaries` equals the exact `.balance.total` the header
renders, proving no funded address is dropped. The old test's misleading
header-agreement comment is corrected to describe what it actually pins.

Adds `contention_carries_whole_prior_snapshot_...` and a store round-trip test
covering the carry-forward invariant.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(wallets): reconcile default-mode tabs and show Platform tab on load

Extracts the tab-visibility logic into a pure, unit-testable `plan_account_tabs`
so these rules have real coverage (the existing kittest suite is generic
frame-stability smoke with no wallet loaded).

QA-004: the Platform tab was gated on `platform_balance_duffs > 0 ||
platform_sync_info(..).is_some()`, so a freshly created/imported wallet showed
no Platform tab — not even empty, no receive address — until the first async
platform-address sync pass completed. If sync was slow, failed, or the network
was unreachable, the user's only in-app route to their Platform receive address
stayed hidden indefinitely. Every HD wallet unconditionally bootstraps a
platform-payment address at load (`Wallet::bootstrap_known_addresses`), so the
tab is now shown immediately (empty until funded).

QA-002: any balance in a non-visible ("system") category — `Other(Unknown)`,
CoinJoin, etc. — was only reachable via the developer-mode System tab. A
default-mode user saw a header total that included those funds with no visible
tab summing to them, exactly the drift class the deleted health check warned
about. Default mode now surfaces a consolidated "Other" tab whenever a
non-visible category holds funds, so the visible tabs always reconcile the
header total. The System-tab content gains a short explanation and lists only
funded categories in default mode.

QA-006: add a de-dup guard so the dedicated Platform push never produces a
second Platform tab if a future upstream bump folds the platform-payment pool
into `all_accounts()`. Pinned by `plan_account_tabs` tests plus an upstream
tripwire test (in snapshot.rs) asserting today's exclusion still holds.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* docs(wallets): note the accepted first-contended-recompute zero-snapshot edge case

When the very first recompute for a wallet loses the try_state() race there is no
prior snapshot to carry forward, so the all-zero default is published and the
wallet is marked as having a snapshot. A wallet with genuine prior funds can then
render "0 DASH, synced" for one event cycle before the next event wins the lock
and publishes the real balance. Documented as a known, accepted, self-healing
edge case.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(identity): show spendable balance, not total, on funding screens

show_wallet_balance() on both the Create-Identity and Top-Up
"use wallet balance" screens read DetWalletBalance.total, while the
insufficient-funds banner, gate, and picker on the same screens all
read .spendable(). With immature or CoinJoin-locked funds present,
the user saw a positive "Wallet Balance" directly contradicted by a
"not enough Dash" banner one line below. Switch both to .spendable()
so all four surfaces agree.

Raised on PR #869 review (thepastaclaw); verified still live post-merge.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* docs(wallets): document deferred non-remember-unlock registration gap

Full-repo audit CODE-005 (untriaged) found that handle_wallet_unlocked's
None-passphrase early return skips drive_unlock_registration, so a
non-remember unlock never re-registers the wallet with the upstream SPV
backend until next launch. User decision 2026-07-08: defer rather than
fix now, to keep the adjacent CODE-024 cleanup (Wave 11) unconstrained.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(wallets): tidy wallet-backend caches and trim dead surface

Wave 9 of the wallet-backend architecture audit — caches & nits.

- Avatar cache eviction now orders entries by a sibling `det:avatar_ts:`
  timestamp index (small i64 reads) instead of deserializing every cached
  image's full bytes on each put. put/invalidate/clear/evict keep the index
  in lock-step with the byte entries.
- Trim test-only / over-public wallet-backend surface: gate `wallet_count`
  and `AuthPubkeyCacheView::delete` behind `#[cfg(test)]`; make the
  `AVATAR_TTL_MS`, `MAX_AVATAR_ENTRIES`, and `DASHPAY_REQUEST_EXPIRY_DAYS`
  constants private; delete the unused `shielded_activity`/`shielded_notes`
  stubs; correct the stale `ensure_wallets_registered` migration-engine doc.
- Name the Devnet/Regtest SPV P2P ports and collapse `spv_primary_peer_socket`
  into one match with an early `_ => None`.
- Unify the two SPV error-snippet truncations under one
  `SPV_ERROR_SNIPPET_MAX` constant and drop the shadowing `use` lines in
  `on_platform_address_sync_completed`.
- Drop the dead `TokenBalanceSnapshot` re-export.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(context): consolidate identity_db kv access, errors, and vote helpers

Wave 6 of the architecture audit — context/identity_db.rs plus the shared
kv-access surface it touches.

- CODE-001: replace the `format!("{:?}", identity_type)` Debug-repr
  discriminator (four writers) and the hardcoded string filters with a
  stable `IdentityType::as_tag()` / `from_tag()` mapping. Writer and filter
  now share one source of truth, immune to a variant rename. Adds a
  round-trip test.
- CODE-007: extract `hydrate_stored_identity()`, shared by the bulk-load
  and single-get paths so both reconstruct an identity identically.
- CODE-014: introduce per-domain `err`-style free fns (`identity_err`,
  `scheduled_vote_err`, `top_up_err`, `contract_err`, `token_err`,
  `contest_err`) replacing the verbose `.map_err(|source| …)` closures and
  the fully-qualified error paths; collapse the three `*_kv()` accessors
  into one `AppContext::det_kv()`.
- CODE-035: add `scheduled_vote_keys()` and `remove_vote_voter_from_index()`
  helpers; the three hand-rolled list/delete/prune loops shrink to a few
  lines.
- CODE-041: delete the dead `load_local_qualified_identities_in_wallets`
  and its speculative `#[allow(dead_code)]`.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(ui): delete dead UI surface and dedup icon loaders

Wave 20 dead-UI-surface cleanup:

- Delete the unused `left_wallet_panel.rs` (no opener anywhere) and its
  module declaration.
- Consolidate the three copied `Assets`/`load_icon`/`load_svg_icon`
  RustEmbed icon loaders into one shared `components/icons.rs`; drop the
  dead copy in `top_panel.rs` and the duplicate in `left_panel.rs`.
- Remove dead styled widgets `GlassCard`, `HeroSection`, `AnimatedIcon`,
  `AnimatedGradientCard` and `styled_text_edit_multiline`, plus their
  catalog rows in `components/README.md`.
- Collapse `StyledButton` to its single reachable configuration (drop the
  never-constructed `ButtonVariant`/`ButtonSize` enums and arms); remove
  the commented-out `StyledCard` builders and dead `title` field/branch;
  remove the inert `GradientButton::glow` field/builder and its no-op
  call site in `left_panel.rs`.
- Drop the six blanket `#[allow(dead_code)]` blocks in `theme.rs`. This is
  a library crate, so `dead_code` never fires on `pub` items; clippy
  `--all-features --all-targets -D warnings` is clean without them, so no
  per-item `#[expect(dead_code)]` is warranted (it would be unfulfilled).
- Delete five zero-caller `helpers.rs` items (`BUTTON_ADJUSTMENT_PADDING_TOP`,
  `render_key_selector`, `is_platform_address`, `PLATFORM_ADDRESS_HINT`,
  `PLATFORM_ADDRESS_EXAMPLES`); the `is_platform_address_string` re-export
  stays (four live callers).
- Delete `OptionBannerExt::replace` (unused alias + its essay); drop the
  duplicate inherent `AmountInputResponse::{is_valid,has_changed}` (the
  `ComponentResponse` impl provides them); `add_connection_indicator`
  returns `()`.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(wallet_backend): dedup funds paths and harden error typing (Wave 2)

Wave 2 of the architecture audit — wallet-backend funds paths and error
integrity. Behavior-preserving throughout; funds/secret-adjacent code kept
conservative.

- CODE-004: extract `WalletBackend::seed_wallet` for the repeated
  `from_seed_bytes` construction; replace fabricated
  `PlatformWalletError::{WalletCreation,AssetLockTransaction,InvalidIdentityData}`
  string wraps with typed `SeedWalletBuildFailed` /
  `IdentityFundingAccountProvisionFailed` variants carrying the real
  `#[source]` (`key_wallet::Error`).
- CODE-011: replace `unreachable!("handled by pre-flight")` in
  `map_shielded_op_error` with a defensive `WalletBackend` fallthrough so an
  ambiguous shielded-spend result can never panic a funds path.
- CODE-012: rewrite the DashPay adapter module doc in present tense and fix
  the inverted sidecar-scope comment (2 Global / 4 Identity families).
- CODE-015: delete dead `flush_persister` (+ orphaned
  `WalletPersistenceFlushFailed`) and `broadcast_transaction`; keep the
  documented single-key signing chokepoint `sign_single_key` (intentional,
  test-exercised infra awaiting single-key send) but fix its
  source-discarding `map_err` via a typed
  `SingleKeySignFailed { #[source] DetSignerError }`.
- CODE-025: parse identity funding intent once into a local `Funding` enum —
  the repeated `AccountType` matches, `unreachable!` arms and now-impossible
  `UnsupportedIdentityFundingAccount` disappear; fix the semantically-wrong
  `WalletRegistrationXpubMismatch` reuse in `upstream_identity_from_seed`
  (-> `WalletStateInconsistent`).
- CODE-029: collapse `record_sent`/`record_incoming_contact_request` into one
  `record_contact_request(..., direction)` over a 2-variant enum; the public
  names stay thin wrappers.
- CODE-034: extract a `with_managed` closure helper for the 4x DashPay view
  find-wallet -> kv -> state -> managed_identity preamble.
- CODE-046: collapse the byte-identical `contact_sidecar_key` into
  `sidecar_key`.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(wallet): scope test-only single-key signing helpers to tests

`SingleKeyView::sign_with`, `raw_key_bytes`, and the `sign_message_with_raw_key`
free fn were production-visible but reachable only from unit tests — production
JIT single-key signing goes through `SecretAccess` + `DetSigner`, which signs
inline. Move all three behind `#[cfg(test)]` (next to the tests module) and gate
their now-test-only `Message`/`Signature` imports. Delete the dead
`has_passphrase` method (zero callers) and its stale doc.

Audit R2 CODE-010.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(wallet): dedup secret decrypt, bincode framing, prompt meta & key mapping

Wave 1 of the R2 architecture audit — secret access & signing surface dedup.
No behavior change: error mappings and length validation are preserved exactly.

- CODE-003: extract one `decrypt_message` + two-variant `DecryptError` in
  model/wallet/encryption.rs; route all three AES-GCM legacy readers
  (decrypt_hd_seed, SingleKeyEntry::decrypt, ClosedKeyItem::decrypt_seed)
  through it. Those readers are retained deliberately — they decode secrets
  already written to users' disks pending the lazy Tier-2 re-wrap, so this is
  the safe local dedup, NOT the upstream per-secret migration. See
  docs/ai-design/2026-07-08-secret-decrypt-dedup. Wave-16 CODE-087 still applies
  unchanged (encryption.rs is kept).
- CODE-031: make `identity_key_from_bytes` and `identity_flavored` pub(crate);
  route IdentityKeyView::get/get_protected through the shared length check
  (standardizing get's mapping onto IdentityKeyMalformed); drop the hand-rolled
  SecretSeam->IdentityKeyVault map in seal_new_identity_key_with_password.
- CODE-038: extract `versioned_bincode::{encode_tagged, decode_tagged_or}`;
  wire wallet_seed_store and SingleKeyEntry encode/decode through it, per-format
  fallback staying a closure.
- CODE-039: maybe_remember takes the plaintext by value and moves it into the
  cache box (copied once, not twice); the duplicated per-variant boxing match
  is gone.
- CODE-050: merge the identical WalletPromptMeta/IdentityPromptMeta into one
  PromptMeta.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(wallet-backend): dedup KV/sidecar layer

Consolidate the machinery behind the network-scoped KV sidecars and
offline caches so five near-identical patterns live in one place.

- Generic `SidecarView<V>` (new `sidecar.rs`): the wallet-meta,
  identity-meta, and auth-pubkey-cache views become thin typed wrappers
  parameterised by infix, value type, scope, and error mapper. Domains
  needing a legacy-format fallback override `SidecarValue::read`
  (WalletMeta's dual-format migration + one-shot re-store).
- One `network_prefix` in `kv.rs`, imported at 7 sites (SPV storage
  paths, migration sentinels, the four sidecar keys). The MCP
  `network_display_name` keeps its distinct Regtest->"local" mapping.
- `kv_get_logged` / `kv_get_or_default` in `kv.rs` replace seven
  read-then-default/None call sites (selected wallet/identity, DashPay
  timestamps, avatar + contact-profile caches, auth-pubkey cache via the
  generic view).
- One `map_kv_storage_error` funnel behind all five sidecar error
  mappers; adds `TaskError::ContactProfileCacheStorage` so contact-profile
  failures stop misreporting as `AvatarCacheStorage`.
- One `bip44_account0_xpub` helper replaces four copies of the
  fund-routing gate's BIP44 account-0 predicate (2 production + 2 test).

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(dashpay): typed errors + move derivation to model/ (Wave 13)

Mechanical typed-error and placement pass across the DashPay backend
subdomain, plus supporting cleanups.

- CODE-068 + CODE-051: move the pure DIP-14/DIP-15 derivation files to
  `model/dashpay_derivation/{dip14,hd}.rs` and introduce a typed
  `DerivationError` (`#[from]` bip32/secp256k1), replacing ~stringly
  `Result<_, String>` derivation signatures. Wire it into `DashPayError`.
- CODE-051: replace the four `DashPayError::Internal { message }` boundary
  wraps with typed `TaskError` at their source functions
  (`payments::load_payment_history`, `register_dashpay_addresses_for_identity`,
  `generate_auto_accept_proof`); add a typed `KeyVerificationError` for the
  three identity voting/owner/payout key checks; carry the per-vote
  `DPNSVoteResults` error as `Arc<TaskError>` instead of a pre-formatted
  String.
- CODE-053: carry DashPay payment amounts as `u64` duffs end-to-end
  (task field, backend fn, `DashPayPaymentSent` success variant); the UI
  resolves duffs at its edge — no f64 crosses the backend boundary.
- CODE-055: drop the redundant `encryption_tests.rs` (its three checks are
  already covered by superior `#[cfg(test)]` tests in `encryption.rs`);
  delete the module decl and the dead task builders.
- CODE-059: migrate the two UI callers to `Display`; delete `user_message()`.
- CODE-060: delete `ckd_pub_256`, the legacy `send_payment_to_contact`
  wrapper (rename `_impl`), the dead `profile::send_payment` /
  `identity_to_child_number`, `From<String>`, the `ToDashPayError` trait,
  the `DashPayResult` alias, the unused error-factory helpers, and the
  now-unconstructed `Internal` + dead taxonomy variants, with their
  speculative allows.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(wallets): single-source fee/amount/dpns and drop dead send surface

Wave 4 architecture-audit cleanup. Consolidates duplicated fee, amount, and
DPNS logic onto single sources of truth and removes a dead send dialog.

- CODE-090: replace the 9-arg estimate_contract_create_detailed with a
  ContractComponents struct; delete the argument-ignoring from_platform_version
  (no callers); /1000 -> /CREDITS_PER_DUFF; derive CREDITS_PER_DASH from
  DASH_DECIMAL_PLACES.
- CODE-095: move estimate_platform_fee, both transition-based estimators,
  AddressAllocationResult and allocate_platform_addresses[_with_fee] out of
  send_screen.rs into model/fee_estimation.rs; hoist ESTIMATED_BYTES_PER_INPUT
  to one module constant. Add unit tests for the convergence, shortfall and
  fee-payer/destination paths.
- CODE-093: consolidate all credits/duffs->DASH display formatting on the model
  formatters (add format_duffs_as_dash); delete the private format_dash/
  format_credits copies, the local CREDITS_PER_DUFF re-declaration and the
  hand-rolled float conversions; one trimmed-Amount precision policy.
- CODE-077: Amount::partial_cmp returns None unless is_same_token, keeping
  ordering consistent with equality.
- CODE-092: strip_dash_suffix branches on has_dash_suffix and slices once;
  validate_dpns_input returns a fieldless NonDashDomainError.
- CODE-103: move account_summary into ui/state (non-widget view state).
- CODE-099: delete the unreachable SendDialogState, render_send_dialog,
  prepare_send_action, the field/init/render call and orphaned imports.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(dashpay): unify avatar pipeline, profile validation, delete dead editor

Wave 17 — DashPay UI cleanup (three findings).

PROJ-003 + CODE-097 — single avatar pipeline. Add a rendering `Avatar`
component (`ui/components/avatar.rs`) backed by an `AvatarCache` fetch state
(`ui/state/avatar_cache.rs`) that dispatches through the App Task System
(`DashPayTask::FetchAvatar` → `BackendTaskSuccessResult::DashPayAvatar`).
Disk-cache consult/populate now happens once, in the backend task
(`avatar_processing::fetch_avatar_cached`). The three screens
(contact_profile_viewer, contacts_list, profile_screen) delegate to the
component instead of each running a raw `tokio::spawn` with its own texture
map and decode/stash copies. No orphaned frame-loop spawns remain.

CODE-094 — one profile-field validator. Add `validate_profile_fields` plus
`MAX_*_CHARS` constants and `ProfileFieldError` to `model/dashpay.rs`
(char-count, matching the protocol). The backend size check and both editors
(profile_screen, identity settings) delegate to it, collapsing four divergent
copies — including the avatar-URL cap, unified on the DIP-0015 value of 2048.
Empty display name is decided legal (matches the backend and DIP-0015).

CODE-100 — delete the dead `contact_info_editor.rs` (no opener anywhere) and
its `ui/mod.rs` wiring. Extract the shared nickname/note/hidden save into
`persist_contact_private_info`, used by the three live inline editors
(contact_profile_viewer, contact_details, contacts_list).

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(tokens): honest fees, shared token executor, grouped contract params

Structural fee honesty and token-op deduplication across the token backend:

- FeeResult.actual_fee is now Option<u64> with a FeeResult::estimated_only
  constructor; the 22 sites that faked an actual fee by passing the estimate
  twice now report an estimate only, so the UI/MCP no longer claim a settled
  fee the platform never returned.
- Extract AppContext::execute_token_op: a single executor owning the SDK-call
  error mapping, post-broadcast side effects, and the fee tail. All 11 token
  state-transition ops shrink to their builder setup plus a delegation.
- Introduce TokenContractParams, replacing the 26-field RegisterTokenContract
  variant and the 26-argument build_data_contract_v1_with_one_token with one
  grouped struct; delete the always-NotTradeable marketplace_trade_mode field
  and its dead selector (its match arms were identical).
- run_token_task now matches the owned task, moving fields into handlers
  instead of cloning, aligning with document.rs/dashpay.rs.

Consumers (send screen, MCP identity/masternode outputs, e2e assertions)
updated for the Option-typed actual fee.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(backend): typed contract recovery + document mutation helper

Remove fragile string parsing and duplication from the contract/document/
contested-names recovery paths:

- Delete extract_contract_id_from_error (parsed the contract id out of an
  error message string). register/update now use data_contract.id(), already
  in scope before broadcast, and share one AppContext::recover_contract_after_
  proof_error helper built on log_drive_proof_error with named refetch delays.
- Add a shared log_contested_proof_error for the GroveDB proof-failure shape
  the three contested-resource queries surface, collapsing three identical
  logging blocks; run_contested_resource_task now matches the owned task.
- Extract DocumentTask::fetch_document_for_mutation (fetch-by-id + bump
  revision) used by transfer/purchase/set-price, and convert the six
  multi-field DocumentTask tuple variants to named-field struct variants for
  readable construction at the UI call sites.
- Document/contract fee tails switch to FeeResult::estimated_only.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(model): enforce model-layer purity and tidy MCP tool boundary

Wave 15 of the architecture audit — strip upward edges out of `model/`,
type the MCP tool errors, and consolidate the tool helpers.

- PROJ-005: move `RootScreenType`/`ThemeMode` into `model::settings`
  (re-exported from `ui`); invert the `model → backend_task` error edges in
  `passphrase.rs` and `wallet/mod.rs` via model-local error enums wired into
  `TaskError` with manual `From` impls. `qualified_identity` keeps `TaskError`
  because the `SecretAccess::with_secret` chokepoint contract requires it
  (documented).
- CODE-070: relocate `FeatureGate` + predicate to `context/` (dead
  `FeatureGateUiExt` deleted); move token `From` conversions next to their UI
  types; `IdentityStatus → Color32` mapping to `ui::theme`; model-local
  `MasternodeInputError` converted to `McpToolError` at the tool boundary.
- CODE-072: move GroveSTARK proof generation/verification into
  `backend_task::grovestark` (data types + serialization stay in `model`),
  drop 59 info-level hex dumps, type `GroveSTARKError` with `#[source]` fields.
- CODE-073: `qualified_identity_public_key` extracts `find_wallet_path` and
  warn-skips malformed network-supplied key data instead of panicking.
- CODE-080/081/082/083: delete dead items (gate test-only ones with
  `#[cfg(test)]`), collapse the auth-key accessors behind
  `authentication_keys_matching`, drop dead `RequestType` u8 conversions and
  rename the module to `request_type`, delegate `borrow_decode` to `decode`.
- CODE-079: `tool_ctx()` returns `McpToolError` natively — kills the lossy
  `McpError → String` round-trip at all 26 tool invocations.
- CODE-085: fold the blank-`network` check into `resolve::require_network`;
  merge `validate_amount`/`validate_credits` into `validate_positive_amount`.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(app): collapse boot/reconcilers, fold context_provider, drop identity-hub flag

Wave 12 of the full-repo architecture audit — app.rs boot path, feature
flags, and the context provider.

PROJ-001: collapse the four duplicated eager wallet-backend init shapes
(boot, network switch, post-onboarding auto-start, manual Connect) into one
`AppState::spawn_backend_init` parameterized by a `BackendInitReason`. Extract
the per-frame reconcilers accreted on `AppState` into small `update()`-style
structs under `src/app/reconcilers.rs` — `AccessibilityActivator`,
`SpvBlockReconciler`, `ConnectionBanner`, and `MigrationReconciler` (the latter
two return a `BackendTask` for `AppState` to dispatch, keeping the channel
chokepoint in one place). Reduces `AppState` from ~13 flat reconciler fields to
four cohesive members; no behavior change.

PROJ-004: move scheduled-vote casting off the UI thread into a new
`ContestedResourceTask::CastDueScheduledVotes` backend task. The 60s tick only
dispatches; the DB query, identity load, and casting run in the task; the DPNS
Scheduled Votes screen learns progress via `display_task_result`
(`ScheduledVotesInProgress` then per-vote `CastScheduledVote`). Removes the two
frame-aborting `return`s and names the 2-minute lateness window
(`SCHEDULED_VOTE_MAX_LATENESS_MS`).

PROJ-006: delete the `identity-hub` and `identity-hub-activity-feed` Cargo
features and every `cfg` fallback branch — the hub is now always built and
registered; the Activity tab renders its gated "coming soon" message
unconditionally.

PROJ-008: fold `context_provider_spv.rs` into `context_provider.rs`. Drop the
unused `db` field and `_db` params, make `SpvProvider::new` infallible, and
replace the `Mutex` with an `Arc<ArcSwapOption>` so the manual `Clone` impl and
lock-poison plumbing disappear. Keeps the `SYSTEM_CONTRACT_COUNT` compile check.

PROJ-009: give dir/env/logger boot setup a single owner,
`boot::prepare_environment()`, called from both `main` and
`AppState::boot_inputs`; the logger's `Once` guard keeps the second call a
no-op. Preserves the `testing`-cfg `boot_inputs` split.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* fix(backend_task): update stale proof_log_item import after Wave 15 rename

Missed in the Wave 15 merge commit -- contested_names/mod.rs's
log_contested_proof_error (added by Wave 3) imported RequestType from
the old model::proof_log_item path, which Wave 15 renamed to
model::request_type. Same collision class as the two request_type
import conflicts resolved in that merge, just not flagged by git
since the lines didn't overlap.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(context): tidy contract_token_db — typed encode error, dedup, param & fn moves

Wave 7 of the round-2 architecture audit on context/contract_token_db.rs:

- CODE-018: propagate TokenConfiguration encode failures through a new typed
  TaskError::TokenConfigSerialization variant instead of silently no-oping;
  drop the pre-C7 tombstone comment.
- CODE-019: extract load_sorted_tokens(); both token listers map its output,
  killing the warn-vs-silent drift on unparseable token keys.
- CODE-030: drop three dead parameters — get_contracts pagination
  (limit/offset, all callers passed None,None), ConnectionStatus::tooltip_text
  app_context, and request_to_det_contact's unused ContactRequest.
- CODE-033: move remove_wallet to context/wallet_lifecycle.rs, next to
  register_wallet and its existing tests.
- CODE-044: iterate the system contracts for the five get_contracts insertion
  blocks; fold the five system-contract load blocks in context/mod.rs into one
  local closure.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(backend_task): consolidate error.rs and replace message-as-protocol with typed signals

Wave 14 — error.rs consolidation + typed messages.

CODE-061: add `consensus_cause(&SdkError) -> Option<&ConsensusError>` used by all
three extraction sites; replace the intermediate `ConsensusKind` enum in
`From<SdkError>` with per-arm constructor closures so each of the 13
consensus→TaskError mappings is written exactly once.

CODE-066: replace `TaskError::MustRetry(String)` with the typed
`CoreWalletAutoDetected { wallet_name }` — the sentence lives in `#[error(...)]`,
no user-facing String field. Update the app.rs consumer and the unit test.

CODE-062: delete the `NO_IDENTITIES_FOUND` string constant and the
message-text comparison in tokens_screen; route the no-identities case through
the existing typed `TaskError::NoIdentitiesFound` via a new `display_task_error`
hook (also fixes a latent refresh-spinner hang).

CODE-065: add typed success variants `AssetLockBroadcast { txid }`,
`DashPayAddressesRegistered { addresses, contacts, errors }`, and
`IdentitiesLoaded { count }`; backends stop composing conditional grammar
fragments and sentence assembly moves to the UI/app layer as complete
i18n-clean strings. create_asset_lock_screen reads `txid` from the variant
instead of parsing it out of the message string.

CODE-069: delete the empty `impl BackendTaskSuccessResult {}` and collapse the
identity `match` in `run_backend_tasks_sequential` to a direct push.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(context): consolidate wallet_lifecycle orchestration (Wave 11)

Wave 11 placement/dedup pass over context/wallet_lifecycle.rs, no behavior
change to production flows.

- Fold the start_spv -> spawn_backend_start -> run_backend_start chain into
  the async ensure_wallet_backend_and_start_spv chokepoint (the only
  production start path); retarget the two orphaned tests onto the
  wallet_backend() wiring gate and the wiring-does-not-start invariant.
- handle_wallet_unlocked now takes `&str` instead of `Option<&str>`, making
  the inert no-passphrase case unrepresentable: delete the two provably
  no-op `(wallet, None)` callers (cold-boot bootstrap loop and
  try_open_wallet_no_password) and gate the unlock popup's call to the
  keep-unlocked branch only. The deferred non-remember-registration note
  moves verbatim to the popup's non-remember branch, where that decision
  now lives. try_open_wallet_no_password keeps a dead `_app_context` param
  for now (TODO(cleanup) logged) to avoid a ~40-callsite UI sweep mid-batch.
- Hoist one shared `copy_dir_recursive` test helper (two nested copies) and
  route the two inline `INSERT INTO wallet` blocks through the existing
  seed_legacy_unprotected_hd_wallet_row helper.
- Strip the issue7 test's eprintln scaffolding, rewrite its assertions in
  present-tense guard voice (a pass is now the invariant, not a "reproduced"
  bug), and rename migration_status' failed_state test to state what it
  asserts.
- Add a module-doc note marking wallet_lifecycle.rs as the intentional thin
  AppContext-delegation layer, distinct from wallet_backend's upstream
  orchestration.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(identities): consolidate funding-method chooser + preserve explicit picks

Wave 5 — identity funding screens + PR-869 fold-ins.

CODE-096: move `FundingMethod` (enum, labels, `default_funding_state`) into
`funding_common.rs` so the create-identity and top-up screens share one type;
extract a `wallet_selection_combo` picker (parameterised label + enabled) used
by all three screens and an `actionable_asset_locks` gate shared by both
unused-funding pickers; fix the ungrammatical wallet-selection heading to an
i18n-clean sentence.

F2: sweep the residual RwLock-poisoning `.read()/.write().unwrap()` pattern in
the funding-screen cluster to graceful forms — `TopUpIdentityScreen` gains
`current_step`/`set_step`/`current_funding_method` helpers; the balance and
asset-lock sub-screens and both `by_platform_address` step sites degrade
instead of panicking; `update_wallet`'s `.expect("wallet lock poisoned")`
becomes `is_ok_and`.

F3: track whether the user has explicitly chosen a funding method. On a wallet
switch the create screen recomputes its default pre-selection only while no
explicit choice has been made; once a method is picked, a switch preserves it
untouched (new pure `funding_method_after_switch`, unit-tested for both cases).
Removes the anchoring `TODO(bilby)`.

F4: the single-wallet Top-Up default now uses
`spendable_covers_minimum(spendable, estimate_identity_topup())` instead of
`snapshot_has_balance`, so a dust/locked balance is never pre-selected then
immediately blocked.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(context): remove write-only Core-RPC health plumbing (CODE-016)

The rpc_online / rpc_last_error fields, their getters/setters,
update_from_chainlocks, the handle_task_result ChainLocks arm, the
set_rpc_last_error(None) writer in core, and the dead reset_timer had
zero readers anywhere — connection health is sourced entirely from SPV
and DAPI state. Delete them; the surviving ChainLock arm just refreshes
overall state.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* fix(context): make settings updaters atomic, drop dead shims (CODE-027, CODE-042)

CODE-027: the update_* methods did a read-modify-write across two
separate lock acquisitions (get_app_settings then set_app_settings),
so concurrent updates could lose writes. Introduce update_app_settings,
which runs the whole read → mutate → persist cycle under one held
cached_settings write guard (the same SettingsCacheGuard scheme), and
route every updater through it. Factor the uncached load out of
get_app_settings so both paths share it. Add a sequential RMW test and
a concurrent-flip test proving no field update is lost.

CODE-042: delete the zero-caller get_settings legacy shim,
update_user_mode, and update_show_evonode_tools.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(context): extract shared platform-address seeding loop (CODE-023)

apply_platform_address_push and warm_start_platform_addresses carried an
identical per-address inner loop (hash → canonical address → info-write →
signer registration), differing only in set- vs seed-if-absent semantics.
Extract seed_platform_address_entries taking the info-write as a closure;
both entry points become thin batch adapters.

Also collapses default_platform_version's four identical match arms to the
constant (CODE-045).

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(context): name DPNS contest-duration constants (CODE-040)

Replace the inline 14-day / 90-minute literals in
contest_duration_for_network with named MAINNET_CONTEST_DURATION and
NON_MAINNET_CONTEST_DURATION constants carrying a spec reference, and
note that the joinable window is the first half of the contest.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor: small context/kv one-liner cleanups (CODE-045)

- Inline ConnectionStatus::spv_connected (status.is_active()) at its sole
  caller and delete the wrapper; drop the now-unused import.
- delete_scheduled_vote / insert_scheduled_votes take &str / &[..] instead
  of &String / &Vec, dropping the clippy::ptr_arg allow.
- Delete the map_kv_error identity wrapper; call sites use
  KvAdapterError::Store directly, with its rationale folded into the
  variant doc.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(ui): Wave 19 — dedup UI component surface

CODE-107: Extract one generic add_subscreen_chooser_panel + nav_button
(subscreen_chooser_panel.rs); the four dashpay/dpns/tokens/tools panels
now build item lists and delegate. Move ToolsSubscreen next to the tools
screens (ui/tools/mod.rs), matching its siblings.

CODE-109: Extract modal_chrome (backdrop + centered bordered Window) from
passphrase_modal; rebase passphrase_modal and the confirmation/selection/
info dialogs onto it. Dedupe the NOTHING sentinel into modal_chrome. Drop
ConfirmationDialog's write-only `status` field (current_value never read it).

CODE-110: Rewrite ScreenType::eq as explicit payload arms + discriminant
equality (no `_ => false`). Collapse the seven ScreenLike delegation methods
onto one exhaustive delegate_to_screen! macro — a missing variant is now a
compile error. (Macro, not a dyn accessor, to preserve inherent-method
resolution for screens with an inherent refresh.)

CODE-113: Extract key_eligibility, render_key_combo, render_no_eligible_key_group
and render_info_section in ui/helpers.rs; the two key choosers and two success
screens delegate. Unify the divergent no-eligible-key wording.

CODE-115: Wire the contract-chooser right-click via Response::context_menu on
the header row (Copy Hex / Copy JSON), removing the unreachable manual Window
and its three dead state fields; derive Default; flatten the font-size ladder.

CODE-117: Extract stage_progress + window_fraction in network_chooser_screen;
the five progress calculators shrink to thin wrappers.

Also folds in a stray cargo-fmt import-order fix in
backend_task/contested_names/mod.rs (Wave 15 rename residue).

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(wallet): Wave 16 — wallet model internals

Model-layer cleanups across the wallet crate. All error paths in
model/wallet now carry typed WalletError up to the TaskError boundary;
the platform-payment registration, coin-type mapping, and AES-GCM
envelope shapes are single-sourced.

- CODE-071: model/wallet/mod.rs derivation/registration functions return
  Result<_, WalletError> instead of stringly errors (~17 KeyDerivation
  erasures + 5 bare erasures gone). New typed WalletError variants:
  PublicKeyParse, AccountDerivationPath, PlatformAddressConversion,
  AddressNetworkMismatch. TaskError::WalletAddressProviderSetupFailed
  now holds a typed #[source] instead of a String. database/utxo.rs
  get_utxos_by_address returns rusqlite::Result.
- CODE-076: delete Wallet::coin_type + four inline network matches; call
  the canonical coin_type_for_network everywhere.
- CODE-078: extract Wallet::register_platform_payment_entry; the five
  duplicated known/watched insert blocks collapse to one call. The
  vestigial post-T-W-01 `register` param on
  generate_platform_receive_address_with_seed is dropped.
- CODE-087: replace the (Vec<u8>,Vec<u8>,Vec<u8>) crypto triple (and its
  type_complexity allows) with a named EncryptedEnvelope struct.
- CODE-088: one summary log per platform-address sync; the per-key dumps
  in WalletAddressProvider::on_address_found and QualifiedIdentity::sign
  move behind their failure paths, off the hot loop.
- CODE-089: delete the unused DASH_SECRET_MESSAGE constant.
- CODE-091: cross-link + status-mark the three single-key modules (LIVE
  imported-key sidecar vs the LEGACY Decision-#7 runtime/DB pair).

cargo clippy --all-features --all-targets -D warnings clean; full lib
suite (1364 tests) green.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(wallet): fold shielded screens into unified send screen (CODE-098)

The three standalone shielded screens (shield / shielded-send / unshield)
duplicated flow logic the unified WalletSendScreen already owns end to end
(dispatch + result handling for every shield/unshield/private-send path).
Consolidate them into routes on the one canonical send screen.

- Add `SendFlow` preset {General, Shield, ShieldedSend, Unshield}. A preset
  locks the source — and, for Shield, auto-targets the wallet's own pool with
  a sentinel shielded destination (the shield dispatch ignores the destination
  address) — so the screen shows only the controls that flow needs while
  reusing the unified validation, fee/amount limits, and dispatch.
- Extract shared shielded-recipient parsing into
  `model::address::parse_shielded_recipient` (Bech32m or 43-byte hex) so the
  send dispatch and any validation path cannot diverge.
- Route the Shielded tab's Shield / Send (Private) / Unshield buttons to open
  the unified send screen pre-configured for the flow.
- `ScreenType::WalletSendScreen` now carries the `SendFlow`; remove the three
  `ScreenType`/`Screen` shielded variants and delete the standalone screen
  files.

Behavioral parity preserved for all five shielded dispatches. One delta:
raw-hex shielded recipient entry is dropped from the UI (AddressInput accepts
canonical Bech32m only); the parser still accepts hex at dispatch.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* refactor(tokens): Wave 18 — unify token action screens + dedup rules renderers

Collapse the seven near-identical single-shot token action screens (pause,
resume, freeze, unfreeze, destroy-frozen-funds, burn, mint) onto one
parameterised scaffold, and merge the two duplicated control-rule renderers.

- Add `TokenActionScreen<A: TokenAction>` (ui/tokens/token_action_screen.rs):
  the shared shell — authorization resolution, wallet unlock, advanced key
  chooser, per-action form slot, public note, fee estimate, confirmation
  dialog, success screen and status. Each action supplies only its diffs
  (labels, rules accessor, form, task builder, success variant) via the
  `TokenAction` trait; the seven screens become thin `type` aliases + a small
  action struct. Net ~3,900 lines removed.
- Fold the token authorization check into the shared scaffold's one call site
  via the previously zero-caller `check_token_authorization`; also route
  `update_token_config`'s inline resolver through it.
- Merge `render_mint_control_change_rules_ui` into
  `render_control_change_rules_ui` via an optional `MintRecipientSection`,
  deleting the ~180-line duplicate; update all call sites.
- `change_context` now rebinds token-screen context through `.common` via a
  `set_app_context` setter and a `common_set` macro arm.

Deferred (TODO markers in-file): set_token_price migration onto the scaffold
(large pricing form; verb-based auth message template does not fit "set price"
grammatically) and the TokensScreen god-struct per-subscreen split.

cargo fmt + clippy (all-features, all-targets) clean; lib unit tests and the
kittest suite pass.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* fix(wallet): address QA findings on shielded send-flow fold

- QA-002: Shield-from-Platform "Max" now reserves the two-action shielded-fee
  headroom (>50M credits) instead of the plain platform-transfer estimate
  (~8M). ShieldFromBalance pays the shield fee from the same balance as the
  amount, so the old reserve under-shot ~6x and a Max attempt was rejected
  upstream. New model helper `shield_from_balance_fee_headroom` keeps the fee
  math in model/fee_estimation.rs. Shield-from-Core parity was already correct.
- QA-001: restore raw-hex shielded-recipient entry. `AddressKind::detect` and
  `AddressInput::validate_shielded` now accept the 43-byte (86-hex-char) form
  via the shared `parse_shielded_recipient`, matching what the old private-send
  screen advertised.
- QA-003: on a network switch, `WalletSendScreen` now drops the wallet seed
  hash, source, destination, and amount (`reset_for_network_switch`) so a
  preset flow can no longer resurrect stale cross-network state / balance.

Tests: model coverage for the fee headroom (asserts the shielded-fee reserve,
not the transfer estimate) and for hex shielded detection at both the model
and AddressInput layers.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* docs(comments): Wave 21 — comment/narration hygiene sweep

Strip development-history narration and ephemeral review IDs from comments;
keep present-state invariants only. No executable logic changed.

- CODE-021: rewrite archaeological rationale (det_platform_signer, snapshot,
  wallet_backend/mod, secret_seam, wallet_seed_store, wallet_lifecycle
  stop_spv); dedup the AlreadyOpen restart-in-place rationale to one copy.
- CODE-067: present-state the Phase B/D/E + Post-D4c narration in
  backend_task/shielded/mod.rs and dashpay.rs; stale "until Phase-E lands"
  reworded now the push writer exists.
- CODE-084: drop RUST-001 / 6a2818cd IDs from fee_estimation.rs and
  wallet/single_key.rs comments; keep the durable TS-DBG-01 test-spec ID.
- CODE-102: delete the shielded_tab tombstone (keep "Fund-moving results
  only."); present-state the "replaces the dropped/legacy…" docs in
  wallets_screen, contacts_list, contact_details.
- CODE-106: drop INTENTIONAL(CMT-010/RUST-003/CODE-003) prefixes and FIX N
  markers in theme, message_banner, address_input, add_new_identity_screen,
  key_info_screen.
- PROJ-007: remove the removed-subsystem ZMQ sentence and the "RPC, ZMQ"
  ConnectionStatus residue from CLAUDE.md; protoc v25.2+ verified against CI.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* docs(changelog): add round-2 audit user-facing changes

Adds Changed/Fixed entries for the genuinely user-observable outcomes
of the round-2 architecture audit (21 waves + CODE-098): the shielded
screens' fold into the unified Send screen, DashPay's now-optional
display name, two identity-funding UX fixes, the My Tokens
loading-spinner hang, and a settings-save race. Internal refactors,
dedup, and error-typing from the same round are intentionally omitted.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(identity): confine hero card gradient to card bounds

The Identity Hub hero card painted its 14%-opacity gradient band using
`ui.max_rect()` — the available space, not the card's content bounds — so
on the Home tab the band bled downward through every sibling widget below
the card (quick actions, onboarding checklist, recent activity).

Reserve a shape slot before laying out content, then fill it afterward
from `ui.min_rect()`, confining the band to the card's actual bounds. Add
unit tests asserting the strips stay within the given rect.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(errors): replace stringly-typed error variants with typed sources

Convert the largest cluster of `detail: String` TaskError variants to typed
`#[source]`/`#[from]` variants and delete the dead ones, tightening the
Display/Debug separation and reducing `result_large_err` pressure.

- platform_info: introduce a `WithdrawalParseError` source enum (platform-value
  field errors, missing/invalid timestamps, unrecognized status, boxed
  ProtocolError for the daily limit). `WithdrawalDocumentParsingError` now wraps
  it via `#[from]`; the two duplicated per-document formatting blocks are
  extracted into `format_withdrawal_line` / `format_completed_withdrawal_line`.
  `ShieldedSyncFailed` now carries `Box<SdkError>`.
- key input: move `verify_key_input` out of the backend into `model/key_input.rs`
  as the stateless single source of truth, returning a typed `KeyInputError`
  (NotHex / BadWif / UnsupportedLength) with complete, i18n-ready sentences.
  `KeyInputValidationFailed` becomes a transparent `#[from]` wrap, removing the
  double-naming and fragment concatenation; callers use `?`. Unit-tested.
- dashpay: delete the unconstructed `reason: String` variants BroadcastFailed,
  QueryFailed, PlatformError, RateLimited and their dead retry-classification
  clone arms; make the sole remaining recoverable variant `NetworkError`
  fieldless.
- delete unconstructed TaskError variants (WalletUtxoReloadFailed,
  WalletBalanceRecalculationFailed, WalletPaymentFailed, UtxoUpdateFailed,
  SerializationError, RpcProviderCreationFailed, AssetLockTransactionBuildFailed,
  ShieldedTreeUpdateFailed, ShieldedNullifierSyncFailed,
  ShieldedMerkleWitnessUnavailable); make InvalidPrivateKey and
  NetworkContextCreationFailed fieldless (their strings were hardcoded, not
  upstream errors).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs(contested-names): point contract-not-found TODOs at issue #875

The 'contract not found when querying from value with contract info'
substring match in the three contested-name query retry loops is a
deliberate workaround: the condition originates server-side as
QuerySyntaxError::DataContractNotFound and reaches the client only as a
gRPC Internal status with message text, so no client-side structural SDK
variant exists to match on yet. Reference the tracking issue at all three
sites.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(wallet): unify lock-poison recovery, route single-key I/O through the secret seam, and type encryption key hygiene

Three wallet-backend hardening changes.

- Lock-poison policy: add `wallet_backend/poison.rs` with `read_recover` /
  `write_recover`, which recover a poisoned `RwLock` guard instead of erroring.
  The single-key in-memory index and the secret session cache guard derived,
  rebuildable state, so recovery is correct and self-healing. Route the
  single-key index (imports, alias, forget, rehydrate, list) and the
  `SecretAccess` session cache (lookup, eviction, remember) through it, deleting
  the two lying poison mappings — `ImportedKeyNotFound` (told the user to
  re-import) and `SecretDecryptFailed` (claimed a decrypt failure).

- Secret seam: route every raw vault access in `single_key.rs` through
  `SecretSeam::{put_secret, get_secret, put_secret_protected, delete_secret}`
  instead of hand-rolled `SecretStore` calls, so imported keys honor the same
  chokepoint and failure variant (`TaskError::SecretSeam`) as their siblings.
  The verify-passphrase wrong-password signal is preserved by matching the
  seam's typed `SecretSeam` source structurally.

- Encryption hygiene: `derive_password_key` returns `Zeroizing<Vec<u8>>` and
  `ClosedKeyItem::decrypt_seed` returns `Zeroizing<[u8; 64]>` (copied straight
  into the zeroizing buffer, no bare stack copy), so the derived AES key and the
  decrypted seed wipe on drop. Introduce a typed `EncryptionError`
  (WrongPassword / Malformed / KeyDerivation / Encryption, Everyday-User
  messages) and return it from the encryption primitives and the two
  `ClosedSingleKey` crypto methods, replacing their `Result<_, String>`. The
  broad `SingleKeyData::open` / `WalletSeed::open` / `SingleKeyWallet::new`
  String APIs (pre-existing model/wallet debt that mixes crypto with key-parse
  errors) render the typed error through `Display` at the boundary; a full
  type-through of those APIs is deferred.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(address): centralize network-prefix validation in model/ and gate the credits-to-address MCP destination

Two coupled changes around address↔network validation.

- Single source of truth: add `validate_platform_address_for_network` and its
  Orchard twin `validate_orchard_address_for_network` to `model/address.rs`,
  returning a typed `AddressNetworkMismatch` (Everyday-User message). They parse
  the bech32m HRP (`dash1…` mainnet, `tdash1…` testnet, case-insensitive) and
  reject a cross-network address. `address_input.rs` delegates its hand-rolled
  `validate_platform` / `validate_shielded` prefix checks to these, keeping the
  same banner copy; the GUI's format/length/case checks stay put.

- Close the MCP network gap (funds-adjacent): `identity_credits_to_address`
  decoded the destination with `PlatformAddress::from_bech32m_string` and no
  network check, so a mainnet `dash1…` address could be paid on testnet (or
  vice-versa). Gate the parsed destination against `ctx.network()` via the new
  model validator, returning `InvalidParam` on mismatch — mirroring the withdraw
  tool's Core `require_network` guard. The required `network` param only pins the
  active network; it never validated the destination, which was the gap.

The `resolve::validate_address` first-Base58-char Core heuristic is left as-is:
it is a network-agnostic format sanity check with no network parameter, and Core
network validation is already performed via `Address::require_network` at each
tool. Adding a model Core validator would duplicate that with no clean
delegation target, so it is deferred rather than widened here.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(wallet): add AppContext::wallet_arc helper; log skipped corrupt address rows; drop per-item logging loops

Three wallet-layer cleanups from PR review.

- Dedup wallet lookup: add `AppContext::wallet_arc(&self, &WalletSeedHash) ->
  Result<Arc<RwLock<Wallet>>, TaskError>` as the single source of truth for the
  "look up a wallet arc or `WalletNotFound`" pattern, replacing 15 copy-paste
  blocks across backend_task/{wallet,identity,shielded} and context. The helper
  recovers a poisoned lock via `wallet_backend::poison::read_recover` rather than
  erroring: the in-memory wallet map is rebuildable, so recovery matches the
  Wave-2 poison discipline for rebuildable state. This is a behavior change on
  the rare poison path — the replaced sites previously surfaced `LockPoisoned`
  via `.read()?`; they now self-heal, consistent with `mcp::resolve::wallet_arc`
  (which now delegates to this helper and re-wraps the id-bearing MCP error).

- Loud failure on corrupt rows: `database/wallet.rs` `get_wallets` skipped
  unparseable address rows silently. Silently dropping an address could hide a
  missing key and lead to lost funds, so log a `warn!` (row index + error) and
  continue, matching the wallet_backend hydration skip-logging discipline.

- Drop per-item logging loops: `fetch_platform_address_balances` logged every
  address/balance/nonce and `transfer_platform_credits` logged every input
  address/amount at `info!`. Both keep their aggregate summary line; the
  per-address financial detail is removed — it violates the no-loop logging rule
  and should not sit in plaintext logs at the default level.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: replace panicking unwrap/expect in production paths with error propagation and graceful UI degradation

Eliminate every bare `.unwrap()` on the non-test production paths (~150 sites)
so a broken invariant degrades instead of aborting the process. Applied by
category:

- Lock poison recovery: extend `wallet_backend/poison.rs` with a `Mutex`
  `lock_recover` free fn plus ergonomic `RwLockRecover` (`read_recover` /
  `write_recover`) and `MutexRecover` (`lock_recover`) extension traits. Route
  the wallet/step/settings `RwLock` and the DPNS/identity/token-search `Mutex`
  screen-state locks — all rebuildable in-memory state — through them, so a
  thread panicking mid-update never wedges the UI. Unify the coordinator gate's
  action mutex on the same recovery policy (its `should_fire` already tolerated
  poison via `is_ok_and`, while `arm`/`try_fire`/`reset` panicked). The
  `Mutex<Connection>` gains a `Database::locked_conn()` helper that recovers the
  guard: a `rusqlite::Connection` carries no invariant a panic can break, so
  recovering avoids cascading one unrelated panic into every later DB call.

- Graceful UI fallback: egui frame paths return `AppAction`/`BackendTask` and
  cannot `?`. The `Option::unwrap()` selection reads now guard with `let-else` /
  `if let` and degrade — an actionable `MessageBanner`, an early return, or a
  logged skip — instead of panicking. The document-action builders share a new
  `require_selections()` helper that returns `BackendTask::None` with a banner
  when a selection is missing.

- Invariant expects: unwraps that are provably infallible after a preceding
  guard, on constants, or on a construction invariant are upgraded to
  `.expect("invariant: …")` so a future regression fails loudly with context
  rather than a bare panic. BIP32 child indices are documented as `< 2^31`
  (hardened constants, small coin type, and hash indices masked with
  `& 0x7FFFFFFF`).

The `dashpay_increment_send_index` mutex keeps its documented fail-loud
poison contract: a panic mid-increment can leave the address-index counter
inconsistent, and surfacing that is safer than handing out a duplicate index.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* chore: remove ephemeral review-IDs, tombstones, speculative dead_code, and a redundant predicate

Four small cleanups; every deletion grep-verified against both the lib and the
integration-test crates first.

- Ephemeral review-IDs: strip the per-run tags from committed source — the
  `RUST-002` tag on the app.rs banner-flash TODO (the substance and the #660
  issue link stay) and the `CODE-027` prefixes on two settings_db doc comments
  (replaced with a plain statement of the read-modify-write guarantee). The
  standards-body `RUSTSEC-2025-0141` reference is deliberately kept.

- Tombstones: drop the two deleted-code tombstones in `database/wallet.rs`
  `get_wallets` (git is the record) and renumber the trailing "step 8" to
  "step 4" so the step comments read coherently.

- Dead code: delete genuinely-unused speculative items and the code they guard
  — three unconstructed `BackendTaskSuccessResult` variants, the `CoreTask::
  GetBestChainLock` variant plus its handler / PartialEq arm / classification
  test (and the now-orphaned `AppContext::rpc_error_with_url` its handler was
  the sole caller of), a duplicate `decrypt_private_data`, an unused avatar
  `to_grayscale`, three unused `KeyStorage` accessors, an unused token-info
  constructor, a write-only `core_address` field, and a dead visualizer search
  field. Items that turned out to be live are handled correctly instead of
  deleted: `AppAction::Refresh`, `IdentityTask::SearchIdentityFromWallet`,
  `KeyStorage::keys_set`, and `send_screen`'s `selected_wallet_seed_hash` had
  stale `#[allow(dead_code)]` (the attribute is simply removed); `CORE_APPLICATION`
  is non-Linux-only, so it becomes `#[cfg(not(target_os = "linux"))]` and is only
  compiled where used; and `MessageBanner::{has_global, set_auto_dismiss}` plus
  `build_identity_registration` are exercised by the kittest / backend-e2e
  integration-test crates (a separate compilation the lib does not see), so they
  keep `#[allow(dead_code)]` with a reason comment rather than `#[expect]`, which
  would be unfulfilled under the `--all-targets` gate.

- Redundant predicate: inline `is_distinct_change_candidate` (a one-line
 …
lklimek added a commit that referenced this pull request Jul 27, 2026
…rors (#934)

* docs(identity): record identity-home action-row UX analysis

Diziet's job-to-be-done analysis of the Identity Home quick-actions
rows: six buttons currently resolve to only four destinations because
the original design-spec's recipient-less Send/Receive affordances
were never built and got silently re-pointed at the funding screens
instead. Records the recommended 4-button, non-redundant layout plus
the adjacent debt now folded into the same implementation fix.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(identity): collapse duplicate Identity Home action buttons

Identity Home rendered six action buttons resolving to only four
destinations: Send/Send-to-another-identity both opened Transfer, and
Receive/Add-funds both opened TopUp, at mismatched visual weights.
Both duplicates trace back to an unbuilt design-spec affordance
(a recipient-less Send sheet and an identity "Receive" QR view) that
got silently re-pointed at the funding screens instead of tracked as
a gap.

Collapses to one non-redundant row: Add funds (primary), Send to
wallet, Send to another identity, Add contact (secondary) — using
StyledButton/ComponentStyles and ui.horizontal_wrapped instead of the
ad-hoc button builders. Send to wallet is now gated on the identity
actually holding a usable withdrawal key, matching the Add contact
gating pattern, with an Everyday-User-appropriate disabled tooltip
instead of the old jargon-y dead-end message. Replaces the unit test
that pinned the duplicate routing as intended behavior with an
injectivity check over the action row's destinations.

Also folds in adjacent debt found during the same review: the PR #869
jargon cleanup (asset-lock/ASCII-arrow wait-status/"Wallet Balance"
phrasing) that missed the Top Up Identity screen, the resulting
label/title mismatch between the "Add funds" button and every screen
and CTA button downstream of it, and a duplicate IDN-013 user-story ID
plus two new [Gap] entries documenting the never-built Send/Receive
sheets.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs(identity): correct design note, record implementation status

The PR #869 cross-reference in the jargon-cleanup item was wrong --
add_new_identity_screen, create_asset_lock_screen.rs, and
dashpay/send_payment.rs still carry the identical unfixed jargon today,
confirmed independently. Records what actually landed vs. what's a
follow-up (jargon on those three screens; the three-way inconsistent
withdrawal-key gating criteria across Home/identities_screen/WithdrawalScreen).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs: add changelog entry for Identity Home action-row simplification

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: stack size must be at least 4 MB

* fix(wallet): distinguish consumed deposit rejections

Route identity funding SDK errors through the typed classifier so already-used deposits and insufficient balances retain their dedicated guidance.

Co-Authored-By: OpenAI Codex GPT-5 <[email protected]>

* fix: set thread count

* fix(wallet): classify already-consumed rejection in platform-address funding

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs: clarify Add funds screen reference in changelog entry

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(identity): reconcile withdrawal-key gating across Home, WithdrawalScreen, and the identities-list popup

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(wallet): preserve funding rejection guidance for unclassified SDK errors

Routing every PlatformWalletError::Sdk variant through the global SDK
classifier lost the operation-specific recovery envelope (retained
funding lock, affected identity, existing-lock instructions) whenever
the SDK error had no dedicated classification and fell into the generic
PlatformRejected bucket. Unwrap that specific bucket back into the
caller's IdentityCreateRejected / IdentityTopUpRejected /
PlatformAddressFundRejected envelope while still preferring richer
classifications (e.g. AssetLockOutPointAlreadyConsumed) when they apply.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(identity): gate withdrawal on keys the execution path can actually use

can_attempt_withdrawal's Developer branch treated any on-chain public
key (including an authentication-only key with no local private
material) as withdrawal-eligible. Nothing downstream honors that: the
withdrawal backend task always calls resolve_withdrawal_signing_key,
which accepts only a locally-held TRANSFER/OWNER key regardless of
role, and WithdrawalScreen's Developer-only on-chain-TRANSFER fallback
still left selected_key at None for an authentication-only identity —
rendering a blank form instead of a working withdrawal flow. Make the
predicate uniform across every role and drop the now-dead fallback key
selection in WithdrawalScreen::new.

Extend the Identity Home kittest coverage: assert the full four-button
action row renders exactly once, and that each enabled click routes to
its intended destination (previously only Send to wallet's disabled
state was asserted; render()'s (AppAction, HomeOutcome) result was
discarded).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs: changelog entries for stack-size crash fix and consumed-deposit guidance

The Unreleased section covered the Identity Home redesign but omitted
two other user-visible fixes already in this PR: the larger Tokio
worker stack that prevents a native crash during deposit verification,
and the dedicated non-retryable guidance for a deposit already
consumed by another operation.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Lukasz Klimek <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
Co-authored-by: OpenAI Codex GPT-5 <[email protected]>
orchardpaytl pushed a commit to orchardpaytl/orchardpay that referenced this pull request Jul 27, 2026
…rors (dashpay#934)

* docs(identity): record identity-home action-row UX analysis

Diziet's job-to-be-done analysis of the Identity Home quick-actions
rows: six buttons currently resolve to only four destinations because
the original design-spec's recipient-less Send/Receive affordances
were never built and got silently re-pointed at the funding screens
instead. Records the recommended 4-button, non-redundant layout plus
the adjacent debt now folded into the same implementation fix.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(identity): collapse duplicate Identity Home action buttons

Identity Home rendered six action buttons resolving to only four
destinations: Send/Send-to-another-identity both opened Transfer, and
Receive/Add-funds both opened TopUp, at mismatched visual weights.
Both duplicates trace back to an unbuilt design-spec affordance
(a recipient-less Send sheet and an identity "Receive" QR view) that
got silently re-pointed at the funding screens instead of tracked as
a gap.

Collapses to one non-redundant row: Add funds (primary), Send to
wallet, Send to another identity, Add contact (secondary) — using
StyledButton/ComponentStyles and ui.horizontal_wrapped instead of the
ad-hoc button builders. Send to wallet is now gated on the identity
actually holding a usable withdrawal key, matching the Add contact
gating pattern, with an Everyday-User-appropriate disabled tooltip
instead of the old jargon-y dead-end message. Replaces the unit test
that pinned the duplicate routing as intended behavior with an
injectivity check over the action row's destinations.

Also folds in adjacent debt found during the same review: the PR dashpay#869
jargon cleanup (asset-lock/ASCII-arrow wait-status/"Wallet Balance"
phrasing) that missed the Top Up Identity screen, the resulting
label/title mismatch between the "Add funds" button and every screen
and CTA button downstream of it, and a duplicate IDN-013 user-story ID
plus two new [Gap] entries documenting the never-built Send/Receive
sheets.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs(identity): correct design note, record implementation status

The PR dashpay#869 cross-reference in the jargon-cleanup item was wrong --
add_new_identity_screen, create_asset_lock_screen.rs, and
dashpay/send_payment.rs still carry the identical unfixed jargon today,
confirmed independently. Records what actually landed vs. what's a
follow-up (jargon on those three screens; the three-way inconsistent
withdrawal-key gating criteria across Home/identities_screen/WithdrawalScreen).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs: add changelog entry for Identity Home action-row simplification

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: stack size must be at least 4 MB

* fix(wallet): distinguish consumed deposit rejections

Route identity funding SDK errors through the typed classifier so already-used deposits and insufficient balances retain their dedicated guidance.

Co-Authored-By: OpenAI Codex GPT-5 <[email protected]>

* fix: set thread count

* fix(wallet): classify already-consumed rejection in platform-address funding

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs: clarify Add funds screen reference in changelog entry

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(identity): reconcile withdrawal-key gating across Home, WithdrawalScreen, and the identities-list popup

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(wallet): preserve funding rejection guidance for unclassified SDK errors

Routing every PlatformWalletError::Sdk variant through the global SDK
classifier lost the operation-specific recovery envelope (retained
funding lock, affected identity, existing-lock instructions) whenever
the SDK error had no dedicated classification and fell into the generic
PlatformRejected bucket. Unwrap that specific bucket back into the
caller's IdentityCreateRejected / IdentityTopUpRejected /
PlatformAddressFundRejected envelope while still preferring richer
classifications (e.g. AssetLockOutPointAlreadyConsumed) when they apply.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(identity): gate withdrawal on keys the execution path can actually use

can_attempt_withdrawal's Developer branch treated any on-chain public
key (including an authentication-only key with no local private
material) as withdrawal-eligible. Nothing downstream honors that: the
withdrawal backend task always calls resolve_withdrawal_signing_key,
which accepts only a locally-held TRANSFER/OWNER key regardless of
role, and WithdrawalScreen's Developer-only on-chain-TRANSFER fallback
still left selected_key at None for an authentication-only identity —
rendering a blank form instead of a working withdrawal flow. Make the
predicate uniform across every role and drop the now-dead fallback key
selection in WithdrawalScreen::new.

Extend the Identity Home kittest coverage: assert the full four-button
action row renders exactly once, and that each enabled click routes to
its intended destination (previously only Send to wallet's disabled
state was asserted; render()'s (AppAction, HomeOutcome) result was
discarded).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs: changelog entries for stack-size crash fix and consumed-deposit guidance

The Unreleased section covered the Identity Home redesign but omitted
two other user-visible fixes already in this PR: the larger Tokio
worker stack that prevents a native crash during deposit verification,
and the dedicated non-retryable guidance for a deposit already
consumed by another operation.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Lukasz Klimek <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
Co-authored-by: OpenAI Codex GPT-5 <[email protected]>
(cherry picked from commit cf68c05)
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.

3 participants