Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(core): update rpc tests for new dispatch signature

Steven Enamakel74c4316d3a3f
diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rs
index a61fb49900..159a63d7b5 100644
--- a/crates/openhuman-core/src/core/all_tests.rs
+++ b/crates/openhuman-core/src/core/all_tests.rs
@@ -1,4 +1,3 @@
-use crate::core::runtime::DispatchCtx;
use serde_json::Map;
use super::*;
@@ -18,7 +17,7 @@ fn schema(
}
}
-fn noop_handler(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
+fn noop_handler(_params: Map<String, Value>) -> ControllerFuture {
Box::pin(async { Ok(Value::Null) })
}
@@ -800,7 +799,7 @@ fn validate_registry_rejects_duplicate_registered_controllers() {
#[tokio::test]
async fn try_invoke_registered_rpc_returns_none_for_unknown_method() {
- let out = try_in(DispatchCtx::ambient(), "openhuman.not_a_real_method_xyz_123", Map::new())z_123", Map::new()).await;
+ let out = try_invoke_registered_rpc("openhuman.not_a_real_method_xyz_123", Map::new()).await;
assert!(out.is_none(), "unknown methods must return None");
}
@@ -808,7 +807,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_in(DispatchCtx::ambient(), "openhuman.health_snapshot", Map::new())pshot", Map::new()).await;
+ let out = try_invoke_registered_rpc("openhuman.health_snapshot", Map::new()).await;
assert!(out.is_some(), "known method must route");
}
@@ -822,7 +821,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_in(DispatchCtx::ambient(), "openhuman.security_policy_info", Map::new())_info", Map::new()),
+ try_invoke_registered_rpc("openhuman.security_policy_info", Map::new()),
)
.await
.expect("security policy info should be registered")
@@ -967,7 +966,7 @@ async fn dispatch_returns_none_for_gated_method() {
.expect("a flows.* method exists in the full registry");
let ctx = CoreContext::for_test(DomainSet::harness(), None);
- let out = CoreContext::scope(ctx, try_in(DispatchCtx::ambient(), &gated_method, Map::new())method, Map::new())).await;
+ let out = CoreContext::scope(ctx, try_invoke_registered_rpc(&gated_method, Map::new())).await;
assert!(
out.is_none(),
"gated method `{gated_method}` must dispatch as None under harness()"
@@ -978,7 +977,7 @@ async fn dispatch_returns_none_for_gated_method() {
let ctx = CoreContext::for_test(DomainSet::harness(), None);
let out = CoreContext::scope(
ctx,
- try_in(DispatchCtx::ambient(), "openhuman.security_policy_info", Map::new())_info", Map::new()),
+ try_invoke_registered_rpc("openhuman.security_policy_info", Map::new()),
)
.await;
assert!(