app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

commit f50bb3418b3bb262a17a45a5d1618ff043e91e66
parent b25e26c7c54b6f1d22faec714876c9241d669e03
Author: triesap <tyson@radroots.org>
Date:   Sun, 22 Mar 2026 00:09:28 +0000

web: add offline geocoder status coverage

- move the wasm offline geocoder unavailable state into a shared helper that also compiles in host tests
- keep the web build reporting offline geocoder as unavailable instead of attempting runtime initialization
- add a host-side regression test for the web offline geocoder summary user message technical message and debug detail
- close the corrective rcl on a fully green app workspace plus wasm target check

Diffstat:
Mcrates/web/src/lib.rs | 49++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 40 insertions(+), 9 deletions(-)

diff --git a/crates/web/src/lib.rs b/crates/web/src/lib.rs @@ -13,13 +13,24 @@ use nostr::nips::nip19::ToBech32; use nostr::signer::NostrSigner; #[cfg(target_arch = "wasm32")] use nostr_browser_signer::{BrowserSigner, Error as BrowserSignerError}; +#[cfg(any(target_arch = "wasm32", test))] +use radroots_app_core::{ + RadrootsOfflineGeocoderState, RadrootsOfflineGeocoderUnavailableKind, +}; #[cfg(target_arch = "wasm32")] use radroots_app_core::{ HomeActionKind, HomeActionResult, HomeActionState, IdentityGateState, RadrootsApp, - RadrootsAppBackend, RadrootsOfflineGeocoderState, RadrootsOfflineGeocoderUnavailableKind, - SetupActionState, + RadrootsAppBackend, SetupActionState, }; +#[cfg(any(target_arch = "wasm32", test))] +fn offline_geocoder_unavailable_state() -> RadrootsOfflineGeocoderState { + RadrootsOfflineGeocoderState::unavailable( + RadrootsOfflineGeocoderUnavailableKind::MissingBuildAsset, + "radroots-geocoder currently depends on rusqlite and is not wired for wasm runtime initialization.", + ) +} + #[cfg(target_arch = "wasm32")] #[derive(Clone)] struct ConnectedSigner { @@ -82,12 +93,6 @@ impl WebBackend { IdentityGateState::Missing } - fn offline_geocoder_unavailable_state() -> RadrootsOfflineGeocoderState { - RadrootsOfflineGeocoderState::unavailable( - RadrootsOfflineGeocoderUnavailableKind::MissingBuildAsset, - "radroots-geocoder currently depends on rusqlite and is not wired for wasm runtime initialization.", - ) - } } #[cfg(target_arch = "wasm32")] @@ -103,7 +108,7 @@ impl RadrootsAppBackend for WebBackend { } fn offline_geocoder_state(&self) -> Option<RadrootsOfflineGeocoderState> { - Some(Self::offline_geocoder_unavailable_state()) + Some(offline_geocoder_unavailable_state()) } fn setup_action_state(&self) -> SetupActionState { @@ -275,5 +280,31 @@ pub fn launch() { }); } +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn offline_geocoder_unavailable_state_is_stable() { + let state = offline_geocoder_unavailable_state(); + + assert_eq!(state.summary_label(), "Offline geocoder unavailable"); + assert_eq!( + state.user_message(), + Some("Offline geocoder is not available in this build.") + ); + assert_eq!( + state.technical_message(), + Some("The offline geocoder data file is missing from this app build.") + ); + assert_eq!( + state.debug_message(), + Some( + "radroots-geocoder currently depends on rusqlite and is not wired for wasm runtime initialization.", + ) + ); + } +} + #[cfg(not(target_arch = "wasm32"))] pub fn launch() {}