Skip to content

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

Merge commit '023fcffeea2c24796402161e5eea8e6e36fdd9d2' into epic-8089-228-schema-tests

Steven Enamakel7e97fada6b4e
diff --cc crates/openhuman-core/src/voice/schemas_tests.rs
index 8abe1ac7f9,be8df20001..913b519480
--- a/crates/openhuman-core/src/voice/schemas_tests.rs
+++ b/crates/openhuman-core/src/voice/schemas_tests.rs
@@@ -1,65 -1,63 +1,63 @@@
use super::*;
+use crate::core::all::{
+ assert_schema_controller_parity, expect_schema_fields, expect_schema_identity,
+ expect_schema_required_inputs,
+};
- use crate::core::runtime::DispatchCtx;
use serde_json::json;
#[test]
-fn schema_names_are_stable() {
- let s = voice_schemas("voice_status");
- assert_eq!(s.namespace, "voice");
- assert_eq!(s.function, "status");
-
- let s = voice_schemas("voice_transcribe");
- assert_eq!(s.namespace, "voice");
- assert_eq!(s.function, "transcribe");
-
- let s = voice_schemas("voice_transcribe_bytes");
- assert_eq!(s.namespace, "voice");
- assert_eq!(s.function, "transcribe_bytes");
-
- let s = voice_schemas("voice_tts");
- assert_eq!(s.namespace, "voice");
- assert_eq!(s.function, "tts");
-
- let s = voice_schemas("voice_stt_dispatch");
- assert_eq!(s.namespace, "voice");
- assert_eq!(s.function, "stt_dispatch");
-
- let s = voice_schemas("voice_tts_dispatch");
- assert_eq!(s.namespace, "voice");
- assert_eq!(s.function, "tts_dispatch");
-
- let s = voice_schemas("voice_set_providers");
- assert_eq!(s.namespace, "voice");
- assert_eq!(s.function, "set_providers");
-}
-
-#[test]
-fn factory_dispatch_schemas_are_wired_into_registry() {
- // Both dispatch endpoints + the persistence endpoint must be reachable
- // through the registered_controllers list; without them the JSON-RPC
- // router will reject the new method names with "unknown method".
- let registry = all_voice_registered_controllers();
- let functions: Vec<&'static str> = registry.iter().map(|c| c.schema.function).collect();
- assert!(
- functions.contains(&"stt_dispatch"),
- "voice.stt_dispatch must be registered (got {functions:?})"
- );
- assert!(
- functions.contains(&"tts_dispatch"),
- "voice.tts_dispatch must be registered"
- );
- assert!(
- functions.contains(&"set_providers"),
- "voice.set_providers must be registered"
- );
-}
-
-#[test]
-fn controller_lists_match_lengths() {
- assert_eq!(
- all_voice_controller_schemas().len(),
- all_voice_registered_controllers().len()
+fn voice_schema_wire_contracts_are_preserved() {
+ let identities = [
+ ("voice_status", "status"),
+ ("voice_transcribe", "transcribe"),
+ ("voice_transcribe_bytes", "transcribe_bytes"),
+ ("voice_tts", "tts"),
- ("overlay_stt_notify", "overlay_stt_notify"),
+ ("voice_stt_dispatch", "stt_dispatch"),
+ ("voice_tts_dispatch", "tts_dispatch"),
+ ("voice_set_providers", "set_providers"),
+ ("voice_server_start", "server_start"),
+ ("voice_update_provider_settings", "update_provider_settings"),
+ ("voice_list_models", "list_models"),
+ ("voice_test_provider", "test_provider"),
+ ];
+ for (key, function) in identities {
+ expect_schema_identity(&voice_schemas(key), "voice", function);
+ }
+ let fields: &[(&str, &[(&str, bool)])] = &[
+ ("voice_transcribe", &[("audio_path", true)]),
+ (
+ "voice_transcribe_bytes",
+ &[("audio_bytes", true), ("extension", false)],
+ ),
+ ("voice_tts", &[("text", true), ("output_path", false)]),
+ (
+ "voice_update_provider_settings",
+ &[
+ ("voice_providers", false),
+ ("stt_provider", false),
+ ("tts_provider", false),
+ ],
+ ),
+ ("voice_list_models", &[("provider_id", true)]),
+ (
+ "voice_test_provider",
+ &[("workload", true), ("provider", true)],
+ ),
+ ];
+ for (key, expected) in fields {
+ let expected: Vec<_> = expected
+ .iter()
+ .map(|(name, required)| (*name, Some(*required)))
+ .collect();
+ expect_schema_fields(&voice_schemas(key), &expected);
+ }
+ assert!(voice_schemas("voice_status").inputs.is_empty());
+ expect_schema_required_inputs(&voice_schemas("voice_server_start"), &[]);
+ expect_schema_required_inputs(&voice_schemas("voice_update_provider_settings"), &[]);
+ assert_schema_controller_parity(
+ &all_voice_controller_schemas(),
+ &all_voice_registered_controllers(),
+ "status",
);
}