Skip to content

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

test(core): scope gate-contract RPC checks

Steven Enamakel1339caa4af5a
diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rs
index 8496f828ff..eb63d31025 100644
--- a/crates/openhuman-core/src/core/all_tests.rs
+++ b/crates/openhuman-core/src/core/all_tests.rs
@@ -1882,23 +1882,18 @@ fn capability_allowed_defaults_open_with_no_context() {
}
}
-#[tokio::test]
-async fn unbound_registration_is_byte_identical() {
- // A process-wide default context may have been established by a sibling
- // test. Scope a full context explicitly so this continues to prove the
- // identity property rather than depending on test execution order.
- let ctx = crate::core::runtime::context::CoreContext::for_test(
- crate::core::runtime::DomainSet::full(),
- None,
- None,
- );
- let filtered: Vec<String> = crate::core::runtime::context::CoreContext::scope(ctx, async {
- all_registered_controllers()
- .iter()
- .map(|c| c.rpc_method_name())
- .collect()
- })
- .await;
+#[test]
+fn unbound_registration_is_byte_identical() {
+ // This is specifically a pre-boot invariant. Once another test has
+ // initialized a process default context, the surface is intentionally no
+ // longer unbound and is covered by `full_registration_is_byte_identical`.
+ if crate::core::runtime::context::CoreContext::default_context().is_some() {
+ return;
+ }
+ let filtered: Vec<String> = all_registered_controllers()
+ .iter()
+ .map(|c| c.rpc_method_name())
+ .collect();
let raw: Vec<String> = registry()
.iter()
.map(|g| g.controller.rpc_method_name())
diff --git a/crates/openhuman-core/src/core/jsonrpc_tests.rs b/crates/openhuman-core/src/core/jsonrpc_tests.rs
index 6cd67f1a42..4ce9504f53 100644
--- a/crates/openhuman-core/src/core/jsonrpc_tests.rs
+++ b/crates/openhuman-core/src/core/jsonrpc_tests.rs
@@ -610,6 +610,7 @@ fn http_schema_dump_includes_openhuman_and_core_methods() {
);
}
+#[cfg(feature = "http-server")]
async fn invoke_hosted_method(
method: &str,
params: serde_json::Value,
@@ -623,6 +624,7 @@ async fn invoke_hosted_method(
.await
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn billing_get_current_plan_rejects_unknown_param() {
let err = invoke_hosted_method(
@@ -634,6 +636,7 @@ async fn billing_get_current_plan_rejects_unknown_param() {
assert!(err.contains("unknown param 'extra'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn billing_get_summary_rejects_unknown_param() {
let err = invoke_hosted_method("openhuman.billing_get_summary", json!({ "extra": true }))
@@ -642,6 +645,7 @@ async fn billing_get_summary_rejects_unknown_param() {
assert!(err.contains("unknown param 'extra'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn billing_purchase_plan_missing_plan_fails_validation() {
let err = invoke_hosted_method("openhuman.billing_purchase_plan", json!({}))
@@ -650,6 +654,7 @@ async fn billing_purchase_plan_missing_plan_fails_validation() {
assert!(err.contains("missing required param 'plan'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn billing_top_up_missing_amount_fails_validation() {
let err = invoke_hosted_method("openhuman.billing_top_up", json!({}))
@@ -658,6 +663,7 @@ async fn billing_top_up_missing_amount_fails_validation() {
assert!(err.contains("missing required param 'amountUsd'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn billing_top_up_rejects_unknown_param() {
let err = invoke_hosted_method(
@@ -669,6 +675,7 @@ async fn billing_top_up_rejects_unknown_param() {
assert!(err.contains("unknown param 'unknownField'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn billing_create_portal_session_rejects_unknown_param() {
let err = invoke_hosted_method("openhuman.billing_create_portal_session", json!({ "x": 1 }))
@@ -677,6 +684,7 @@ async fn billing_create_portal_session_rejects_unknown_param() {
assert!(err.contains("unknown param 'x'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_list_members_missing_team_id_fails_validation() {
let err = invoke_hosted_method("openhuman.team_list_members", json!({}))
@@ -685,6 +693,7 @@ async fn team_list_members_missing_team_id_fails_validation() {
assert!(err.contains("missing required param 'teamId'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_list_members_rejects_unknown_param() {
let err = invoke_hosted_method(
@@ -696,6 +705,7 @@ async fn team_list_members_rejects_unknown_param() {
assert!(err.contains("unknown param 'extra'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_create_invite_missing_team_id_fails_validation() {
let err = invoke_hosted_method("openhuman.team_create_invite", json!({}))
@@ -704,6 +714,7 @@ async fn team_create_invite_missing_team_id_fails_validation() {
assert!(err.contains("missing required param 'teamId'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_remove_member_missing_required_params_fails_validation() {
let err = invoke_hosted_method("openhuman.team_remove_member", json!({ "teamId": "t1" }))
@@ -712,6 +723,7 @@ async fn team_remove_member_missing_required_params_fails_validation() {
assert!(err.contains("missing required param 'userId'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_change_member_role_missing_role_fails_validation() {
let err = invoke_hosted_method(
@@ -723,6 +735,7 @@ async fn team_change_member_role_missing_role_fails_validation() {
assert!(err.contains("missing required param 'role'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn billing_create_coinbase_charge_missing_plan_fails_validation() {
let err = invoke_hosted_method("openhuman.billing_create_coinbase_charge", json!({}))
@@ -731,6 +744,7 @@ async fn billing_create_coinbase_charge_missing_plan_fails_validation() {
assert!(err.contains("missing required param 'plan'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn billing_create_coinbase_charge_rejects_unknown_param() {
let err = invoke_hosted_method(
@@ -742,6 +756,7 @@ async fn billing_create_coinbase_charge_rejects_unknown_param() {
assert!(err.contains("unknown param 'extra'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_list_invites_missing_team_id_fails_validation() {
let err = invoke_hosted_method("openhuman.team_list_invites", json!({}))
@@ -750,6 +765,7 @@ async fn team_list_invites_missing_team_id_fails_validation() {
assert!(err.contains("missing required param 'teamId'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_list_invites_rejects_unknown_param() {
let err = invoke_hosted_method(
@@ -761,6 +777,7 @@ async fn team_list_invites_rejects_unknown_param() {
assert!(err.contains("unknown param 'extra'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_revoke_invite_missing_team_id_fails_validation() {
let err = invoke_hosted_method("openhuman.team_revoke_invite", json!({}))
@@ -769,6 +786,7 @@ async fn team_revoke_invite_missing_team_id_fails_validation() {
assert!(err.contains("missing required param 'teamId'"));
}
+#[cfg(feature = "http-server")]
#[tokio::test]
async fn team_revoke_invite_missing_invite_id_fails_validation() {
let err = invoke_hosted_method("openhuman.team_revoke_invite", json!({ "teamId": "t1" }))