app

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

commit 9ef3dfd3f48ccd1d4dc361f952c81c9849fead70
parent 91a7e978e7ea540e440b35347af6f432ffecd775
Author: triesap <tyson@radroots.org>
Date:   Wed, 26 Aug 2026 17:08:14 +0000

test: restore live relay timeout

- Keep fast fake actor tests on the bounded ten-millisecond transport budget.
- Give the real local-relay observer test its intended two-second budget.
- Share actor construction without changing production runtime behavior.
- Cover the callback path with focused Clippy, full FFI, and repeated tests.

Diffstat:
Mcore/crates/harvestcircle_ffi/src/commands.rs | 10+++++++++-
Mcore/crates/harvestcircle_ffi/src/observer.rs | 17+++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/core/crates/harvestcircle_ffi/src/commands.rs b/core/crates/harvestcircle_ffi/src/commands.rs @@ -927,6 +927,14 @@ fn command_timeout( pub(crate) async fn test_actor( relays: RelayConfiguration, ) -> (RuntimeActorHandle, Arc<tempfile::TempDir>) { + test_actor_with_nostr_timeout(relays, Duration::from_millis(10)).await +} + +#[cfg(test)] +pub(crate) async fn test_actor_with_nostr_timeout( + relays: RelayConfiguration, + nostr_timeout: Duration, +) -> (RuntimeActorHandle, Arc<tempfile::TempDir>) { let directory = Arc::new(tempfile::tempdir().expect("temporary runtime root")); let context = application_runtime_context(&RuntimeOpenInputDto { development_mode: true, @@ -950,7 +958,7 @@ pub(crate) async fn test_actor( RuntimeDependencies::new( Arc::new(harvestcircle_application::InMemorySecretStore::default()), Arc::new(SystemClock), - Arc::new(SdkNostrClient::new(Duration::from_millis(10))), + Arc::new(SdkNostrClient::new(nostr_timeout)), Arc::new(UuidInstallationIdentitySource), ), &build, diff --git a/core/crates/harvestcircle_ffi/src/observer.rs b/core/crates/harvestcircle_ffi/src/observer.rs @@ -239,13 +239,14 @@ mod tests { use nostr_relay_builder::MockRelay; use nostr_sdk::Client; - use crate::commands::{RuntimeCore, test_actor}; + use crate::commands::{RuntimeCore, test_actor, test_actor_with_nostr_timeout}; use crate::{ AppSnapshotDto, HarvestCircleAppCore, HarvestCircleChangeObserver, ProfileLoadStateDto, SnapshotChangeDto, }; const SECRET_HEX: &str = "7e7e9c42a91bfef19fa7ea99d52d8afdb67d893a8fefba1f5cb9793f2107f6d7"; + const TEST_RELAY_TIMEOUT: Duration = Duration::from_secs(2); #[derive(Default)] struct RecordingObserver { snapshots: Mutex<Vec<AppSnapshotDto>>, @@ -276,6 +277,18 @@ mod tests { async fn core_with_relays(relays: RelayConfiguration) -> Arc<HarvestCircleAppCore> { let (actor, directory) = test_actor(relays).await; + core_with_actor(actor, directory) + } + + async fn core_with_live_relays(relays: RelayConfiguration) -> Arc<HarvestCircleAppCore> { + let (actor, directory) = test_actor_with_nostr_timeout(relays, TEST_RELAY_TIMEOUT).await; + core_with_actor(actor, directory) + } + + fn core_with_actor( + actor: harvestcircle_runtime::RuntimeActorHandle, + directory: Arc<tempfile::TempDir>, + ) -> Arc<HarvestCircleAppCore> { Arc::new(HarvestCircleAppCore { inner: Arc::new(RuntimeCore { actor, @@ -466,7 +479,7 @@ mod tests { .await .expect("publish profile"); - let core = core_with_relays( + let core = core_with_live_relays( RelayConfiguration::new(vec![ RelayEndpoint::new( relay_url.as_str(),