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): add dispatch context and extension test modules
Steven Enamakel2d1555307131
diff --git a/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs b/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rsindex 7c6cc542e7..99792fb1c9 100644--- a/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs+++ b/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs@@ -2,8 +2,9 @@use serde_json::{json, Map, Value};-use super::*;-use crate::core::runtime::DispatchCtx;+use crate::core::all::*;+use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};+use std::sync::Arc;/// Answers with the workspace of the context it was handed, after yielding so/// another dispatch can interleave on the same thread.diff --git a/crates/openhuman-core/src/core/all_extensions_tests.rs b/crates/openhuman-core/src/core/all_extensions_tests.rsindex 257becf6e5..de943c6def 100644--- a/crates/openhuman-core/src/core/all_extensions_tests.rs+++ b/crates/openhuman-core/src/core/all_extensions_tests.rs@@ -118,3 +118,6 @@ async fn registry_extension_is_gated_by_its_domain_group() {"hosted: false must hide the extension");}++#[path = "all_dispatch_ctx_tests.rs"]+mod dispatch_ctx_tests;diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rsindex d197e3ad5b..912b60ac5f 100644--- a/crates/openhuman-core/src/core/all_tests.rs+++ b/crates/openhuman-core/src/core/all_tests.rs@@ -1,4 +1,9 @@use crate::core::runtime::DispatchCtx;++/// Dispatches under the calling task's ambient context.+async fn ambient_rpc(method: &str, params: Map<String, Value>) -> Option<Result<Value, String>> {+ try_invoke_registered_rpc(DispatchCtx::ambient(), method, params).await+}use serde_json::Map;use super::*;@@ -800,11 +805,7 @@ fn validate_registry_rejects_duplicate_registered_controllers() {#[tokio::test]async fn try_invoke_registered_rpc_returns_none_for_unknown_method() {- let out = try_invoke_registered_rpc(- DispatchCtx::ambient(),- "openhuman.not_a_real_method_xyz_123",- Map::new(),- )+ let out = ambient_rpc("openhuman.not_a_real_method_xyz_123", Map::new()).await;assert!(out.is_none(), "unknown methods must return None");}@@ -813,11 +814,7 @@ async fn try_invoke_registered_rpc_returns_none_for_unknown_method() {async fn try_invoke_registered_rpc_returns_some_for_known_method() {// `openhuman.health_snapshot` is registered at startup and takes no// required params — it must route and produce Some(_).- let out = try_invoke_registered_rpc(- DispatchCtx::ambient(),- "openhuman.health_snapshot",- Map::new(),- )+ let out = ambient_rpc("openhuman.health_snapshot", Map::new()).await;assert!(out.is_some(), "known method must route");}@@ -832,11 +829,7 @@ async fn try_invoke_registered_rpc_routes_security_policy_info() {let ctx = CoreContext::for_test_with_config(DomainSet::full(), config);let out = CoreContext::scope(ctx,- try_invoke_registered_rpc(- DispatchCtx::ambient(),- "openhuman.security_policy_info",- Map::new(),- ),+ ambient_rpc("openhuman.security_policy_info", Map::new()),).await.expect("security policy info should be registered")@@ -983,7 +976,7 @@ async fn dispatch_returns_none_for_gated_method() {let ctx = CoreContext::for_test(DomainSet::harness(), None);let out = CoreContext::scope(ctx,- try_invoke_registered_rpc(DispatchCtx::ambient(), &gated_method, Map::new()),+ ambient_rpc(&gated_method, Map::new()),).await;assert!(@@ -996,11 +989,7 @@ async fn dispatch_returns_none_for_gated_method() {let ctx = CoreContext::for_test(DomainSet::harness(), None);let out = CoreContext::scope(ctx,- try_invoke_registered_rpc(- DispatchCtx::ambient(),- "openhuman.security_policy_info",- Map::new(),- ),+ ambient_rpc("openhuman.security_policy_info", Map::new()),).await;assert!(@@ -1496,6 +1485,3 @@ mod registry_tests;#[path = "all_domain_plan_tests.rs"]mod domain_plan_tests;--#[path = "all_dispatch_ctx_tests.rs"]-mod dispatch_ctx_tests;