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(core): update device method lists in tests
Steven Enamakel9f26ce9a7075
diff --git a/crates/openhuman-core/src/core/all_bound_controller_tests.rs b/crates/openhuman-core/src/core/all_bound_controller_tests.rsindex 0b1f56d7a8..b0bade1ff6 100644--- a/crates/openhuman-core/src/core/all_bound_controller_tests.rs+++ b/crates/openhuman-core/src/core/all_bound_controller_tests.rs@@ -42,11 +42,7 @@ fn staged_bound_methods() -> Vec<&'static str> {"voice.live_test_provider",]);methods.push("threads.upsert");- methods.extend([- "devices.create_pairing",- "devices.list",- "devices.revoke",- ]);+ methods.extend(["devices.create_pairing", "devices.list", "devices.revoke"]);methods.extend(["profiles.provision","profiles.deprovision",diff --git a/crates/openhuman-core/src/core/all_devices_controller_tests.rs b/crates/openhuman-core/src/core/all_devices_controller_tests.rsindex dc97ae80ae..1e944015bf 100644--- a/crates/openhuman-core/src/core/all_devices_controller_tests.rs+++ b/crates/openhuman-core/src/core/all_devices_controller_tests.rs@@ -7,14 +7,14 @@ fn raw_devices_security_registry_matches_its_independent_contract() {.iter().filter(|row| row.controller.schema.namespace == "devices").collect();- let methods = [- "devices.create_pairing",- "devices.list",- "devices.revoke",- ];+ let methods = ["devices.create_pairing", "devices.list", "devices.revoke"];let contracts = crate::security::devices::devices_parameter_contracts();- assert_eq!(entries.len(), methods.len(), "complete raw devices inventory");+ assert_eq!(+ entries.len(),+ methods.len(),+ "complete raw devices inventory"+ );assert_eq!(entries.iter()@@ -23,9 +23,7 @@ fn raw_devices_security_registry_matches_its_independent_contract() {methods,"device registration order is a wire contract");- assert!(entries- .iter()- .all(|row| row.group == DomainGroup::Security));+ assert!(entries.iter().all(|row| row.group == DomainGroup::Security));assert!(internal_registry().iter().all(|row| row.controller.schema.namespace != "devices"));@@ -55,9 +53,18 @@ fn raw_devices_security_registry_matches_its_independent_contract() {.iter().map(|field| field.name).collect::<Vec<_>>(),- ["channel_id", "pairing_token", "core_pubkey", "rpc_url", "expires_at"]+ [+ "channel_id",+ "pairing_token",+ "core_pubkey",+ "rpc_url",+ "expires_at"+ ]+ );+ assert_eq!(+ create.outputs.iter().filter(|field| field.required).count(),+ 4);- assert_eq!(create.outputs.iter().filter(|field| field.required).count(), 4);let list = &entries[1].controller.schema;assert!(list.inputs.is_empty());diff --git a/crates/openhuman-core/src/security/devices/mod.rs b/crates/openhuman-core/src/security/devices/mod.rsindex b06bce8d74..eac9da1794 100644--- a/crates/openhuman-core/src/security/devices/mod.rs+++ b/crates/openhuman-core/src/security/devices/mod.rs@@ -17,12 +17,12 @@ pub(crate) use store_documents::import_source;pub mod tunnel_client;pub mod types;+#[cfg(test)]+pub(crate) use schemas::devices_parameter_contracts;pub use schemas::{all_controller_schemas as all_devices_controller_schemas,all_registered_controllers as all_devices_registered_controllers,};-#[cfg(test)]-pub(crate) use schemas::devices_parameter_contracts;pub use types::{CreatePairingResponse, ListDevicesResponse, PairedDevice, PairingSession, RevokeDeviceResponse,};diff --git a/crates/openhuman-core/src/security/devices/schemas_tests.rs b/crates/openhuman-core/src/security/devices/schemas_tests.rsindex 4269bf3f78..7aee2cc23c 100644--- a/crates/openhuman-core/src/security/devices/schemas_tests.rs+++ b/crates/openhuman-core/src/security/devices/schemas_tests.rs@@ -132,7 +132,10 @@ fn revoke_parser_requires_and_preserves_a_string_channel_id() {);for (value, serde_error) in [(json!(null), "invalid type: null, expected a string"),- (json!(true), "invalid type: boolean `true`, expected a string"),+ (+ json!(true),+ "invalid type: boolean `true`, expected a string",+ ),(json!(7), "invalid type: integer `7`, expected a string"),(json!([]), "invalid type: sequence, expected a string"),(json!({}), "invalid type: map, expected a string"),@@ -149,3 +152,58 @@ fn revoke_parser_requires_and_preserves_a_string_channel_id() {);}}++async fn runtime_device_entries() -> Vec<crate::core::all::ControllerEntry> {+ use crate::core::runtime::{CoreContext, DomainSet};++ CoreContext::scope(CoreContext::for_test(DomainSet::full(), None), async {+ crate::core::all::all_registered_controllers()+ .into_iter()+ .filter(|entry| entry.schema.namespace == "devices")+ .collect()+ })+ .await+}++#[tokio::test]+async fn device_handlers_load_config_before_parsing_or_running() {+ use crate::config::test_env::EnvVarGuard;+ use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};++ let tmp = tempfile::tempdir().unwrap();+ std::fs::create_dir(tmp.path().join("config.toml")).unwrap();+ let _env = EnvVarGuard::workspace_async(tmp.path()).await;+ let entries = runtime_device_entries().await;+ assert_eq!(entries.len(), 3, "all runtime device entries are present");+ let ctx = DispatchCtx::new(CoreContext::for_test(DomainSet::full(), None));++ for (method, params) in [+ (+ "devices.create_pairing",+ Map::from_iter([("label".into(), json!(false))]),+ ),+ (+ "devices.list",+ Map::from_iter([("unexpected".into(), json!({"ignored": true}))]),+ ),+ (+ "devices.revoke",+ Map::from_iter([("channel_id".into(), json!(false))]),+ ),+ ] {+ let entry = entries+ .iter()+ .find(|entry| entry.schema.method_name() == method)+ .expect("runtime device method is registered");+ let error = entry+ .invoke(ctx.clone(), params)+ .await+ .expect_err("invalid config prevents parser/runner effects");+ assert!(+ error.contains("is a directory") || error.contains("not a file"),+ "{method} config load precedes its parser and operation: {error}"+ );+ assert!(!error.starts_with("invalid 'label':"));+ assert!(!error.starts_with("invalid 'channel_id':"));+ }+}