Skip to content

feat(wallet_backend): surface skipped persisted wallets via MessageBanner - #871

Merged
lklimek merged 4 commits into
docs/platform-wallet-migration-designfrom
feat/load-skip-banner
Jul 6, 2026
Merged

lklimek merged 4 commits into
docs/platform-wallet-migration-designfrom
feat/load-skip-banner

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Jul 2, 2026 •

Copy link
Copy Markdown
Collaborator

Why this PR exists

  • Problem: When persisted platform wallets fail integrity checks at load, they are silently skipped — the user sees fewer wallets with no explanation.
  • What breaks without it: Imagine you are a DET user whose store holds 3 wallets, one with a corrupt row. On next launch only 2 wallets appear and nothing tells you why — you assume funds/config are lost and start debugging blind. With this PR, a warning banner reports "1 wallet was skipped during loading…" immediately.
  • Blocking relationship: stacked atop feat: rewrite Dash Evo Tool onto the new platform-wallet #860 (docs/platform-wallet-migration-design); completes TODO(PROJ-010-T6).

What was done

  • New skipped_wallets_banner_text(usize) -> Option in wallet_backend/mod.rs (singular/plural wording), wired into register_persisted_wallets — raises MessageBanner::set_global(..., MessageType::Warning) when any wallet is skipped.
  • Replaced the stale TODO(PROJ-010-T6) comment in event_bridge.rs with a 2-line present-state note.
  • tests/kittest/skipped_wallets_banner.rs: egui_kittest harness tests (singular Warning banner with ⚠ icon and ❌ dismiss, plural wording, zero skips → no banner), mirroring the migration_banner.rs pattern.
  • Follow-up (review feedback): extracted the banner logic into raise_skipped_wallets_banner, a directly unit-testable free function, and retained its BannerHandle behind a Mutex on Inner so a re-entrant load pass (ensure_wallets_registered, after the migration engine) supersedes the previous banner instead of stacking a second, possibly contradictory one — and a later zero-skip pass clears it. Replaced the redundant no_skips_renders_no_banner kittest case (previously a verbatim duplicate of an inline unit test, no harness) with a harness-based render assertion. Corrected the register_persisted_wallets doc comment to note the banner.
  • Follow-up (API cleanup): OptionBannerExt::replace collides with the inherent Option::replace(value), which always wins method-call resolution — opt.replace(ctx, msg, msg_type) fails to compile against it (E0061), so the trait method was only reachable fully-qualified (and the trait's own doc example silently demonstrated code that doesn't compile, hidden by a ```ignore block). Added OptionBannerExt::raise as the collision-free preferred method (matching the sibling OptionOverlayExt::raise, which already avoided this name for the same reason), kept replace as a backward-compatible alias, and fixed the doc example.

Testing

  • cargo test --all-features --lib wallet_backend → 293/293 pass, incl. a test driving raise_skipped_wallets_banner through the rendered MessageBanner surface across three passes (singular → plural supersede → zero-skip clear); mutation-checked by temporarily reverting to the old fire-and-forget call and confirming the test fails.
  • cargo test --test kittest --all-features skipped_wallets_banner → 3/3 pass.
  • cargo test --all-features --lib message_banner and --lib progress_overlay → pass (unaffected by the rename).
  • cargo +nightly fmt --all -- --check and cargo clippy --all-features --all-targets -- -D warnings (whole workspace, covering every screen using OptionBannerExt) both clean.
  • The previously-noted limitation (banner wire-up not directly covered by a test) is now resolved.

Breaking changes

None — replace is preserved as a deprecated alias, not removed.

Checklist

Attribution

🤖 Co-authored by Claudius the Magnificent AI Agent

lklimek and others added 2 commits July 2, 2026 15:14
Corrupt persisted-wallet rows were only logged during load. Raise a
calm, singular/plural MessageBanner (Warning) from
register_persisted_wallets when LoadedWallets.skipped is non-empty,
with no row-derived detail in the banner text. Update the stale
event_bridge TODO to point at the new banner site.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01S2po24WxgfDKoWP61ueG2Q
Address QA-001: exercise the banner wiring end-to-end. Make
skipped_wallets_banner_text public and add a kittest harness test
mirroring migration_banner.rs that renders the Warning banner and
asserts the singular/plural copy, the warning icon, and the dismiss
control (plus the no-banner case for zero skips).

Address QA-002: trim the event_bridge on_wallet_skipped_on_load
comment to two present-state lines.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01S2po24WxgfDKoWP61ueG2Q
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

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

🗂️ Base branches to auto review (2)
  • master
  • v1.0-dev

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ea7f2015-da32-4901-a051-33ae7e174f56

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/load-skip-banner

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
lklimek marked this pull request as ready for review July 2, 2026 15:38
@thepastaclaw

thepastaclaw commented Jul 2, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Review complete (commit ba8ad71)

@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

Small, well-scoped PR that adds a Warning-typed banner when persisted wallets are skipped on load, backed by a pure skipped_wallets_banner_text helper (unit-tested) and kittest rendering coverage. Implementation follows the project's user-facing-message rules and the set_global chokepoint. Non-blocking findings: the actual wire-up in register_persisted_wallets is not itself covered by any test, one of the kittest cases doesn't exercise rendering, the doc comment above register_persisted_wallets is now stale, and a re-entry into the load pass with a different skip count would stack two contradictory banners because set_global dedupes only by exact text.

Source: reviewers: opus (general), claude-sonnet-5 (general), gpt-5.5[high] (general, failed), opus (rust-quality), claude-sonnet-5 (rust-quality), gpt-5.5[high] (rust-quality, failed); verifier: opus; specialists: rust-quality

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

Findings not posted inline (1)

These findings could not be anchored to the current diff, but they are still part of this review.

  • [NITPICK] src/wallet_backend/mod.rs:446-448: Doc comment on register_persisted_wallets no longer matches its behavior — The doc comment states so this pass only loads and logs, but this PR adds a MessageBanner::set_global call inside the function, so it now also raises a user-facing warning banner as a side effect. Update the comment so future readers of this async boot-path function see the accurate behavior.
🤖 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/wallet_backend/mod.rs`:
- [SUGGESTION] src/wallet_backend/mod.rs:464-470: Banner wire-up in register_persisted_wallets is not covered by any test
  The three kittest cases and the inline unit test only exercise `skipped_wallets_banner_text` and its rendering through `MessageBanner::set_global`. None assert that `register_persisted_wallets` actually invokes `set_global` with `outcome.skipped.len()` and `MessageType::Warning` — the two halves are recomposed manually in the tests. A regression that deletes lines 464–470, swaps the MessageType to `Info`, or reads the wrong length would leave every test green even though the invariant this PR was added to establish is gone. The PR body flags this as a known limitation shared with `migration_banner.rs`, but the wire-up is the actual behavior change and deserves coverage. A small backend test driving a stub loader that returns `LoadOutcome { skipped: vec![...] }`, calling `register_persisted_wallets`, and asserting a Warning banner lands on `ctx.egui_ctx()` would close the seam and also protect the `ensure_wallets_registered` re-run path.

In `tests/kittest/skipped_wallets_banner.rs`:
- [SUGGESTION] tests/kittest/skipped_wallets_banner.rs:70-76: `no_skips_renders_no_banner` never builds a Harness — it duplicates the unit test
  Unlike the two preceding cases, `no_skips_renders_no_banner` never constructs an `egui_kittest::Harness`, never calls `MessageBanner::set_global`/`show_global`, and never queries rendered output. Its body is `assert!(skipped_wallets_banner_text(0).is_none())`, which is already covered verbatim by `skipped_wallets_banner_text_singular_plural_and_none` in `src/wallet_backend/mod.rs:3855-3866`. The test name and module doc comment promise an integration-level check that the Harness renders no banner when the skip count is zero, but nothing is rendered — so a regression where `register_persisted_wallets` incorrectly calls `set_global` for a zero-skip outcome (or where `show_global` mishandles the empty case) would not be caught here. Either build a Harness that runs the same conditional-set/show pipeline as the other tests and asserts the ⚠ label is absent, or drop this case as redundant.

Comment thread src/wallet_backend/mod.rs Resolved
Comment thread tests/kittest/skipped_wallets_banner.rs Resolved
Comment thread src/wallet_backend/mod.rs Resolved
…nt load passes

The skipped-persisted-wallets warning banner was raised inline in
register_persisted_wallets via a fire-and-forget set_global with no
retained handle. A second load pass (ensure_wallets_registered, run after
the migration engine) with a different skip count stacked a second,
possibly contradictory banner, and a later zero-skip pass could not clear
a stale one.

Extract the banner logic into raise_skipped_wallets_banner, a directly
unit-testable free function, and retain the handle on Inner behind a Mutex
(the backend is Arc-shared and the pass runs on &self). Each pass now
supersedes the prior banner; a zero-skip pass clears it.

- Add an inline unit test driving the free function through the rendered
  MessageBanner surface: Warning type, replace-not-stack, and clear.
- Replace the redundant no_skips kittest (which duplicated an inline unit
  test verbatim) with a harness-based render assertion.
- Correct the register_persisted_wallets doc comment to note the banner.

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

@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 delta at d9567049 resolves all four prior findings from e1c357e8. The new raise_skipped_wallets_banner helper is now exercised across singular render, plural supersede, and zero-skip clear; Inner retains a Mutex<Option<BannerHandle>> so re-entrant load passes replace/clear the previous banner; the zero-skip kittest now uses a real Harness; and the register_persisted_wallets doc comment describes the banner side effect. Carry-forward prior findings: none. New latest-delta findings: none.

Source: reviewers: opus (general), gpt-5.5 (general; parseable output, process rc=5), opus (rust-quality), gpt-5.5 (rust-quality); verifier: opus; specialists: rust-quality.

Prior reconciliation:

  • prior-1 FIXED: banner behavior was extracted into raise_skipped_wallets_banner and covered by the three-pass rendered-banner test; the remaining call site is a mechanical outcome.skipped.len() pass-through.
  • prior-2 FIXED: no_skips_renders_no_banner now builds/runs an egui_kittest::Harness and asserts the warning icon is absent.
  • prior-3 FIXED: the register_persisted_wallets doc comment now says the pass loads, logs, and raises a skipped-wallet warning banner.
  • prior-4 FIXED: Inner.skipped_wallets_banner plus OptionBannerExt::replace / take_and_clear prevents contradictory stacked banners across re-runs.

`replace` collides with the inherent `Option::replace(value)`, which always
wins method-call resolution over a trait method of the same name (no
arity-based overload resolution in Rust). So `opt.replace(ctx, msg, type)`
never reaches the trait method — it fails to compile against the inherent
one-arg method (E0061), and the only way to call it is fully qualified
(`OptionBannerExt::replace(&mut opt, ctx, msg, type)`), as the new
wallet_backend banner wire-up had to do.

The sibling OptionOverlayExt already named its equivalent method `raise` for
exactly this reason. Add the same name to OptionBannerExt, keep `replace` as
a backward-compatible alias delegating to `raise` (no existing call site used
method syntax on it, so nothing was silently broken), update the trait's own
doc example to stop demonstrating code that doesn't compile, and switch the
one real caller (wallet_backend::raise_skipped_wallets_banner) to the natural
`banner_handle.raise(...)` form.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@lklimek
lklimek merged commit 3be91d5 into docs/platform-wallet-migration-design Jul 6, 2026
4 checks passed
@lklimek
lklimek deleted the feat/load-skip-banner branch July 6, 2026 14:32
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