Skip to content

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

test(core): assert owner-authored schema namespaces

Steven Enamakel20b93f81380c
diff --git a/crates/openhuman-core/src/config/schemas_tests.rs b/crates/openhuman-core/src/config/schemas_tests.rs
index 39277f40bf..be13c1e95c 100644
--- a/crates/openhuman-core/src/config/schemas_tests.rs
+++ b/crates/openhuman-core/src/config/schemas_tests.rs
@@ -4,6 +4,7 @@ use crate::core::all::assert_schema_controller_parity;
#[test]
fn config_schema_catalog_matches_registered_controllers() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "config");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/core/schema_test_support.rs b/crates/openhuman-core/src/core/schema_test_support.rs
index 716204359d..0ee593b2d6 100644
--- a/crates/openhuman-core/src/core/schema_test_support.rs
+++ b/crates/openhuman-core/src/core/schema_test_support.rs
@@ -92,6 +92,18 @@ pub(crate) fn verify_parameter_schema(
Ok(())
}
+/// Owner-authored namespace literals must cover the complete family, including
+/// methods without their own field contract; parity alone is self-derived.
+pub(crate) fn expect_schema_namespace(schemas: &[ControllerSchema], expected: &str) {
+ for schema in schemas {
+ assert_eq!(
+ schema.namespace, expected,
+ "{} wire namespace",
+ schema.function
+ );
+ }
+}
+
pub(crate) fn expect_schema_identity(schema: &ControllerSchema, namespace: &str, function: &str) {
assert_eq!(schema.namespace, namespace);
assert_eq!(schema.function, function);
diff --git a/crates/openhuman-core/src/core/schema_test_support_tests.rs b/crates/openhuman-core/src/core/schema_test_support_tests.rs
index ae3c02abaf..badc747371 100644
--- a/crates/openhuman-core/src/core/schema_test_support_tests.rs
+++ b/crates/openhuman-core/src/core/schema_test_support_tests.rs
@@ -148,3 +148,31 @@ fn examples_must_be_objects_and_satisfy_schema_before_decoding() {
.unwrap_err()
.contains("schema rejects example"));
}
+
+#[test]
+fn real_owner_namespaces_reject_each_controller_namespace_typo() {
+ let families = vec![(
+ "inference",
+ crate::inference::all_inference_controller_schemas(),
+ )];
+ #[cfg(feature = "mcp")]
+ let families = families
+ .into_iter()
+ .chain([(
+ "mcp_clients",
+ crate::mcp::registry::all_mcp_registry_controller_schemas(),
+ )])
+ .collect::<Vec<_>>();
+ for (expected, schemas) in families {
+ assert!(!schemas.is_empty(), "{expected} owner fixture must exist");
+ expect_schema_namespace(&schemas, expected);
+ for mut schema in schemas {
+ let function = schema.function;
+ schema.namespace = "misspelled_owner";
+ assert!(
+ std::panic::catch_unwind(|| expect_schema_namespace(&[schema], expected)).is_err(),
+ "{expected}.{function} namespace mutation escaped"
+ );
+ }
+ }
+}
diff --git a/crates/openhuman-core/src/core/subsystem/schemas_tests.rs b/crates/openhuman-core/src/core/subsystem/schemas_tests.rs
index 7fbf3bb314..b255f89cb3 100644
--- a/crates/openhuman-core/src/core/subsystem/schemas_tests.rs
+++ b/crates/openhuman-core/src/core/subsystem/schemas_tests.rs
@@ -4,6 +4,7 @@ use crate::core::runtime::DispatchCtx;
#[test]
fn subsystem_catalog_matches_registered_controllers() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "subsystems");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/desktop/app_state/schemas_tests.rs b/crates/openhuman-core/src/desktop/app_state/schemas_tests.rs
index 2285785722..b1a12bf34d 100644
--- a/crates/openhuman-core/src/desktop/app_state/schemas_tests.rs
+++ b/crates/openhuman-core/src/desktop/app_state/schemas_tests.rs
@@ -3,6 +3,7 @@ use crate::core::all::{assert_schema_controller_parity, expect_schema_identity};
#[test]
fn app_state_schema_contracts_and_registration_are_preserved() {
+ crate::core::all::expect_schema_namespace(&all_app_state_controller_schemas(), "app_state");
assert_eq!(all_app_state_controller_schemas().len(), 2);
assert_schema_controller_parity(
&all_app_state_controller_schemas(),
diff --git a/crates/openhuman-core/src/inference/host_runtime/schemas_tests.rs b/crates/openhuman-core/src/inference/host_runtime/schemas_tests.rs
index 43d9d9e3b5..1e6292a2fb 100644
--- a/crates/openhuman-core/src/inference/host_runtime/schemas_tests.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/schemas_tests.rs
@@ -3,6 +3,7 @@ use crate::core::all::assert_schema_controller_parity;
#[test]
fn runtime_schema_catalog_matches_registered_controllers() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "inference");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/inference/schemas_tests.rs b/crates/openhuman-core/src/inference/schemas_tests.rs
index 101142b485..4f3a800e3e 100644
--- a/crates/openhuman-core/src/inference/schemas_tests.rs
+++ b/crates/openhuman-core/src/inference/schemas_tests.rs
@@ -5,6 +5,7 @@ use crate::core::runtime::DispatchCtx;
use crate::core::TypeSchema;
#[test]
fn inference_schema_function_names_are_stable() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "inference");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs
index ad2ac409b9..9d09d6943a 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs
@@ -4,6 +4,7 @@ use crate::core::runtime::DispatchCtx;
#[test]
fn tokenjuice_schema_catalog_matches_registered_controllers() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "tokenjuice");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/integrations/composio/schemas_tests.rs b/crates/openhuman-core/src/integrations/composio/schemas_tests.rs
index fdd063cf0b..a4353a9a24 100644
--- a/crates/openhuman-core/src/integrations/composio/schemas_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/schemas_tests.rs
@@ -6,6 +6,7 @@ use serde_json::json;
#[test]
fn composio_schema_contracts_and_registration_are_preserved() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "composio");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/integrations/task_sources/schemas_tests.rs b/crates/openhuman-core/src/integrations/task_sources/schemas_tests.rs
index ef6841990d..6a8c722635 100644
--- a/crates/openhuman-core/src/integrations/task_sources/schemas_tests.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/schemas_tests.rs
@@ -6,6 +6,7 @@ use serde_json::json;
#[test]
fn task_source_schema_contracts_and_registration_are_preserved() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "task_sources");
let names: Vec<_> = all_controller_schemas()
.into_iter()
.map(|s| s.function)
diff --git a/crates/openhuman-core/src/mcp/registry/schemas_tests.rs b/crates/openhuman-core/src/mcp/registry/schemas_tests.rs
index 858bea7466..7aa85ca8a9 100644
--- a/crates/openhuman-core/src/mcp/registry/schemas_tests.rs
+++ b/crates/openhuman-core/src/mcp/registry/schemas_tests.rs
@@ -9,6 +9,7 @@ use serde_json::Map;
#[test]
fn registry_schema_contracts_are_preserved() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "mcp_clients");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/mcp/ui/schemas_tests.rs b/crates/openhuman-core/src/mcp/ui/schemas_tests.rs
index f57e335b77..34e47296e3 100644
--- a/crates/openhuman-core/src/mcp/ui/schemas_tests.rs
+++ b/crates/openhuman-core/src/mcp/ui/schemas_tests.rs
@@ -6,6 +6,7 @@ use crate::core::runtime::DispatchCtx;
#[test]
fn mcp_ui_schema_contracts_are_preserved() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "mcp_ui");
let schema = schemas("tool_call");
expect_schema_identity(&schema, "mcp_ui", "tool_call");
expect_schema_required_inputs(&schema, &["server_id", "tool_name"]);
diff --git a/crates/openhuman-core/src/modules/schemas_tests.rs b/crates/openhuman-core/src/modules/schemas_tests.rs
index 4a6ef080fd..1c41f6dae0 100644
--- a/crates/openhuman-core/src/modules/schemas_tests.rs
+++ b/crates/openhuman-core/src/modules/schemas_tests.rs
@@ -6,6 +6,7 @@ use serde_json::{Map, Value};
#[test]
fn registered_controllers_match_the_advertised_schemas() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "modules");
// Two lists that must agree: one drives `/schema`, the other dispatch.
let advertised: Vec<&str> = all_controller_schemas()
.iter()
diff --git a/crates/openhuman-core/src/platform/service/schemas_tests.rs b/crates/openhuman-core/src/platform/service/schemas_tests.rs
index 63219115c2..75c51e5fe1 100644
--- a/crates/openhuman-core/src/platform/service/schemas_tests.rs
+++ b/crates/openhuman-core/src/platform/service/schemas_tests.rs
@@ -3,6 +3,7 @@ use crate::core::all::assert_schema_controller_parity;
#[test]
fn service_schema_catalog_matches_registered_controllers() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "service");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/platform/socket/schemas_tests.rs b/crates/openhuman-core/src/platform/socket/schemas_tests.rs
index 71955f8a4e..7e2ad786b8 100644
--- a/crates/openhuman-core/src/platform/socket/schemas_tests.rs
+++ b/crates/openhuman-core/src/platform/socket/schemas_tests.rs
@@ -7,6 +7,7 @@ use crate::core::runtime::DispatchCtx;
#[test]
fn socket_schema_contracts_are_preserved() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "socket");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/sandbox/schemas_tests.rs b/crates/openhuman-core/src/sandbox/schemas_tests.rs
index 7f1473ed1d..1f8bea581a 100644
--- a/crates/openhuman-core/src/sandbox/schemas_tests.rs
+++ b/crates/openhuman-core/src/sandbox/schemas_tests.rs
@@ -13,6 +13,7 @@ fn scoped_ctx(config: crate::config::Config) -> std::sync::Arc<CoreContext> {
#[test]
fn sandbox_schema_catalog_matches_registered_controllers() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "sandbox");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/security/credentials/schemas_tests.rs b/crates/openhuman-core/src/security/credentials/schemas_tests.rs
index 03268497ee..d0d6ca13b2 100644
--- a/crates/openhuman-core/src/security/credentials/schemas_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/schemas_tests.rs
@@ -6,6 +6,7 @@ use crate::core::all::{
#[test]
fn credential_schema_wire_contracts_are_preserved() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "auth");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),
diff --git a/crates/openhuman-core/src/skills/webhooks/schemas_tests.rs b/crates/openhuman-core/src/skills/webhooks/schemas_tests.rs
index 92318f04e3..cbd9d2cd6f 100644
--- a/crates/openhuman-core/src/skills/webhooks/schemas_tests.rs
+++ b/crates/openhuman-core/src/skills/webhooks/schemas_tests.rs
@@ -6,6 +6,7 @@ use crate::core::all::{
#[test]
fn webhook_schema_contracts_are_preserved() {
+ crate::core::all::expect_schema_namespace(&all_controller_schemas(), "webhooks");
assert_schema_controller_parity(
&all_controller_schemas(),
&all_registered_controllers(),