Skip to content

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

chore: files changed crates/openhuman-core/src/agent_registry/schemas_tests.rs,crates/openhuman-core

Steven Enamakel00067b363792
diff --git a/crates/openhuman-core/src/agent_registry/schemas_tests.rs b/crates/openhuman-core/src/agent_registry/schemas_tests.rs
index 50352a6775..a1bd35b657 100644
--- a/crates/openhuman-core/src/agent_registry/schemas_tests.rs
+++ b/crates/openhuman-core/src/agent_registry/schemas_tests.rs
@@ -8,12 +8,6 @@ fn all_controller_schemas_and_registered_controllers_stay_in_sync() {
assert!(schemas.iter().all(|schema| schema.namespace == NAMESPACE));
}
-#[test]
-#[should_panic(expected = "unknown agent_registry schema function")]
-fn schemas_panics_on_unknown_function() {
- schemas("missing");
-}
-
#[test]
fn available_tools_schema_is_registered_with_tools_output() {
let schema = schemas("available_tools");
diff --git a/crates/openhuman-core/src/agent_runs/command_center/schemas_tests.rs b/crates/openhuman-core/src/agent_runs/command_center/schemas_tests.rs
index d126a26f92..a89c26e6d7 100644
--- a/crates/openhuman-core/src/agent_runs/command_center/schemas_tests.rs
+++ b/crates/openhuman-core/src/agent_runs/command_center/schemas_tests.rs
@@ -17,13 +17,6 @@ fn unknown_agent_has_no_display_name() {
assert_eq!(resolve_display_name("__definitely_not_an_agent__"), None);
}
-#[test]
-fn an_unknown_function_gets_the_unknown_schema() {
- let s = schema_for("no_such_function");
- assert_eq!(s.namespace, "agent_work");
- assert_eq!(s.function, "unknown");
-}
-
#[test]
fn require_and_optional_strings_ignore_blank_values() {
let mut params = Map::new();
diff --git a/crates/openhuman-core/src/config/schema/observability_tests.rs b/crates/openhuman-core/src/config/schema/observability_tests.rs
index 53bce165c4..f49086bdbb 100644
--- a/crates/openhuman-core/src/config/schema/observability_tests.rs
+++ b/crates/openhuman-core/src/config/schema/observability_tests.rs
@@ -8,11 +8,6 @@ fn default_enables_analytics() {
assert!(cfg.analytics_enabled);
}
-#[test]
-fn default_analytics_enabled_helper_returns_true() {
- assert!(default_analytics_enabled());
-}
-
#[test]
fn share_usage_data_is_on_by_default() {
assert!(default_share_usage_data());
diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rs
index fa9fe3c232..a33206741f 100644
--- a/crates/openhuman-core/src/core/all_tests.rs
+++ b/crates/openhuman-core/src/core/all_tests.rs
@@ -36,11 +36,44 @@ fn grouped(controllers: Vec<RegisteredController>) -> Vec<GroupedController> {
.collect()
}
+// Fixed expectations carried over from the pre-existing memory specification
+// tests and wallet setup regression. Never derive this oracle from live schemas.
fn independent_registered_schema_contract(schema: &ControllerSchema) -> Result<(), String> {
- if schema.method_name() == "wallet.setup" {
- required_fields_contract(schema, &["encryptedMnemonic"])
- } else {
- Ok(())
+ let required: &[&str] = match (schema.namespace, schema.function) {
+ ("memory", "engine_set") => &["engine"],
+ ("memory", "recall") => &["question"],
+ ("memory", "fetch" | "brain_search") => &["query"],
+ ("memory", "learn") => &["text"],
+ ("memory", "forget") => &["ids"],
+ ("memory", "sources_add") => &["kind", "target"],
+ ("memory", "sources_remove") => &["id"],
+ ("memory", "import_start") => &["consent"],
+ ("memory", "brain_forget") => &["source"],
+ ("memory", "policy_set") => &[],
+ ("wallet", "setup") => return required_fields_contract(schema, &["encryptedMnemonic"]),
+ _ => return Ok(()),
+ };
+ required_input_contract(schema, required)
+}
+
+#[test]
+fn registered_memory_contract_rejects_missing_or_optional_question() {
+ let actual = all_registered_controllers()
+ .into_iter()
+ .map(|controller| controller.schema)
+ .find(|schema| schema.method_name() == "memory.recall")
+ .expect("memory.recall is registered");
+ assert_eq!(independent_registered_schema_contract(&actual), Ok(()));
+ for remove in [true, false] {
+ let mut broken = actual.clone();
+ if remove {
+ broken.inputs.retain(|input| input.name != "question");
+ } else {
+ broken.inputs.iter_mut().find(|input| input.name == "question")
+ .expect("real recall schema declares question").required = false;
+ }
+ assert!(independent_registered_schema_contract(&broken)
+ .unwrap_err().contains("memory.recall required inputs mismatch"));
}
}
diff --git a/crates/openhuman-core/src/inference/schemas_tests.rs b/crates/openhuman-core/src/inference/schemas_tests.rs
index 98093644a2..101142b485 100644
--- a/crates/openhuman-core/src/inference/schemas_tests.rs
+++ b/crates/openhuman-core/src/inference/schemas_tests.rs
@@ -120,12 +120,6 @@ async fn inference_openai_oauth_complete_handler_rejects_invalid_params() {
assert!(err.contains("invalid params"));
}
-#[test]
-fn inference_unknown_schema_panics() {
- let panic = std::panic::catch_unwind(|| schemas("no_such_function"));
- assert!(panic.is_err());
-}
-
#[tokio::test]
async fn inference_status_handler_returns_cli_json() {
let value = handle_inference_status(DispatchCtx::process_default(), Map::new())
diff --git a/crates/openhuman-core/src/memory/schemas_tests.rs b/crates/openhuman-core/src/memory/schemas_tests.rs
index 20b15511be..275b5c4e3d 100644
--- a/crates/openhuman-core/src/memory/schemas_tests.rs
+++ b/crates/openhuman-core/src/memory/schemas_tests.rs
@@ -76,23 +76,8 @@ fn every_spec_method_is_registered_with_its_exact_name() {
}
}
-#[test]
-fn unknown_function_gets_the_placeholder_schema() {
- let unknown = schema("no_such_function");
- assert_eq!(unknown.function, "unknown");
- assert!(!FUNCTIONS.contains(&"unknown"));
-}
-
#[test]
fn required_inputs_match_the_spec() {
- let required = |function: &str| -> Vec<&'static str> {
- schema(function)
- .inputs
- .iter()
- .filter(|input| input.required)
- .map(|input| input.name)
- .collect()
- };
let optional = |function: &str| -> Vec<&'static str> {
schema(function)
.inputs
@@ -101,27 +86,16 @@ fn required_inputs_match_the_spec() {
.map(|input| input.name)
.collect()
};
- assert_eq!(required("engine_set"), ["engine"]);
assert_eq!(optional("engine_set"), ["endpoint", "api_key"]);
- assert_eq!(required("recall"), ["question"]);
- assert_eq!(required("fetch"), ["query"]);
- assert_eq!(required("learn"), ["text"]);
- assert_eq!(required("forget"), ["ids"]);
- assert_eq!(required("sources_add"), ["kind", "target"]);
- assert_eq!(required("sources_remove"), ["id"]);
assert_eq!(optional("sources_remove"), ["forget_items"]);
assert_eq!(optional("sources_sync"), ["id"]);
- assert_eq!(required("import_start"), ["consent"]);
assert_eq!(optional("migration_start"), ["takeover"]);
assert_eq!(optional("pack_preview"), ["query", "thread_id", "agent_id"]);
- assert_eq!(required("brain_search"), ["query"]);
assert_eq!(
optional("brain_ingest"),
["path", "text", "source", "title"]
);
- assert_eq!(required("brain_forget"), ["source"]);
assert_eq!(optional("jobs_run"), ["id"]);
- assert!(required("policy_set").is_empty());
for empty in [
"engines_list",
"engine_get",
diff --git a/crates/openhuman-core/src/modules/schemas_tests.rs b/crates/openhuman-core/src/modules/schemas_tests.rs
index a360ee58ee..4107c86938 100644
--- a/crates/openhuman-core/src/modules/schemas_tests.rs
+++ b/crates/openhuman-core/src/modules/schemas_tests.rs
@@ -20,11 +20,6 @@ fn registered_controllers_match_the_advertised_schemas() {
assert_eq!(advertised, registered);
}
-#[test]
-fn an_unknown_function_falls_through_to_the_unknown_arm() {
- assert_eq!(schemas("nope").function, "unknown");
-}
-
#[test]
fn a_blank_or_missing_id_is_not_a_parameter() {
let mut params = Map::new();
diff --git a/crates/openhuman-core/src/sessions/schemas_tests.rs b/crates/openhuman-core/src/sessions/schemas_tests.rs
index 6204a3ed35..9be9086158 100644
--- a/crates/openhuman-core/src/sessions/schemas_tests.rs
+++ b/crates/openhuman-core/src/sessions/schemas_tests.rs
@@ -76,14 +76,6 @@ fn new_correlation_id_is_eight_hex_chars() {
assert!(cid.chars().all(|c| c.is_ascii_hexdigit()));
}
-#[test]
-fn an_unknown_function_gets_the_error_schema() {
- let s = schema_for("no_such_function");
- assert_eq!(s.namespace, "run_ledger");
- assert_eq!(s.function, "unknown");
- assert_eq!(s.outputs[0].name, "error");
-}
-
/// Runs `handler` with the configured workspace pointed at a scratch
/// directory, so the ledger it reads is empty and nothing touches the
/// operator's home.
diff --git a/crates/openhuman-core/src/storage/import/schemas_tests.rs b/crates/openhuman-core/src/storage/import/schemas_tests.rs
index 704f4a2993..60f65adf0e 100644
--- a/crates/openhuman-core/src/storage/import/schemas_tests.rs
+++ b/crates/openhuman-core/src/storage/import/schemas_tests.rs
@@ -59,15 +59,6 @@ async fn handler_rejects_invalid_params() {
assert!(err.contains("invalid params"), "{err}");
}
-#[test]
-fn an_unknown_function_gets_the_error_schema() {
- let schema = session_import_schemas("no_such_function");
- assert_eq!(schema.namespace, "session_import");
- assert_eq!(schema.function, "unknown");
- assert_eq!(schema.outputs.len(), 1);
- assert_eq!(schema.outputs[0].name, "error");
-}
-
/// Runs the import against `workspace` (or the configured one when `None`)
/// with the configured workspace pointed at a scratch directory, so nothing
/// touches the operator's home.
diff --git a/crates/openhuman-core/src/threads/schemas_tests.rs b/crates/openhuman-core/src/threads/schemas_tests.rs
index 9df33cd6e4..4a2aeb26b2 100644
--- a/crates/openhuman-core/src/threads/schemas_tests.rs
+++ b/crates/openhuman-core/src/threads/schemas_tests.rs
@@ -61,13 +61,6 @@ fn every_schema_uses_threads_namespace() {
}
}
-#[test]
-fn unknown_function_returns_fallback() {
- let s = schemas("no_such_fn");
- assert_eq!(s.function, "unknown");
- assert_eq!(s.namespace, "threads");
-}
-
// ── parse::<T>(params) contract ─────────────────────────────────────
fn obj(value: Value) -> Map<String, Value> {
diff --git a/crates/openhuman-core/src/voice/schemas_tests.rs b/crates/openhuman-core/src/voice/schemas_tests.rs
index 913b519480..a6c7a3815f 100644
--- a/crates/openhuman-core/src/voice/schemas_tests.rs
+++ b/crates/openhuman-core/src/voice/schemas_tests.rs
@@ -82,13 +82,6 @@ fn deserialize_params_rejects_wrong_type() {
assert!(err.contains("invalid params"));
}
-#[test]
-fn to_json_returns_inner_value() {
- let json =
- to_json(Outcome::single_log(json!({"ok": true}), "done")).expect("serialize outcome");
- assert_eq!(json["ok"], true);
-}
-
#[tokio::test]
async fn voice_server_start_reports_method_not_found() {
use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};