Skip to content

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

fix: count schema projections from one registry snapshot

Steven Enamakel31f7818d7494
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index 16639a76ce..f8741da94c 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -929,13 +929,14 @@ fn registered_controllers(view: &RegistryView) -> Vec<RegisteredController> {
/// [`all_registered_controllers`], so `/schema` omits gated namespaces
/// automatically under `harness()`.
pub fn all_controller_schemas() -> Vec<ControllerSchema> {
- let view = registry_view();
- let found = view
- .iter()
+ controller_schemas(&registry_view())
+}
+
+fn controller_schemas(view: &RegistryView) -> Vec<ControllerSchema> {
+ view.iter()
.filter(|g| group_allowed(g.group))
.map(|g| g.controller.schema.clone())
- .collect();
- found
+ .collect()
}
/// Generates a standardized RPC method name from a controller schema.
@@ -1349,10 +1350,8 @@ pub async fn try_invoke_registered_rpc(
/// Validates the consistency of the controller registry.
///
/// The registry is the single source of truth: each [`RegisteredController`]
-/// carries its own schema, and the public schema list is *derived* from it
-/// (see [`all_controller_schemas`]). There is therefore no separate "declared"
-/// list to drift from — the previous declared-vs-registered cross-check is
-/// impossible by construction and has been removed (Phase 2 registry collapse).
+/// carries its own schema, and [`all_controller_schemas`] derives the public
+/// list. No separate declaration can drift from handlers (Phase 2).
///
/// Ensures that:
/// - There are no duplicate controllers or RPC methods.
diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rs
index 57bb331088..b68ceaf08e 100644
--- a/crates/openhuman-core/src/core/all_tests.rs
+++ b/crates/openhuman-core/src/core/all_tests.rs
@@ -195,12 +195,9 @@ fn all_registered_controllers_is_nonempty() {
#[test]
fn all_controller_schemas_matches_registered_count() {
let view = registry_view();
- let visible: Vec<_> = view.iter().filter(|g| group_allowed(g.group)).collect();
- let schemas = visible
- .iter()
- .filter(|g| !g.controller.schema.function.is_empty())
- .count();
- assert_eq!(schemas, visible.len());
+ let schemas = controller_schemas(&view);
+ let controllers = registered_controllers(&view);
+ assert_eq!(schemas.len(), controllers.len());
}
/// With the `voice` feature on (the default), the voice + audio_toolkit
diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjs
index c9ffc214a2..5b7f480a2f 100644
--- a/scripts/ci/check-openhuman-rust-layout.mjs
+++ b/scripts/ci/check-openhuman-rust-layout.mjs
@@ -52,8 +52,8 @@ const LEGACY_LIMIT_ENTRIES = [
// their current sizes while follow-up work separates their test concerns.
// `core/` was pruned from the line limit by name until these pins; its
// oversized files are pinned at the size they had when enforcement began.
- ["crates/openhuman-core/src/core/all.rs", 1493],
- ["crates/openhuman-core/src/core/all_tests.rs", 1635],
+ ["crates/openhuman-core/src/core/all.rs", 1492],
+ ["crates/openhuman-core/src/core/all_tests.rs", 1632],
["crates/openhuman-core/src/core/events.rs", 1808],
["crates/openhuman-core/src/core/events_tests.rs", 1003],
["crates/openhuman-core/src/core/observability.rs", 3502],