Fix RefCell borrow panic and add unit tests #9

Merged
mik-tf merged 1 commit from fix/refcell-panic-and-unit-tests into development 2026-02-27 14:11:03 +00:00
Member

Summary

  • Fix RefCell borrow panic (#7): Introduces Signal<GatewayAccountId> to decouple render-time reads from Rc<RefCell<HeroLedgerClient>>, eliminating "RefCell already mutably borrowed" panics during async gateway operations
  • Add unit tests (#8): 33 tests across all 3 crates (signing, shared types, backend validation)
  • Clean compiler warnings: Removed unused import, added dead_code annotations

Closes #7
Closes #8

Changes (9 files, +348 −45)

File Change
crates/frontend/src/signing.rs Added GatewayAccountId newtype + 10 tests
crates/frontend/src/main.rs Added signal provider, updated ActIdentity
crates/frontend/src/heroledger.rs Removed account_id_string, cleaned warnings
crates/frontend/src/pages/prepare_pre_register.rs Use signal instead of RefCell borrow
crates/frontend/src/components/nodes.rs Use signal, updated resolve_hero_account
crates/backend/src/api.rs Added validation helpers + 13 tests
crates/shared/src/lib.rs Added PartialEq derives + 10 serde round-trip tests
crates/shared/Cargo.toml Added serde_json dev-dependency
Cargo.lock Updated lockfile

Test plan

  • make check — 0 warnings across all 3 crates
  • make lint (clippy) — clean
  • cargo fmt --check — clean
  • make test — 33/33 tests pass
  • Smoke tests — 21/21 pass
  • dx serve — app loads, no RefCell panic in browser
## Summary - **Fix RefCell borrow panic** (#7): Introduces `Signal<GatewayAccountId>` to decouple render-time reads from `Rc<RefCell<HeroLedgerClient>>`, eliminating "RefCell already mutably borrowed" panics during async gateway operations - **Add unit tests** (#8): 33 tests across all 3 crates (signing, shared types, backend validation) - **Clean compiler warnings**: Removed unused import, added dead_code annotations Closes #7 Closes #8 ## Changes (9 files, +348 −45) | File | Change | |------|--------| | `crates/frontend/src/signing.rs` | Added `GatewayAccountId` newtype + 10 tests | | `crates/frontend/src/main.rs` | Added signal provider, updated `ActIdentity` | | `crates/frontend/src/heroledger.rs` | Removed `account_id_string`, cleaned warnings | | `crates/frontend/src/pages/prepare_pre_register.rs` | Use signal instead of RefCell borrow | | `crates/frontend/src/components/nodes.rs` | Use signal, updated `resolve_hero_account` | | `crates/backend/src/api.rs` | Added validation helpers + 13 tests | | `crates/shared/src/lib.rs` | Added PartialEq derives + 10 serde round-trip tests | | `crates/shared/Cargo.toml` | Added serde_json dev-dependency | | `Cargo.lock` | Updated lockfile | ## Test plan - [x] `make check` — 0 warnings across all 3 crates - [x] `make lint` (clippy) — clean - [x] `cargo fmt --check` — clean - [x] `make test` — 33/33 tests pass - [x] Smoke tests — 21/21 pass - [x] `dx serve` — app loads, no RefCell panic in browser
fix: resolve RefCell borrow panic and add unit tests
All checks were successful
Test / check (pull_request) Successful in 1m54s
0c9cc5587e
Decouple render-time reads from Rc<RefCell<HeroLedgerClient>> by
introducing a Signal<GatewayAccountId>, eliminating the borrow conflict
that caused "RefCell already mutably borrowed" panics when Dioxus
re-rendered during async gateway operations.

Also adds 33 unit tests across all three crates (signing, shared types,
backend validation) and cleans compiler warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mik-tf changed title from WIP: Fix RefCell borrow panic and add unit tests to Fix RefCell borrow panic and add unit tests 2026-02-27 14:10:58 +00:00
mik-tf merged commit 70253a5804 into development 2026-02-27 14:11:03 +00:00
mik-tf deleted branch fix/refcell-panic-and-unit-tests 2026-02-27 14:11:04 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mycelium/www_migrate_mycelium!9
No description provided.