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): pin shared transport wiring in install and runtime tests
Steven Enamakelfdf7406c170e
diff --git a/crates/openhuman-rpc/src/host_tests.rs b/crates/openhuman-rpc/src/host_tests.rsindex 325962b51a..50349ce859 100644--- a/crates/openhuman-rpc/src/host_tests.rs+++ b/crates/openhuman-rpc/src/host_tests.rs@@ -99,7 +99,6 @@ fn desktop_connected_builder_binds_the_transport_and_hosted_controllers() {.connect().expect("SDK transport builds offline").summary();- assert!(summary.has_backend_transport);assert!(summary.controller_extensions.contains(&DomainGroup::Hosted));assert!(summary.controller_extensionsdiff --git a/crates/openhuman-tinyhumans/src/hosted/client_tests.rs b/crates/openhuman-tinyhumans/src/hosted/client_tests.rsindex 2097a70e5d..eba12173fe 100644--- a/crates/openhuman-tinyhumans/src/hosted/client_tests.rs+++ b/crates/openhuman-tinyhumans/src/hosted/client_tests.rs@@ -138,9 +138,8 @@ fn missing_credential_fails_before_any_request() {}#[test]-fn missing_backend_transport_has_unavailable_sentinel() {- let err = require_transport(Err(BackendTransportError::Unavailable)).unwrap_err();- assert!(err.starts_with("BACKEND_UNAVAILABLE:"), "{err}");+fn require_transport_builds_the_shared_transport_offline() {+ assert!(require_transport().is_ok());}#[tokio::test]diff --git a/crates/openhuman-tinyhumans/src/install.rs b/crates/openhuman-tinyhumans/src/install.rsindex f11acbf741..7a30cc2e0c 100644--- a/crates/openhuman-tinyhumans/src/install.rs+++ b/crates/openhuman-tinyhumans/src/install.rs@@ -88,6 +88,11 @@ static INSTALLED: AtomicBool = AtomicBool::new(false);/// [`RuntimeBuilder`](crate::RuntimeBuilder) hands it to the embed builder's/// seam options (`controller_extension`, `tool_ranker`).pub(crate) struct Wiring {+ /// The process-wide SDK transport ([`crate::client::shared_transport`]).+ /// Hosted callers fetch it themselves; kept so tests can pin that every+ /// connect shares one instance.+ #[allow(dead_code)]+ pub(crate) transport: Arc<SdkBackendTransport>,/// The hosted RPC proxies, unless [`InstallOptions::hosted_controllers`]/// is off.pub(crate) controllers: Option<ControllerExtension>,@@ -161,8 +166,9 @@ fn connect_transport() -> Result<Arc<SdkBackendTransport>, InstallError> {/// the registry and ranker applied in between, in its historical order.pub(crate) fn wiring(options: &InstallOptions) -> Result<Wiring, InstallError> {let (controllers, ranker) = prepare(options);- connect_transport()?;+ let transport = connect_transport()?;Ok(Wiring {+ transport,controllers,ranker,})diff --git a/crates/openhuman-tinyhumans/src/install_tests.rs b/crates/openhuman-tinyhumans/src/install_tests.rsindex d7ec836989..c65978691a 100644--- a/crates/openhuman-tinyhumans/src/install_tests.rs+++ b/crates/openhuman-tinyhumans/src/install_tests.rs@@ -17,7 +17,7 @@ fn default_wiring_carries_hosted_controllers_and_the_jev_ranker() {assert!(wired.ranker.is_some());#[cfg(not(feature = "jev"))]assert!(wired.ranker.is_none());- assert!(installed_backend_transport().is_some());+ assert!(is_installed());let shown = format!("{wired:?}");assert!(shown.contains("Hosted"), "{shown}");}diff --git a/crates/openhuman-tinyhumans/src/runtime_tests.rs b/crates/openhuman-tinyhumans/src/runtime_tests.rsindex a65ac5dffc..9c3319e473 100644--- a/crates/openhuman-tinyhumans/src/runtime_tests.rs+++ b/crates/openhuman-tinyhumans/src/runtime_tests.rs@@ -4,7 +4,7 @@use super::*;use openhuman_embed::seams::DomainGroup;-use openhuman_embed::{BackendTransport, BuilderSummary};+use openhuman_embed::BuilderSummary;fn connected(builder: RuntimeBuilder) -> BuilderSummary {builder.connect().expect("connect").summary()@@ -13,7 +13,6 @@ fn connected(builder: RuntimeBuilder) -> BuilderSummary {#[test]fn connect_wires_transport_hosted_controllers_and_ranker() {let summary = connected(RuntimeBuilder::new());- assert!(summary.has_backend_transport);assert_eq!(summary.controller_extensions, vec![DomainGroup::Hosted]);#[cfg(feature = "jev")]assert_eq!(@@ -22,14 +21,13 @@ fn connect_wires_transport_hosted_controllers_and_ranker() {);#[cfg(not(feature = "jev"))]assert!(summary.tool_ranker.is_none());- // The transport is also the process global, as `install` leaves it.- assert!(openhuman_embed::installed_backend_transport().is_some());+ // The shared transport is built, as `install` leaves it.+ assert!(crate::is_installed());}#[test]fn into_embed_stays_unconnected() {let summary = RuntimeBuilder::new().into_embed().summary();- assert!(!summary.has_backend_transport);assert!(summary.controller_extensions.is_empty());assert!(summary.tool_ranker.is_none());}@@ -37,7 +35,6 @@ fn into_embed_stays_unconnected() {#[test]fn deferred_builder_connects_through_tinyhumans_wrapper() {let summary = connected(RuntimeBuilder::new().defer_services());- assert!(summary.has_backend_transport);}#[test]@@ -47,7 +44,6 @@ fn hosted_controllers_and_jev_can_be_turned_off() {.hosted_controllers(false).jev_ranker(false),);- assert!(summary.has_backend_transport);assert!(summary.controller_extensions.is_empty());assert!(summary.tool_ranker.is_none());}diff --git a/crates/openhuman-tinyhumans/src/transport/transport_tests.rs b/crates/openhuman-tinyhumans/src/transport/transport_tests.rsindex 935d4bd773..55fc5239ed 100644--- a/crates/openhuman-tinyhumans/src/transport/transport_tests.rs+++ b/crates/openhuman-tinyhumans/src/transport/transport_tests.rs@@ -2,7 +2,6 @@//! code relies on, pinned against a mock backend.use super::*;-use crate::transport::{clear_backend_transport, resolve_backend_transport};use serde_json::json;use wiremock::matchers::{header, header_exists, method, path};use wiremock::{Mock, MockServer, ResponseTemplate};@@ -201,22 +200,13 @@ async fn sdk_route_policy_refuses_unexposed_routes_before_sending() {}#[tokio::test]-async fn install_makes_the_core_resolve_this_transport() {+async fn install_shares_one_transport_with_the_hosted_client() {let _guard = global_lock().lock().await;- let _t = crate::install(crate::InstallOptions::default()).unwrap();+ let installed = crate::install(crate::InstallOptions::default()).unwrap();assert!(crate::is_installed());- assert_eq!(- resolve_backend_transport().unwrap().name(),- "tinyhumans-sdk"- );- clear_backend_transport();- assert!(!crate::is_installed());- // Re-install after a clear restores the same transport.- let _t = crate::install(crate::InstallOptions::default()).unwrap();- assert_eq!(- resolve_backend_transport().unwrap().name(),- "tinyhumans-sdk"- );+ assert_eq!(installed.name(), "tinyhumans-sdk");+ let shared = crate::client::shared_transport().unwrap();+ assert!(std::sync::Arc::ptr_eq(&installed, &shared));}#[tokio::test]