Repository navigation
feat(wallet_backend): surface skipped persisted wallets via MessageBanner - #871
Conversation
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
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
✅ Review complete (commit ba8ad71) |
There was a problem hiding this comment.
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 statesso this pass only loads and logs, but this PR adds aMessageBanner::set_globalcall 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.
…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]>
There was a problem hiding this comment.
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_bannerand covered by the three-pass rendered-banner test; the remaining call site is a mechanicaloutcome.skipped.len()pass-through. - prior-2 FIXED:
no_skips_renders_no_bannernow builds/runs anegui_kittest::Harnessand asserts the warning icon is absent. - prior-3 FIXED: the
register_persisted_walletsdoc comment now says the pass loads, logs, and raises a skipped-wallet warning banner. - prior-4 FIXED:
Inner.skipped_wallets_bannerplusOptionBannerExt::replace/take_and_clearprevents 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]>
3be91d5
into
docs/platform-wallet-migration-design
Why this PR exists
docs/platform-wallet-migration-design); completesTODO(PROJ-010-T6).What was done
skipped_wallets_banner_text(usize) -> Optioninwallet_backend/mod.rs(singular/plural wording), wired intoregister_persisted_wallets— raisesMessageBanner::set_global(..., MessageType::Warning)when any wallet is skipped.TODO(PROJ-010-T6)comment inevent_bridge.rswith 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 themigration_banner.rspattern.raise_skipped_wallets_banner, a directly unit-testable free function, and retained itsBannerHandlebehind aMutexonInnerso 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 redundantno_skips_renders_no_bannerkittest case (previously a verbatim duplicate of an inline unit test, no harness) with a harness-based render assertion. Corrected theregister_persisted_walletsdoc comment to note the banner.OptionBannerExt::replacecollides with the inherentOption::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```ignoreblock). AddedOptionBannerExt::raiseas the collision-free preferred method (matching the siblingOptionOverlayExt::raise, which already avoided this name for the same reason), keptreplaceas a backward-compatible alias, and fixed the doc example.Testing
cargo test --all-features --lib wallet_backend→ 293/293 pass, incl. a test drivingraise_skipped_wallets_bannerthrough the renderedMessageBannersurface 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_bannerand--lib progress_overlay→ pass (unaffected by the rename).cargo +nightly fmt --all -- --checkandcargo clippy --all-features --all-targets -- -D warnings(whole workspace, covering every screen usingOptionBannerExt) both clean.Breaking changes
None —
replaceis preserved as a deprecated alias, not removed.Checklist
Attribution
🤖 Co-authored by Claudius the Magnificent AI Agent