Skip to content

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

test(memory): verify functions resolve through handler entries

Steven Enamakel34a15176626c
diff --git a/crates/openhuman-core/src/memory/schemas_tests.rs b/crates/openhuman-core/src/memory/schemas_tests.rs
index 20b15511be..85b37d8453 100644
--- a/crates/openhuman-core/src/memory/schemas_tests.rs
+++ b/crates/openhuman-core/src/memory/schemas_tests.rs
@@ -76,6 +76,22 @@ fn every_spec_method_is_registered_with_its_exact_name() {
}
}
+#[test]
+fn every_function_resolves_through_its_handler_entry() {
+ for function in FUNCTIONS {
+ let (_, expected_handler) = HANDLERS
+ .iter()
+ .find(|(name, _)| *name == function)
+ .unwrap_or_else(|| panic!("missing handler entry for {function}"));
+ assert!(std::ptr::fn_addr_eq(
+ handler_for(function).expect("registered function has a handler"),
+ *expected_handler
+ ));
+ }
+
+ assert!(handler_for("no_such_function").is_none());
+}
+
#[test]
fn unknown_function_gets_the_placeholder_schema() {
let unknown = schema("no_such_function");