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): cover accessibility decoding and capability gating
Steven Enamakel9bba8bea9f01
diff --git a/crates/openhuman-core/src/core/cli.rs b/crates/openhuman-core/src/core/cli.rsindex 23a3045356..2e0a94c9d8 100644--- a/crates/openhuman-core/src/core/cli.rs+++ b/crates/openhuman-core/src/core/cli.rs@@ -631,7 +631,6 @@ fn print_general_help(grouped: &BTreeMap<String, Vec<ControllerSchema>>) {println!(" openhuman-tui [--thread <id>|--new] (terminal UI; separate executable)");println!(" openhuman skills <subcommand> [options] (skill development runtime)");println!(" openhuman agent <subcommand> [options] (inspect agent definitions & prompts)");- println!(" openhuman voice [--hotkey <combo>] [--mode <tap|push>] (voice dictation server)");println!(" openhuman sentry-test [--message <text>] [--panic] (verify Sentry wiring)");println!(" openhuman <namespace> <function> [--param value ...]\n");println!("Global options (place before the command):");diff --git a/crates/openhuman-core/src/modules/accessibility_tests.rs b/crates/openhuman-core/src/modules/accessibility_tests.rsindex 8c6fec78cf..d458643c8c 100644--- a/crates/openhuman-core/src/modules/accessibility_tests.rs+++ b/crates/openhuman-core/src/modules/accessibility_tests.rs@@ -58,9 +58,15 @@ async fn fixture() -> (AccessibilityClient, Fixture, tinybus::Connection) {ObjectPath::new("/test/Accessibility").unwrap(),fixture.clone(),)+ .await.unwrap();+ service.request_name("test.Accessibility").await.unwrap();let proxy = caller- .proxy::<dyn tinybus::Interface>("test.Accessibility", "/test/Accessibility")+ .proxy(+ "test.Accessibility",+ "/test/Accessibility",+ "test.Accessibility",+ ).unwrap();(AccessibilityClient::fixture(proxy), fixture, service)}@@ -85,3 +91,38 @@ async fn disabled_component_refuses_before_reaching_the_module() {Err(AccessibilityError::Operation(ref error)) if error.code == crate::core::runtime::components::COMPONENT_DISABLED));}++#[test]+fn successful_unit_response_preserves_its_explicit_null_data() {+ let raw = serde_json::to_value(DesktopResponse::ok(+ "accessibility-permissions",+ serde_json::Value::Null,+ ))+ .unwrap();+ decode::<()>(raw).unwrap();+}++#[test]+fn successful_response_requires_the_data_field_even_for_unit_results() {+ assert!(matches!(+ decode::<()>(serde_json::json!({+ "version": "2.5",+ "command": "accessibility-permissions",+ "ok": true+ })),+ Err(AccessibilityError::Bus(ModuleCallError::ModuleFault))+ ));+}++#[test]+fn structured_refusal_is_preserved_for_host_presentation() {+ let raw = serde_json::to_value(DesktopResponse::err(+ "accessibility-permissions",+ DesktopError::new("PERMISSION_DENIED", "permission denied"),+ ))+ .unwrap();+ assert!(matches!(+ decode::<()>(raw),+ Err(AccessibilityError::Operation(error)) if error.code == "PERMISSION_DENIED"+ ));+}diff --git a/crates/openhuman-core/src/platform/about_app/ops_tests.rs b/crates/openhuman-core/src/platform/about_app/ops_tests.rsindex 7c76a18a24..9b694ea8a2 100644--- a/crates/openhuman-core/src/platform/about_app/ops_tests.rs+++ b/crates/openhuman-core/src/platform/about_app/ops_tests.rs@@ -7,6 +7,20 @@ fn off(name: &str) -> ComponentSet {ComponentSet::from_config(&c)}+#[test]+fn capability_of_a_disabled_component_shows_disabled() {+ let cap = super::super::lookup("voice.live_agent").expect("live voice capability");+ assert_ne!(cap.status, CapabilityStatus::Disabled);+ let marked = apply_components(cap, &off("voice"));+ assert_eq!(marked.status, CapabilityStatus::Disabled);+ assert_eq!(marked.id, cap.id);+ assert_eq!(apply_components(cap, &off("wallet")).status, cap.status);+ assert_eq!(+ apply_components(cap, &ComponentSet::all()).status,+ cap.status+ );+}+#[test]fn domain_mapping_names_real_components() {for cap in super::super::all_capabilities() {@@ -76,3 +90,25 @@ fn scheduled_job_capabilities_show_disabled_when_the_tinyflows_component_is_off();}}++#[tokio::test]+async fn an_explicit_context_decides_which_capabilities_are_disabled() {+ use crate::core::runtime::context::CoreContext;+ use crate::core::runtime::DispatchCtx;++ let mut voice_off = ComponentSet::all();+ voice_off.voice = false;+ let off = DispatchCtx::new(CoreContext::for_test_with_components(voice_off));+ let on = DispatchCtx::new(CoreContext::for_test_with_components(ComponentSet::all()));++ let ask = |ctx: DispatchCtx| async move {+ tokio::task::yield_now().await;+ lookup_capability(&ctx, "voice.live_agent")+ .expect("live voice capability")+ .value+ .status+ };+ let (disabled, enabled) = tokio::join!(ask(off), ask(on));+ assert_eq!(disabled, CapabilityStatus::Disabled);+ assert_ne!(enabled, CapabilityStatus::Disabled);+}diff --git a/crates/openhuman-core/src/voice/schemas_tests.rs b/crates/openhuman-core/src/voice/schemas_tests.rsindex f10d301354..be8df20001 100644--- a/crates/openhuman-core/src/voice/schemas_tests.rs+++ b/crates/openhuman-core/src/voice/schemas_tests.rs@@ -134,7 +134,7 @@ fn to_json_returns_inner_value() {}#[tokio::test]-async fn retired_start_method_is_not_registered() {+async fn voice_server_start_reports_method_not_found() {use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};let workspace = tempfile::tempdir().expect("private workspace");let mut config = crate::config::Config::default();@@ -148,7 +148,7 @@ async fn retired_start_method_is_not_registered() {crate::core::types::AppState {core_version: env!("CARGO_PKG_VERSION").to_string(),},- concat!("openhuman.voice_server", "_start"),+ "openhuman.voice_server_start",Value::Object(Map::new()),).await;