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(openhuman-modules-linked): cover every enabled linked module
Steven Enamakel537153eab04a
diff --git a/Cargo.lock b/Cargo.lockindex a6aa4e9fe3..831ac5fedd 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -5451,7 +5451,7 @@ dependencies = ["tinybox-bus","tinybox-core","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinychannels","tinychannels-bus","tinychannels-module",@@ -8670,7 +8670,7 @@ dependencies = ["tinybox-microvm","tinybox-ssh","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinystoragedrivers-busproxy","tinystoragedrivers-core 0.7.0","tokio",@@ -8729,19 +8729,6 @@ dependencies = ["tracing",]-[[package]]-name = "tinybus-module"-version = "0.1.5"-source = "git+https://github.com/tinyhumansai/tinybus?rev=eb5cf727#eb5cf727071a6eb12f9efa3db8ec59e54039f336"-dependencies = [- "async-trait",- "serde",- "serde_json",- "tinybus",- "tokio",- "tracing",-]-[[package]]name = "tinychannels"version = "0.1.31"@@ -8816,7 +8803,7 @@ dependencies = ["serde_json","sha2 0.11.0","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinychannels","tinychannels-bus","tinystoragedrivers-bus 0.7.0",@@ -8857,7 +8844,7 @@ dependencies = ["serde","serde_json","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinycomputer-accessibility","tinycomputer-browser","tinycomputer-bus",@@ -8973,7 +8960,7 @@ dependencies = ["serde_json","thiserror 2.0.20","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinyconnectors-bus","tinyconnectors-sync","tinystoragedrivers-busproxy",@@ -9035,7 +9022,7 @@ dependencies = ["sha2 0.11.0","thiserror 2.0.20","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinydocs","tinydocs-bus","tokio",@@ -9162,7 +9149,7 @@ dependencies = ["sha1 0.11.0","thiserror 2.0.20","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinyhosts-bus",]@@ -9437,7 +9424,7 @@ dependencies = ["log","serde_json","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinyjuice","tinyjuice-bus","tinyjuice-drivers",@@ -9478,7 +9465,7 @@ dependencies = ["sha2 0.11.0","thiserror 2.0.20","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinymcp-bus","tinystoragedrivers-busproxy","tinystoragedrivers-client 0.7.0",@@ -9581,7 +9568,7 @@ dependencies = ["serde_json","thiserror 2.0.20","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinysearch-bus","tokio",]@@ -9906,7 +9893,7 @@ dependencies = ["tinyagents-harness","tinyagents-live","tinybus",- "tinybus-module 0.1.5",+ "tinybus-module","tinytools","tinyvoice","tinyvoice-bus",@@ -9977,7 +9964,7 @@ dependencies = ["serde","serde_json","tinybus",- "tinybus-module 0.1.5 (git+https://github.com/tinyhumansai/tinybus?rev=eb5cf727)",+ "tinybus-module","tinystoragedrivers-bus 0.7.0","tinystoragedrivers-busproxy","tinystoragedrivers-client 0.7.0",diff --git a/crates/openhuman-modules-linked/src/lib_tests.rs b/crates/openhuman-modules-linked/src/lib_tests.rsindex 807c969ddd..347e3571f0 100644--- a/crates/openhuman-modules-linked/src/lib_tests.rs+++ b/crates/openhuman-modules-linked/src/lib_tests.rs@@ -1,13 +1,46 @@use super::*;+use tinybus::broker::Broker;+use tinybus::module::ModuleHost;++/// Every registry id this crate can link, in registration order.+const ALL_IDS: [&str; 11] = [+ "tinybox",+ "tinychannels",+ "tinycomputer",+ "tinyconnectors",+ "tinydocs",+ "tinyhosts",+ "tinyjuice",+ "tinymcp",+ "tinysearch",+ "tinyvoice",+ "tinywallet",+];++fn enabled_ids() -> Vec<&'static str> {+ [+ (cfg!(feature = "tinybox"), "tinybox"),+ (cfg!(feature = "tinychannels"), "tinychannels"),+ (cfg!(feature = "tinycomputer"), "tinycomputer"),+ (cfg!(feature = "tinyconnectors"), "tinyconnectors"),+ (cfg!(feature = "tinydocs"), "tinydocs"),+ (cfg!(feature = "tinyhosts"), "tinyhosts"),+ (cfg!(feature = "tinyjuice"), "tinyjuice"),+ (cfg!(feature = "tinymcp"), "tinymcp"),+ (cfg!(feature = "tinysearch"), "tinysearch"),+ (cfg!(feature = "tinyvoice"), "tinyvoice"),+ (cfg!(feature = "tinywallet"), "tinywallet"),+ ]+ .into_iter()+ .filter_map(|(on, id)| on.then_some(id))+ .collect()+}#[test]fn every_enabled_feature_registers_exactly_its_own_id() {let ids: Vec<&str> = linked_modules().iter().map(|(id, _)| *id).collect();- let expected: Vec<&str> = [cfg!(feature = "tinydocs").then_some("tinydocs")]- .into_iter()- .flatten()- .collect();- assert_eq!(ids, expected);+ assert_eq!(ids, enabled_ids());+ assert!(ids.iter().all(|id| ALL_IDS.contains(id)));}#[test]@@ -16,11 +49,74 @@ fn install_is_idempotent() {install();}-#[cfg(feature = "tinydocs")]#[test]-fn install_makes_the_factory_visible_to_the_core() {+fn install_makes_every_enabled_factory_visible_to_the_core() {install();- assert!(openhuman_rpc::embed::modules::is_linked_registered(- "tinydocs"- ));+ for id in enabled_ids() {+ assert!(+ openhuman_rpc::embed::modules::is_linked_registered(id),+ "{id} was not registered"+ );+ }+}++/// Each factory yields a module whose manifest names its own registry id and+/// whose descriptor passes admission: the same check a released library gets,+/// with the executable's digest as attestation.+#[test]+fn every_enabled_factory_builds_a_module_that_names_its_own_id() {+ for (id, factory) in linked_modules() {+ let module = factory().unwrap_or_else(|error| panic!("{id}: factory failed: {error}"));+ assert_eq!(module.manifest.module.name, id, "{id}: manifest name");+ assert!(+ module+ .manifest+ .bus_name+ .as_str()+ .starts_with("ai.tinyhumans"),+ "{id}: bus name {}",+ module.manifest.bus_name.as_str()+ );+ }+}++/// Linking several modules must not make them share state: each is admitted by+/// its own host, and a module whose required interfaces the bare host does not+/// serve is refused for exactly that reason, never for a duplicate symbol or a+/// descriptor fault.+#[test]+fn every_enabled_module_is_admitted_or_refused_only_for_its_host_interfaces() {+ for (id, factory) in linked_modules() {+ let module = factory().unwrap();+ let host = ModuleHost::new(Broker::new());+ match host.attach_linked_with_config(module, serde_json::json!({})) {+ Ok(info) => assert_eq!(info.manifest.module.name, id),+ Err(error) => {+ let message = error.to_string();+ assert!(+ message.contains("required interface has no provider"),+ "{id}: unexpected admission refusal: {message}"+ );+ }+ }+ }+}++/// Two modules can sit in one host: the descriptors and manifests of different+/// modules do not collide on a bus name or object path.+#[test]+fn enabled_modules_claim_distinct_bus_names_and_object_paths() {+ let mut bus_names = std::collections::BTreeSet::new();+ let mut paths = std::collections::BTreeSet::new();+ for (id, factory) in linked_modules() {+ let module = factory().unwrap();+ assert!(+ bus_names.insert(module.manifest.bus_name.as_str().to_string()),+ "{id}: duplicate bus name"+ );+ assert!(+ paths.insert(module.manifest.object_path.as_str().to_string()),+ "{id}: duplicate object path"+ );+ }}