The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(tinyhumans): serialise tests that touch the core hook registries
Steven Enamakel6658129023e6
diff --git a/crates/openhuman-tinyhumans/src/channels/mod_tests.rs b/crates/openhuman-tinyhumans/src/channels/mod_tests.rsindex fe7b2f5b11..b6eb701183 100644--- a/crates/openhuman-tinyhumans/src/channels/mod_tests.rs+++ b/crates/openhuman-tinyhumans/src/channels/mod_tests.rs@@ -69,6 +69,8 @@ fn backend_errors_map_to_distinct_progressive_recoveries() {#[test]fn registering_twice_leaves_one_callback() {+ let _registry = crate::registry_test_lock();+register(&InstallOptions::default());register(&InstallOptions::default());assert!(openhuman_embed::__host::channel_callback::unregister_channel_callback(CALLBACK_ID));diff --git a/crates/openhuman-tinyhumans/src/client/enricher_tests.rs b/crates/openhuman-tinyhumans/src/client/enricher_tests.rsindex bcaa7dac3f..3749bff3f0 100644--- a/crates/openhuman-tinyhumans/src/client/enricher_tests.rs+++ b/crates/openhuman-tinyhumans/src/client/enricher_tests.rs@@ -94,6 +94,8 @@ fn attribution_headers_and_identity_come_from_this_crate() {#[test]fn enrich_replaces_resolved_endpoints_and_is_visible_to_the_core_loader_hook() {+ let _registry = crate::registry_test_lock();+let _identity = crate::backend::product::product_identity_test_lock();let _env = crate::backend::url::backend_env_test_lock();let mut config = config_with(Some("http://127.0.0.1:1"));diff --git a/crates/openhuman-tinyhumans/src/install_tests.rs b/crates/openhuman-tinyhumans/src/install_tests.rsindex c65978691a..96bef7758d 100644--- a/crates/openhuman-tinyhumans/src/install_tests.rs+++ b/crates/openhuman-tinyhumans/src/install_tests.rs@@ -8,6 +8,8 @@ use openhuman_embed::seams::DomainGroup;#[test]fn default_wiring_carries_hosted_controllers_and_the_jev_ranker() {+ let _registry = crate::registry_test_lock();+let wired = wiring(&InstallOptions::default()).expect("wiring");assert_eq!(wired.controllers.as_ref().map(|ext| ext.group),@@ -24,6 +26,8 @@ fn default_wiring_carries_hosted_controllers_and_the_jev_ranker() {#[test]fn options_turn_controllers_and_ranker_off() {+ let _registry = crate::registry_test_lock();+let wired = wiring(&InstallOptions::default().hosted_controllers(false)@@ -36,6 +40,8 @@ fn options_turn_controllers_and_ranker_off() {#[test]fn wiring_reuses_the_process_transport() {+ let _registry = crate::registry_test_lock();+// A product-identity change drops the cached transport; hold its lock.let _guard = crate::backend::product::product_identity_test_lock();let first = wiring(&InstallOptions::default()).expect("first");@@ -45,6 +51,8 @@ fn wiring_reuses_the_process_transport() {#[test]fn install_registers_hosted_controllers_and_installs_the_ranker() {+ let _registry = crate::registry_test_lock();+// A product-identity change drops the cached transport; hold its lock.let _guard = crate::backend::product::product_identity_test_lock();let transport = install(InstallOptions::default()).expect("install");diff --git a/crates/openhuman-tinyhumans/src/integrations/mod_tests.rs b/crates/openhuman-tinyhumans/src/integrations/mod_tests.rsindex a61ba7bb26..535cbf976f 100644--- a/crates/openhuman-tinyhumans/src/integrations/mod_tests.rs+++ b/crates/openhuman-tinyhumans/src/integrations/mod_tests.rs@@ -53,6 +53,8 @@ fn build_client_returns_none_when_no_auth_token() {#[test]fn register_plugs_every_hosted_integration_into_the_core_registries() {+ let _registry = crate::registry_test_lock();+use openhuman_embed::__host::composio::unregister_composio_route_builder;use openhuman_embed::__host::config::schema::COMPOSIO_MODE_BACKEND;use openhuman_embed::__host::tool_sources::unregister_tool_source;@@ -89,6 +91,8 @@ fn register_plugs_every_hosted_integration_into_the_core_registries() {/// Composio); the sources must register at those same anchors and in that order.#[test]fn tool_sources_register_at_the_pre_refactor_catalogue_positions() {+ let _registry = crate::registry_test_lock();+use openhuman_embed::__host::tool_sources::{registered_tool_source_placements, unregister_tool_source, ToolSourcePlacement,ANCHOR_AFTER_DELEGATE, ANCHOR_AFTER_SEARCH,diff --git a/crates/openhuman-tinyhumans/src/lib.rs b/crates/openhuman-tinyhumans/src/lib.rsindex a4656d634c..883b7b109b 100644--- a/crates/openhuman-tinyhumans/src/lib.rs+++ b/crates/openhuman-tinyhumans/src/lib.rs@@ -111,3 +111,23 @@ pub use transport::{map_sdk_error, SdkBackendTransport};pub use transport::{BackendRequest, BackendTransport, BackendTransportError, BaseUrlPurpose, TransportProfile,};++/// Serialises the tests that register into, or unregister from, the core's+/// process-global hook registries. When the core is a dependency its+/// `cfg(test)` thread-local registries are not active, so every test in this+/// crate shares one registry per slot; a test that unregisters an id would+/// otherwise race another that lists or re-registers it.+#[cfg(test)]+static REGISTRY_TEST_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());++/// Hold this for the whole of a sync test that touches the registries.+#[cfg(test)]+pub(crate) fn registry_test_lock() -> tokio::sync::MutexGuard<'static, ()> {+ REGISTRY_TEST_LOCK.blocking_lock()+}++/// Hold this for the whole of an async test that touches the registries.+#[cfg(test)]+pub(crate) async fn registry_test_lock_async() -> tokio::sync::MutexGuard<'static, ()> {+ REGISTRY_TEST_LOCK.lock().await+}diff --git a/crates/openhuman-tinyhumans/src/memory/mod_tests.rs b/crates/openhuman-tinyhumans/src/memory/mod_tests.rsindex a44f6bf721..4544b2636a 100644--- a/crates/openhuman-tinyhumans/src/memory/mod_tests.rs+++ b/crates/openhuman-tinyhumans/src/memory/mod_tests.rs@@ -178,6 +178,8 @@ async fn host_bearer_rejects_a_local_session_token() {#[test]fn registering_twice_leaves_one_engine() {+ let _registry = crate::registry_test_lock();+register(&InstallOptions::default());register(&InstallOptions::default());assert!(openhuman_embed::__host::memory_engines::unregister_memory_engine(TINYHUMANS_ENGINE));diff --git a/crates/openhuman-tinyhumans/src/register_tests.rs b/crates/openhuman-tinyhumans/src/register_tests.rsindex 1a110ede65..e6196e6524 100644--- a/crates/openhuman-tinyhumans/src/register_tests.rs+++ b/crates/openhuman-tinyhumans/src/register_tests.rs@@ -2,6 +2,8 @@ use super::*;#[test]fn register_all_is_idempotent() {+ let _registry = crate::registry_test_lock();+let options = InstallOptions::default();register_all(&options);register_all(&options);diff --git a/crates/openhuman-tinyhumans/src/runtime_tests.rs b/crates/openhuman-tinyhumans/src/runtime_tests.rsindex ffb20b2a4e..fdbffbbe54 100644--- a/crates/openhuman-tinyhumans/src/runtime_tests.rs+++ b/crates/openhuman-tinyhumans/src/runtime_tests.rs@@ -13,6 +13,8 @@ fn connected(builder: RuntimeBuilder) -> BuilderSummary {#[test]fn connect_wires_transport_hosted_controllers_and_ranker() {+ let _registry = crate::registry_test_lock();+let summary = connected(RuntimeBuilder::new());assert_eq!(summary.controller_extensions, vec![DomainGroup::Hosted]);#[cfg(feature = "jev")]@@ -35,11 +37,15 @@ fn into_embed_stays_unconnected() {#[test]fn deferred_builder_connects_through_tinyhumans_wrapper() {+ let _registry = crate::registry_test_lock();+let summary = connected(RuntimeBuilder::new().defer_services());}#[test]fn hosted_controllers_and_jev_can_be_turned_off() {+ let _registry = crate::registry_test_lock();+let summary = connected(RuntimeBuilder::new().hosted_controllers(false)@@ -51,6 +57,8 @@ fn hosted_controllers_and_jev_can_be_turned_off() {#[test]fn product_identity_is_set_on_connect() {+ let _registry = crate::registry_test_lock();+let _guard = crate::backend::product::product_identity_test_lock();let identity = crate::ProductIdentity::new("opencompany").unwrap();let builder = RuntimeBuilder::new().product_identity(identity.clone());@@ -109,6 +117,8 @@ fn presets_forward_to_the_embed_presets() {#[test]fn knobs_and_seams_forward_unchanged() {+ let _registry = crate::registry_test_lock();+struct Ranker;#[async_trait::async_trait]impl ToolRanker for Ranker {@@ -166,6 +176,8 @@ impl ToolRanker for HostRanker {#[test]fn a_ranker_on_a_wrapped_embed_builder_is_kept() {+ let _registry = crate::registry_test_lock();+let embed = openhuman_embed::RuntimeBuilder::new().tool_ranker(Arc::new(HostRanker));let summary = connected(RuntimeBuilder::from_embed(embed));assert_eq!(summary.tool_ranker.as_deref(), Some("host-ranker"));@@ -173,6 +185,8 @@ fn a_ranker_on_a_wrapped_embed_builder_is_kept() {#[test]fn turning_jev_back_on_does_not_replace_a_host_ranker() {+ let _registry = crate::registry_test_lock();+let summary = connected(RuntimeBuilder::new().tool_ranker(Arc::new(HostRanker))@@ -183,6 +197,8 @@ fn turning_jev_back_on_does_not_replace_a_host_ranker() {#[test]fn connect_keeps_cli_knobs_for_the_host_boot() {+ let _registry = crate::registry_test_lock();+use openhuman_embed::seams::HostBoot;use openhuman_embed::{DomainSet, ServiceSet, TokenSource};diff --git a/crates/openhuman-tinyhumans/src/transport/transport_tests.rs b/crates/openhuman-tinyhumans/src/transport/transport_tests.rsindex 55fc5239ed..e58c81f9ea 100644--- a/crates/openhuman-tinyhumans/src/transport/transport_tests.rs+++ b/crates/openhuman-tinyhumans/src/transport/transport_tests.rs@@ -201,6 +201,8 @@ async fn sdk_route_policy_refuses_unexposed_routes_before_sending() {#[tokio::test]async fn install_shares_one_transport_with_the_hosted_client() {+ let _registry = crate::registry_test_lock_async().await;+let _guard = global_lock().lock().await;let installed = crate::install(crate::InstallOptions::default()).unwrap();assert!(crate::is_installed());@@ -211,6 +213,8 @@ async fn install_shares_one_transport_with_the_hosted_client() {#[tokio::test]async fn backend_client_round_trips_through_the_installed_transport() {+ let _registry = crate::registry_test_lock_async().await;+let server = MockServer::start().await;Mock::given(method("GET")).and(path("/announcements/latest"))@@ -237,6 +241,8 @@ async fn backend_client_round_trips_through_the_installed_transport() {/// the backend through the SDK transport.#[tokio::test]async fn install_registers_hosted_controllers_that_dispatch_through_the_transport() {+ let _registry = crate::registry_test_lock_async().await;+use openhuman_embed::__host::core::all::{namespace_description, rpc_method_from_parts, schema_for_rpc_method,};@@ -319,6 +325,8 @@ fn product_identity_and_attribution_come_from_this_crate() {#[tokio::test]async fn core_channel_routes_recover_from_the_transports_typed_404s() {+ let _registry = crate::registry_test_lock_async().await;+use crate::client::HostedApiError as BackendApiError;// POST + DELETE only, mirroring the deployed router: PATCH falls through// to Express's HTML 404 (#5230); DELETE answers a handler-level 404.diff --git a/crates/openhuman-tinyhumans/src/voice/live_tests.rs b/crates/openhuman-tinyhumans/src/voice/live_tests.rsindex 36c1a726ea..07c9c339b3 100644--- a/crates/openhuman-tinyhumans/src/voice/live_tests.rs+++ b/crates/openhuman-tinyhumans/src/voice/live_tests.rs@@ -54,6 +54,8 @@ fn elevenlabs_hosted_config_owns_its_prompt_and_ignores_blank_voices() {#[test]fn registration_installs_both_hosted_providers() {+ let _registry = crate::registry_test_lock();+register();assert!(unregister_live_provider(LIVE_PROVIDER_GEMINI_HOSTED));assert!(unregister_live_provider(LIVE_PROVIDER_ELEVENLABS_HOSTED));@@ -61,6 +63,8 @@ fn registration_installs_both_hosted_providers() {#[test]fn hosted_providers_are_listed_ahead_of_the_built_in_ones() {+ let _registry = crate::registry_test_lock();+// The catalogue has always listed the hosted providers first:// gemini-hosted, elevenlabs-hosted, gemini, sarvam.register();diff --git a/crates/openhuman-tinyhumans/src/voice/schemas_tests.rs b/crates/openhuman-tinyhumans/src/voice/schemas_tests.rsindex 3fb8157882..c9636ff03b 100644--- a/crates/openhuman-tinyhumans/src/voice/schemas_tests.rs+++ b/crates/openhuman-tinyhumans/src/voice/schemas_tests.rs@@ -31,6 +31,8 @@ fn agent_signed_url_takes_no_params() {#[test]fn registration_is_idempotent() {+ let _registry = crate::registry_test_lock();+register();register();}diff --git a/crates/openhuman-tinyhumans/src/voice/speech_providers_tests.rs b/crates/openhuman-tinyhumans/src/voice/speech_providers_tests.rsindex eaf86b9a1c..6177f747e5 100644--- a/crates/openhuman-tinyhumans/src/voice/speech_providers_tests.rs+++ b/crates/openhuman-tinyhumans/src/voice/speech_providers_tests.rs@@ -5,6 +5,8 @@ use openhuman_embed::__host::voice_registry::{#[test]fn registration_covers_every_historical_cloud_slug() {+ let _registry = crate::registry_test_lock();+register();let config = Config::default();for slug in STT_SLUGS {