From 6b304a7456405e630708092d522e482f78d4a2e2 Mon Sep 17 00:00:00 2001 From: M3gA-Mind Date: Wed, 28 Oct 2026 11:48:08 +0530 Subject: [PATCH 1/5] fix(composio): serve module_guard's module storage without the process slot module_guard installed a memory backend in the process-wide storage slot for its whole test, because a module call carries no workspace for the host to fall back to. That made it every concurrent test's storage, including work on worker and module threads (skills::catalog, flows::builder_tools), which the test-owned slot of #8473 cannot attribute (#8467). Serve it through a test-only module storage that only the storage host's Live::backend reads, set and restored under the module's test lock. --- .../integrations/composio/module_client.rs | 16 ++++--- .../src/modules/storage_host.rs | 47 ++++++++++++++++++- scripts/ci/process-statics.json | 10 ++++ 3 files changed, 66 insertions(+), 7 deletions(-) diff --git a/crates/openhuman-core/src/integrations/composio/module_client.rs b/crates/openhuman-core/src/integrations/composio/module_client.rs index f7f22220b7f..4b318702138 100644 --- a/crates/openhuman-core/src/integrations/composio/module_client.rs +++ b/crates/openhuman-core/src/integrations/composio/module_client.rs @@ -314,9 +314,11 @@ pub(crate) static MODULE_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::cons /// The module lock, and the storage the module keeps its preferences in. #[cfg(test)] pub(crate) struct ModuleGuard { - // Fields drop in order: the previous storage slot comes back before the - // next test may take the module. - _storage: crate::storage::test_support::InstalledBackendGuard, + // Fields drop in order: the previous module storage comes back before the + // next test may take the module. Without the module loader there are no + // module calls to serve. + #[cfg(feature = "modules")] + _storage: crate::modules::storage_host::TestModuleStorage, _lock: tokio::sync::MutexGuard<'static, ()>, } @@ -324,13 +326,15 @@ pub(crate) struct ModuleGuard { /// /// The module refuses a preference call when the host serves no storage, and /// a module call carries no workspace for the host to fall back to, so the -/// guard installs storage as a booted host has it (memory, the one driver -/// every build has), restored on drop. +/// guard serves module calls a fresh memory backend, restored on drop. It is +/// not installed in the process slot: that would make it every concurrent +/// test's storage (MAIN-57). #[cfg(test)] pub(crate) async fn module_guard() -> ModuleGuard { let lock = module_lock_guard().await; ModuleGuard { - _storage: crate::storage::test_support::install_backend_for_test( + #[cfg(feature = "modules")] + _storage: crate::modules::storage_host::serve_test_module_storage( crate::storage::test_support::memory_backend(), ), _lock: lock, diff --git a/crates/openhuman-core/src/modules/storage_host.rs b/crates/openhuman-core/src/modules/storage_host.rs index 7e00e71021e..d870c81f269 100644 --- a/crates/openhuman-core/src/modules/storage_host.rs +++ b/crates/openhuman-core/src/modules/storage_host.rs @@ -576,6 +576,48 @@ pub(crate) fn current_module_scope( module_scope(tenant.profile.as_deref(), module_id) } +/// Storage for module calls in unit tests that hold a module lock (the +/// connector module's `module_guard`). A module call carries no workspace, so +/// such a test needs a backend; this one is read only here, so it is never +/// another test's storage the way an installed process slot is (MAIN-57). +#[cfg(test)] +static TEST_MODULE_STORAGE: std::sync::Mutex>> = + std::sync::Mutex::new(None); + +#[cfg(test)] +fn test_module_storage() -> Option> { + TEST_MODULE_STORAGE + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .clone() +} + +/// Serve `backend` to module calls until the returned guard drops. Hold the +/// module's test lock for as long as it lives. +#[cfg(test)] +pub(crate) fn serve_test_module_storage(backend: Arc) -> TestModuleStorage { + let previous = TEST_MODULE_STORAGE + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .replace(backend); + TestModuleStorage { previous } +} + +/// Restores the previous test module storage on drop. +#[cfg(test)] +pub(crate) struct TestModuleStorage { + previous: Option>, +} + +#[cfg(test)] +impl Drop for TestModuleStorage { + fn drop(&mut self) { + *TEST_MODULE_STORAGE + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) = self.previous.take(); + } +} + /// Production wiring: the broker's name owners, the installed backend, the /// host's scope rule and the compiled grants. struct Live { @@ -603,7 +645,10 @@ impl Environment for Live { // one) wins. An embedder that did not gets the workspace default every // other store already opens for itself ([`crate::storage::local::backend_for`]), // so a module is not the one consumer left with no storage. - crate::storage::installed().or_else(|| { + let installed = crate::storage::installed(); + #[cfg(test)] + let installed = installed.or_else(test_module_storage); + installed.or_else(|| { let workspace = crate::core::runtime::DispatchCtx::ambient() .resolved()? .workspace_dir() diff --git a/scripts/ci/process-statics.json b/scripts/ci/process-statics.json index ed07402fb93..78b00ba65f0 100644 --- a/scripts/ci/process-statics.json +++ b/scripts/ci/process-statics.json @@ -399,6 +399,16 @@ "reason": "The single tinybus module bus (broker, loader, connection) for the process; tinybus never unloads a module, so there is exactly one. Carries no tenant data: tenant scope is resolved per call by the host callbacks it serves.", "verification": "modules/runtime_tests.rs: the_module_bus_is_a_singleton_and_serves_proxies" }, + { + "file": "crates/openhuman-core/src/modules/storage_host.rs", + "scope": "", + "name": "TEST_MODULE_STORAGE", + "type": "std::sync::Mutex>>", + "count": 1, + "category": "A", + "reason": "Test-only (cfg(test)): the backend module calls are served while a unit test holds a module lock (composio module_guard), so that test's module storage is never installed in the process slot, where it would be every concurrent test's storage (MAIN-57). Set and restored only under the module's test lock; no tenant state, not compiled into any shipped build.", + "verification": "integrations/composio/ops/scope_prefs_tests.rs: a_saved_pref_survives_a_deferred_legacy_migration" + }, { "file": "crates/openhuman-core/src/modules/wallet_backend.rs", "scope": "", From 775bec566d7ca3fe5f873468ae172fbecbce90c1 Mon Sep 17 00:00:00 2001 From: M3gA-Mind Date: Wed, 28 Oct 2026 12:08:32 +0530 Subject: [PATCH 2/5] test(composio): withdraw the served module storage to simulate an outage module_guard no longer installs the process slot, so clearing the slot no longer cuts the module off; withdraw the backend the module is served. --- .../integrations/composio/tools/scope_gate_tests.rs | 12 +++++++----- crates/openhuman-core/src/modules/storage_host.rs | 9 +++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs index 0d2a9248bc1..17eb25d4096 100644 --- a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs +++ b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs @@ -222,13 +222,12 @@ async fn a_preference_still_in_the_legacy_file_gates_execution() { /// read a stored preference, every gate that consults it denies. /// /// The module caches its link to the host's storage on first use. Saving a -/// preference while a backend is installed connects that link; removing the +/// preference while a backend is served connects that link; withdrawing the /// backend then makes the module's next preference read fail (`Unavailable`), /// as a storage outage would. /// -/// `module_guard` already holds the storage slot and installs a memory backend -/// (restored on drop), so the test must not lock the slot a second time: the -/// slot mutex is not reentrant and doing so deadlocks. +/// `module_guard` serves module calls a memory backend (restored on drop); +/// the test withdraws it rather than touching the process storage slot. #[tokio::test] async fn an_unreadable_preference_denies_at_every_gate() { use crate::integrations::composio::module_client::module_guard; @@ -246,7 +245,10 @@ async fn an_unreadable_preference_denies_at_every_gate() { only(true, false, false), ) .await - .expect("the module stores the pref while storage is installed"); + .expect("the module stores the pref while storage is served"); + #[cfg(feature = "modules")] + crate::modules::storage_host::withdraw_test_module_storage(); + #[cfg(not(feature = "modules"))] crate::storage::clear(); let read = diff --git a/crates/openhuman-core/src/modules/storage_host.rs b/crates/openhuman-core/src/modules/storage_host.rs index d870c81f269..778aa6abf71 100644 --- a/crates/openhuman-core/src/modules/storage_host.rs +++ b/crates/openhuman-core/src/modules/storage_host.rs @@ -603,6 +603,15 @@ pub(crate) fn serve_test_module_storage(backend: Arc) -> Tes TestModuleStorage { previous } } +/// Withdraw the backend module calls are served, as a storage outage would, +/// while the guard from [`serve_test_module_storage`] is still held. +#[cfg(test)] +pub(crate) fn withdraw_test_module_storage() { + *TEST_MODULE_STORAGE + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) = None; +} + /// Restores the previous test module storage on drop. #[cfg(test)] pub(crate) struct TestModuleStorage { From 5ce47adfb42751b228ebf059fd0f0f35776e4cfe Mon Sep 17 00:00:00 2001 From: M3gA-Mind Date: Wed, 28 Oct 2026 13:54:54 +0530 Subject: [PATCH 3/5] refactor(modules): move the test module storage into its own file storage_host.rs went over the 750-line layout limit. The cfg(test) module storage is a code move into storage_host_test_module.rs, reached by path. --- .../integrations/composio/module_client.rs | 4 +- .../composio/tools/scope_gate_tests.rs | 2 +- .../src/modules/storage_host.rs | 53 ++----------------- .../src/modules/storage_host_test_module.rs | 52 ++++++++++++++++++ scripts/ci/process-statics.json | 2 +- 5 files changed, 59 insertions(+), 54 deletions(-) create mode 100644 crates/openhuman-core/src/modules/storage_host_test_module.rs diff --git a/crates/openhuman-core/src/integrations/composio/module_client.rs b/crates/openhuman-core/src/integrations/composio/module_client.rs index 4b318702138..66350236d7b 100644 --- a/crates/openhuman-core/src/integrations/composio/module_client.rs +++ b/crates/openhuman-core/src/integrations/composio/module_client.rs @@ -318,7 +318,7 @@ pub(crate) struct ModuleGuard { // next test may take the module. Without the module loader there are no // module calls to serve. #[cfg(feature = "modules")] - _storage: crate::modules::storage_host::TestModuleStorage, + _storage: crate::modules::storage_host::test_module::TestModuleStorage, _lock: tokio::sync::MutexGuard<'static, ()>, } @@ -334,7 +334,7 @@ pub(crate) async fn module_guard() -> ModuleGuard { let lock = module_lock_guard().await; ModuleGuard { #[cfg(feature = "modules")] - _storage: crate::modules::storage_host::serve_test_module_storage( + _storage: crate::modules::storage_host::test_module::serve_test_module_storage( crate::storage::test_support::memory_backend(), ), _lock: lock, diff --git a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs index 17eb25d4096..10e45731888 100644 --- a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs +++ b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs @@ -247,7 +247,7 @@ async fn an_unreadable_preference_denies_at_every_gate() { .await .expect("the module stores the pref while storage is served"); #[cfg(feature = "modules")] - crate::modules::storage_host::withdraw_test_module_storage(); + crate::modules::storage_host::test_module::withdraw_test_module_storage(); #[cfg(not(feature = "modules"))] crate::storage::clear(); diff --git a/crates/openhuman-core/src/modules/storage_host.rs b/crates/openhuman-core/src/modules/storage_host.rs index 778aa6abf71..04718f6a497 100644 --- a/crates/openhuman-core/src/modules/storage_host.rs +++ b/crates/openhuman-core/src/modules/storage_host.rs @@ -576,56 +576,9 @@ pub(crate) fn current_module_scope( module_scope(tenant.profile.as_deref(), module_id) } -/// Storage for module calls in unit tests that hold a module lock (the -/// connector module's `module_guard`). A module call carries no workspace, so -/// such a test needs a backend; this one is read only here, so it is never -/// another test's storage the way an installed process slot is (MAIN-57). #[cfg(test)] -static TEST_MODULE_STORAGE: std::sync::Mutex>> = - std::sync::Mutex::new(None); - -#[cfg(test)] -fn test_module_storage() -> Option> { - TEST_MODULE_STORAGE - .lock() - .unwrap_or_else(std::sync::PoisonError::into_inner) - .clone() -} - -/// Serve `backend` to module calls until the returned guard drops. Hold the -/// module's test lock for as long as it lives. -#[cfg(test)] -pub(crate) fn serve_test_module_storage(backend: Arc) -> TestModuleStorage { - let previous = TEST_MODULE_STORAGE - .lock() - .unwrap_or_else(std::sync::PoisonError::into_inner) - .replace(backend); - TestModuleStorage { previous } -} - -/// Withdraw the backend module calls are served, as a storage outage would, -/// while the guard from [`serve_test_module_storage`] is still held. -#[cfg(test)] -pub(crate) fn withdraw_test_module_storage() { - *TEST_MODULE_STORAGE - .lock() - .unwrap_or_else(std::sync::PoisonError::into_inner) = None; -} - -/// Restores the previous test module storage on drop. -#[cfg(test)] -pub(crate) struct TestModuleStorage { - previous: Option>, -} - -#[cfg(test)] -impl Drop for TestModuleStorage { - fn drop(&mut self) { - *TEST_MODULE_STORAGE - .lock() - .unwrap_or_else(std::sync::PoisonError::into_inner) = self.previous.take(); - } -} +#[path = "storage_host_test_module.rs"] +pub(crate) mod test_module; /// Production wiring: the broker's name owners, the installed backend, the /// host's scope rule and the compiled grants. @@ -656,7 +609,7 @@ impl Environment for Live { // so a module is not the one consumer left with no storage. let installed = crate::storage::installed(); #[cfg(test)] - let installed = installed.or_else(test_module_storage); + let installed = installed.or_else(test_module::test_module_storage); installed.or_else(|| { let workspace = crate::core::runtime::DispatchCtx::ambient() .resolved()? diff --git a/crates/openhuman-core/src/modules/storage_host_test_module.rs b/crates/openhuman-core/src/modules/storage_host_test_module.rs new file mode 100644 index 00000000000..d158e7a22ee --- /dev/null +++ b/crates/openhuman-core/src/modules/storage_host_test_module.rs @@ -0,0 +1,52 @@ +//! Test-only storage for module calls while a unit test holds a module lock +//! (the connector module's `module_guard`). Kept out of the process storage +//! slot so it is never another concurrent test's storage (MAIN-57). + +use std::sync::Arc; + +use crate::storage::StorageBackend; + +/// Storage for module calls in unit tests that hold a module lock (the +/// connector module's `module_guard`). A module call carries no workspace, so +/// such a test needs a backend; this one is read only here, so it is never +/// another test's storage the way an installed process slot is (MAIN-57). +static TEST_MODULE_STORAGE: std::sync::Mutex>> = + std::sync::Mutex::new(None); + +pub(super) fn test_module_storage() -> Option> { + TEST_MODULE_STORAGE + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .clone() +} + +/// Serve `backend` to module calls until the returned guard drops. Hold the +/// module's test lock for as long as it lives. +pub(crate) fn serve_test_module_storage(backend: Arc) -> TestModuleStorage { + let previous = TEST_MODULE_STORAGE + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .replace(backend); + TestModuleStorage { previous } +} + +/// Withdraw the backend module calls are served, as a storage outage would, +/// while the guard from [`serve_test_module_storage`] is still held. +pub(crate) fn withdraw_test_module_storage() { + *TEST_MODULE_STORAGE + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) = None; +} + +/// Restores the previous test module storage on drop. +pub(crate) struct TestModuleStorage { + previous: Option>, +} + +impl Drop for TestModuleStorage { + fn drop(&mut self) { + *TEST_MODULE_STORAGE + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) = self.previous.take(); + } +} diff --git a/scripts/ci/process-statics.json b/scripts/ci/process-statics.json index 78b00ba65f0..18d4fac65fe 100644 --- a/scripts/ci/process-statics.json +++ b/scripts/ci/process-statics.json @@ -400,7 +400,7 @@ "verification": "modules/runtime_tests.rs: the_module_bus_is_a_singleton_and_serves_proxies" }, { - "file": "crates/openhuman-core/src/modules/storage_host.rs", + "file": "crates/openhuman-core/src/modules/storage_host_test_module.rs", "scope": "", "name": "TEST_MODULE_STORAGE", "type": "std::sync::Mutex>>", From 1e1cafa84eff09a529ef55a886362005e9427e71 Mon Sep 17 00:00:00 2001 From: M3gA-Mind Date: Wed, 28 Oct 2026 14:15:51 +0530 Subject: [PATCH 4/5] fix(modules): key the served test storage to the connector module The test storage module_guard serves was a fallback for every module's storage callbacks, behind the installed slot. Choose the backend per module when binding: the connector module's served storage first under cfg(test), so neither another module's calls nor a concurrently installed slot can reach the other's state; every other module binds the host's backend as before. --- .../integrations/composio/module_client.rs | 4 +-- .../composio/tools/scope_gate_tests.rs | 2 +- .../src/modules/storage_host.rs | 13 +++----- ...test_module.rs => storage_host_backend.rs} | 31 ++++++++++++++++--- scripts/ci/process-statics.json | 2 +- 5 files changed, 36 insertions(+), 16 deletions(-) rename crates/openhuman-core/src/modules/{storage_host_test_module.rs => storage_host_backend.rs} (64%) diff --git a/crates/openhuman-core/src/integrations/composio/module_client.rs b/crates/openhuman-core/src/integrations/composio/module_client.rs index 66350236d7b..e1190f34700 100644 --- a/crates/openhuman-core/src/integrations/composio/module_client.rs +++ b/crates/openhuman-core/src/integrations/composio/module_client.rs @@ -318,7 +318,7 @@ pub(crate) struct ModuleGuard { // next test may take the module. Without the module loader there are no // module calls to serve. #[cfg(feature = "modules")] - _storage: crate::modules::storage_host::test_module::TestModuleStorage, + _storage: crate::modules::storage_host::backend_choice::TestModuleStorage, _lock: tokio::sync::MutexGuard<'static, ()>, } @@ -334,7 +334,7 @@ pub(crate) async fn module_guard() -> ModuleGuard { let lock = module_lock_guard().await; ModuleGuard { #[cfg(feature = "modules")] - _storage: crate::modules::storage_host::test_module::serve_test_module_storage( + _storage: crate::modules::storage_host::backend_choice::serve_test_module_storage( crate::storage::test_support::memory_backend(), ), _lock: lock, diff --git a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs index 10e45731888..c79514d2823 100644 --- a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs +++ b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs @@ -247,7 +247,7 @@ async fn an_unreadable_preference_denies_at_every_gate() { .await .expect("the module stores the pref while storage is served"); #[cfg(feature = "modules")] - crate::modules::storage_host::test_module::withdraw_test_module_storage(); + crate::modules::storage_host::backend_choice::withdraw_test_module_storage(); #[cfg(not(feature = "modules"))] crate::storage::clear(); diff --git a/crates/openhuman-core/src/modules/storage_host.rs b/crates/openhuman-core/src/modules/storage_host.rs index 04718f6a497..03ec8a069cc 100644 --- a/crates/openhuman-core/src/modules/storage_host.rs +++ b/crates/openhuman-core/src/modules/storage_host.rs @@ -388,7 +388,8 @@ impl StorageHost { /// The module's binding for `scope`, built on first use and again when the /// installed backend changed. The host runs the declared schema here. async fn bind(&self, module: &str, scope: Scope) -> Result, BindError> { - let backend = self.environment.backend().ok_or(BindError::NoBackend)?; + let backend = backend_choice::for_module(module, &*self.environment) + .ok_or(BindError::NoBackend)?; let key = (module.to_string(), scope.as_str().to_string()); let mut bindings = self.bindings.lock().await; if let Some(existing) = bindings.get(&key) { @@ -576,9 +577,8 @@ pub(crate) fn current_module_scope( module_scope(tenant.profile.as_deref(), module_id) } -#[cfg(test)] -#[path = "storage_host_test_module.rs"] -pub(crate) mod test_module; +#[path = "storage_host_backend.rs"] +pub(crate) mod backend_choice; /// Production wiring: the broker's name owners, the installed backend, the /// host's scope rule and the compiled grants. @@ -607,10 +607,7 @@ impl Environment for Live { // one) wins. An embedder that did not gets the workspace default every // other store already opens for itself ([`crate::storage::local::backend_for`]), // so a module is not the one consumer left with no storage. - let installed = crate::storage::installed(); - #[cfg(test)] - let installed = installed.or_else(test_module::test_module_storage); - installed.or_else(|| { + crate::storage::installed().or_else(|| { let workspace = crate::core::runtime::DispatchCtx::ambient() .resolved()? .workspace_dir() diff --git a/crates/openhuman-core/src/modules/storage_host_test_module.rs b/crates/openhuman-core/src/modules/storage_host_backend.rs similarity index 64% rename from crates/openhuman-core/src/modules/storage_host_test_module.rs rename to crates/openhuman-core/src/modules/storage_host_backend.rs index d158e7a22ee..141e4ab9414 100644 --- a/crates/openhuman-core/src/modules/storage_host_test_module.rs +++ b/crates/openhuman-core/src/modules/storage_host_backend.rs @@ -1,11 +1,29 @@ -//! Test-only storage for module calls while a unit test holds a module lock -//! (the connector module's `module_guard`). Kept out of the process storage -//! slot so it is never another concurrent test's storage (MAIN-57). +//! Which backend a module's storage binds to. Under `cfg(test)` a connector +//! module test serves its own storage here while it holds the module lock +//! (`module_guard`), kept out of the process storage slot so it is never +//! another concurrent test's storage (MAIN-57). use std::sync::Arc; use crate::storage::StorageBackend; +/// The backend `module`'s storage binds to: the host's, or under `cfg(test)` +/// the storage a connector-module test is serving. +pub(super) fn for_module( + module: &str, + environment: &dyn super::Environment, +) -> Option> { + #[cfg(test)] + if module == super::super::connectors::MODULE_ID { + if let Some(backend) = test_module_storage() { + return Some(backend); + } + } + let _ = module; + environment.backend() +} + +#[cfg(test)] /// Storage for module calls in unit tests that hold a module lock (the /// connector module's `module_guard`). A module call carries no workspace, so /// such a test needs a backend; this one is read only here, so it is never @@ -13,13 +31,15 @@ use crate::storage::StorageBackend; static TEST_MODULE_STORAGE: std::sync::Mutex>> = std::sync::Mutex::new(None); -pub(super) fn test_module_storage() -> Option> { +#[cfg(test)] +fn test_module_storage() -> Option> { TEST_MODULE_STORAGE .lock() .unwrap_or_else(std::sync::PoisonError::into_inner) .clone() } +#[cfg(test)] /// Serve `backend` to module calls until the returned guard drops. Hold the /// module's test lock for as long as it lives. pub(crate) fn serve_test_module_storage(backend: Arc) -> TestModuleStorage { @@ -30,6 +50,7 @@ pub(crate) fn serve_test_module_storage(backend: Arc) -> Tes TestModuleStorage { previous } } +#[cfg(test)] /// Withdraw the backend module calls are served, as a storage outage would, /// while the guard from [`serve_test_module_storage`] is still held. pub(crate) fn withdraw_test_module_storage() { @@ -38,11 +59,13 @@ pub(crate) fn withdraw_test_module_storage() { .unwrap_or_else(std::sync::PoisonError::into_inner) = None; } +#[cfg(test)] /// Restores the previous test module storage on drop. pub(crate) struct TestModuleStorage { previous: Option>, } +#[cfg(test)] impl Drop for TestModuleStorage { fn drop(&mut self) { *TEST_MODULE_STORAGE diff --git a/scripts/ci/process-statics.json b/scripts/ci/process-statics.json index 18d4fac65fe..f223f01b7ac 100644 --- a/scripts/ci/process-statics.json +++ b/scripts/ci/process-statics.json @@ -400,7 +400,7 @@ "verification": "modules/runtime_tests.rs: the_module_bus_is_a_singleton_and_serves_proxies" }, { - "file": "crates/openhuman-core/src/modules/storage_host_test_module.rs", + "file": "crates/openhuman-core/src/modules/storage_host_backend.rs", "scope": "", "name": "TEST_MODULE_STORAGE", "type": "std::sync::Mutex>>", From 55dea2fc262764127faa327ae50d392e79c4c24e Mon Sep 17 00:00:00 2001 From: M3gA-Mind Date: Wed, 28 Oct 2026 14:36:52 +0530 Subject: [PATCH 5/5] style(modules): rustfmt the backend choice in bind --- crates/openhuman-core/src/modules/storage_host.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/openhuman-core/src/modules/storage_host.rs b/crates/openhuman-core/src/modules/storage_host.rs index 03ec8a069cc..5883da4ccbf 100644 --- a/crates/openhuman-core/src/modules/storage_host.rs +++ b/crates/openhuman-core/src/modules/storage_host.rs @@ -388,8 +388,8 @@ impl StorageHost { /// The module's binding for `scope`, built on first use and again when the /// installed backend changed. The host runs the declared schema here. async fn bind(&self, module: &str, scope: Scope) -> Result, BindError> { - let backend = backend_choice::for_module(module, &*self.environment) - .ok_or(BindError::NoBackend)?; + let backend = + backend_choice::for_module(module, &*self.environment).ok_or(BindError::NoBackend)?; let key = (module.to_string(), scope.as_str().to_string()); let mut bindings = self.bindings.lock().await; if let Some(existing) = bindings.get(&key) {