Skip to content

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

refactor(core): use is_bound for checking bound handlers

Steven Enamakel2d7a8327c4d4
diff --git a/crates/openhuman-core/src/core/all_bound_controller_tests.rs b/crates/openhuman-core/src/core/all_bound_controller_tests.rs
index 2b0f8e22e6..8efa2acfb2 100644
--- a/crates/openhuman-core/src/core/all_bound_controller_tests.rs
+++ b/crates/openhuman-core/src/core/all_bound_controller_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::core::{FieldSchema, TypeSchema};
+use crate::core::{runtime::DispatchCtx, FieldSchema, TypeSchema};
use std::sync::{
atomic::{AtomicUsize, Ordering},
Mutex,
@@ -217,12 +217,12 @@ fn production_registry_binds_threads_upsert_to_its_declared_parser() {
let bound_methods: Vec<_> = registry()
.iter()
.chain(internal_registry())
- .filter(|grouped| matches!(grouped.controller.handler, EntryHandler::Bound(_)))
+ .filter(|grouped| grouped.controller.is_bound())
.map(|grouped| grouped.controller.schema.method_name())
.collect();
assert_eq!(bound_methods, ["threads.upsert"], "staged bound inventory");
assert!(
- matches!(entry.handler, EntryHandler::Bound(_)),
+ entry.is_bound(),
"threads.upsert must be bound at the production registration site"
);
diff --git a/crates/openhuman-core/src/core/all_entry.rs b/crates/openhuman-core/src/core/all_entry.rs
index 2549557d34..6457d6bcdb 100644
--- a/crates/openhuman-core/src/core/all_entry.rs
+++ b/crates/openhuman-core/src/core/all_entry.rs
@@ -101,6 +101,11 @@ impl BoundRegisteredController {
(self.decode)(params)
}
+ #[cfg(test)]
+ pub(super) fn is_bound(&self) -> bool {
+ matches!(self.handler, EntryHandler::Bound(_))
+ }
+
pub fn invoke(&self, ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
(self.invoke)(ctx, params)
}