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/core/all_bound_controller_tests.rs

Steven Enamakelcd6569e18877
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 e9c9d56d0b..d66b76d80e 100644
--- a/crates/openhuman-core/src/core/all_bound_controller_tests.rs
+++ b/crates/openhuman-core/src/core/all_bound_controller_tests.rs
@@ -375,21 +375,129 @@ fn production_registry_binds_every_core_voice_controller_to_its_parser() {
}
let contracts = [
- Contract { method: "voice.status", required: &[], optional: &[], examples: &[json!({})] },
- Contract { method: "voice.transcribe", required: &["audio_path"], optional: &["context", "skip_cleanup"], examples: &[json!({"audio_path":"fixture.wav"}), json!({"audio_path":"fixture.wav","context":"example","skip_cleanup":true})] },
- Contract { method: "voice.transcribe_bytes", required: &["audio_bytes"], optional: &["extension", "context", "skip_cleanup"], examples: &[json!({"audio_bytes":[0,1]}), json!({"audio_bytes":[0,1],"extension":"wav","context":"example","skip_cleanup":true})] },
- Contract { method: "voice.tts", required: &["text"], optional: &["output_path"], examples: &[json!({"text":"Hello"}), json!({"text":"Hello","output_path":"fixture.wav"})] },
- Contract { method: "voice.reply_synthesize", required: &["text"], optional: &["voice_id", "model_id", "output_format"], examples: &[json!({"text":"Hello"}), json!({"text":"Hello","voice_id":"fixture","model_id":"fixture","output_format":"mp3_44100"})] },
- Contract { method: "voice.stt_dispatch", required: &["audio_base64"], optional: &["provider", "model", "mime_type", "file_name", "language"], examples: &[json!({"audio_base64":"AA=="}), json!({"audio_base64":"AA==","provider":"cloud","model":"fixture","mime_type":"audio/wav","file_name":"fixture.wav","language":"en"})] },
- Contract { method: "voice.tts_dispatch", required: &["text"], optional: &["provider", "voice"], examples: &[json!({"text":"Hello"}), json!({"text":"Hello","provider":"cloud","voice":"fixture"})] },
- Contract { method: "voice.set_providers", required: &[], optional: &["stt_provider", "tts_provider", "stt_model", "tts_voice"], examples: &[json!({}), json!({"stt_provider":"cloud","tts_provider":"cloud","stt_model":"fixture","tts_voice":"fixture"})] },
- Contract { method: "voice.update_provider_settings", required: &[], optional: &["voice_providers", "stt_provider", "tts_provider"], examples: &[json!({}), json!({"voice_providers":[{"slug":"fixture-provider"}],"stt_provider":"cloud","tts_provider":"cloud"})] },
- Contract { method: "voice.list_models", required: &["provider_id"], optional: &["capability"], examples: &[json!({"provider_id":"fixture"}), json!({"provider_id":"fixture","capability":"stt"})] },
- Contract { method: "voice.test_provider", required: &["workload", "provider"], optional: &["validate_only", "api_key"], examples: &[json!({"workload":"tts","provider":"cloud"}), json!({"workload":"stt","provider":"cloud","validate_only":true,"api_key":"fixture-key"})] },
- Contract { method: "voice.live_providers", required: &[], optional: &[], examples: &[json!({})] },
- Contract { method: "voice.live_settings_get", required: &[], optional: &[], examples: &[json!({})] },
- Contract { method: "voice.live_settings_set", required: &[], optional: &["default_provider", "gemini", "sarvam", "elevenlabs"], examples: &[json!({}), json!({"default_provider":"gemini","gemini":{"model":"fixture","voice":null},"sarvam":{"language":"en"},"elevenlabs":{"voice_id":"fixture"}})] },
- Contract { method: "voice.live_test_provider", required: &["provider"], optional: &[], examples: &[json!({"provider":"gemini"})] },
+ Contract {
+ method: "voice.status",
+ required: &[],
+ optional: &[],
+ examples: &[json!({})],
+ },
+ Contract {
+ method: "voice.transcribe",
+ required: &["audio_path"],
+ optional: &["context", "skip_cleanup"],
+ examples: &[
+ json!({"audio_path":"fixture.wav"}),
+ json!({"audio_path":"fixture.wav","context":"example","skip_cleanup":true}),
+ ],
+ },
+ Contract {
+ method: "voice.transcribe_bytes",
+ required: &["audio_bytes"],
+ optional: &["extension", "context", "skip_cleanup"],
+ examples: &[
+ json!({"audio_bytes":[0,1]}),
+ json!({"audio_bytes":[0,1],"extension":"wav","context":"example","skip_cleanup":true}),
+ ],
+ },
+ Contract {
+ method: "voice.tts",
+ required: &["text"],
+ optional: &["output_path"],
+ examples: &[
+ json!({"text":"Hello"}),
+ json!({"text":"Hello","output_path":"fixture.wav"}),
+ ],
+ },
+ Contract {
+ method: "voice.reply_synthesize",
+ required: &["text"],
+ optional: &["voice_id", "model_id", "output_format"],
+ examples: &[
+ json!({"text":"Hello"}),
+ json!({"text":"Hello","voice_id":"fixture","model_id":"fixture","output_format":"mp3_44100"}),
+ ],
+ },
+ Contract {
+ method: "voice.stt_dispatch",
+ required: &["audio_base64"],
+ optional: &["provider", "model", "mime_type", "file_name", "language"],
+ examples: &[
+ json!({"audio_base64":"AA=="}),
+ json!({"audio_base64":"AA==","provider":"cloud","model":"fixture","mime_type":"audio/wav","file_name":"fixture.wav","language":"en"}),
+ ],
+ },
+ Contract {
+ method: "voice.tts_dispatch",
+ required: &["text"],
+ optional: &["provider", "voice"],
+ examples: &[
+ json!({"text":"Hello"}),
+ json!({"text":"Hello","provider":"cloud","voice":"fixture"}),
+ ],
+ },
+ Contract {
+ method: "voice.set_providers",
+ required: &[],
+ optional: &["stt_provider", "tts_provider", "stt_model", "tts_voice"],
+ examples: &[
+ json!({}),
+ json!({"stt_provider":"cloud","tts_provider":"cloud","stt_model":"fixture","tts_voice":"fixture"}),
+ ],
+ },
+ Contract {
+ method: "voice.update_provider_settings",
+ required: &[],
+ optional: &["voice_providers", "stt_provider", "tts_provider"],
+ examples: &[
+ json!({}),
+ json!({"voice_providers":[{"slug":"fixture-provider"}],"stt_provider":"cloud","tts_provider":"cloud"}),
+ ],
+ },
+ Contract {
+ method: "voice.list_models",
+ required: &["provider_id"],
+ optional: &["capability"],
+ examples: &[
+ json!({"provider_id":"fixture"}),
+ json!({"provider_id":"fixture","capability":"stt"}),
+ ],
+ },
+ Contract {
+ method: "voice.test_provider",
+ required: &["workload", "provider"],
+ optional: &["validate_only", "api_key"],
+ examples: &[
+ json!({"workload":"tts","provider":"cloud"}),
+ json!({"workload":"stt","provider":"cloud","validate_only":true,"api_key":"fixture-key"}),
+ ],
+ },
+ Contract {
+ method: "voice.live_providers",
+ required: &[],
+ optional: &[],
+ examples: &[json!({})],
+ },
+ Contract {
+ method: "voice.live_settings_get",
+ required: &[],
+ optional: &[],
+ examples: &[json!({})],
+ },
+ Contract {
+ method: "voice.live_settings_set",
+ required: &[],
+ optional: &["default_provider", "gemini", "sarvam", "elevenlabs"],
+ examples: &[
+ json!({}),
+ json!({"default_provider":"gemini","gemini":{"model":"fixture","voice":null},"sarvam":{"language":"en"},"elevenlabs":{"voice_id":"fixture"}}),
+ ],
+ },
+ Contract {
+ method: "voice.live_test_provider",
+ required: &["provider"],
+ optional: &[],
+ examples: &[json!({"provider":"gemini"})],
+ },
];
// Select raw production rows, before DomainSet, surface, or extension filtering.
@@ -405,28 +513,65 @@ fn production_registry_binds_every_core_voice_controller_to_its_parser() {
.then_some(&grouped.controller)
})
.collect();
- assert_eq!(entries.len(), contracts.len(), "complete core voice inventory");
+ assert_eq!(
+ entries.len(),
+ contracts.len(),
+ "complete core voice inventory"
+ );
let methods: Vec<_> = entries
.iter()
.map(|entry| entry.schema.method_name())
.collect();
assert_eq!(
methods,
- contracts.iter().map(|contract| contract.method).collect::<Vec<_>>(),
+ contracts
+ .iter()
+ .map(|contract| contract.method)
+ .collect::<Vec<_>>(),
"independent core voice method inventory and registry order"
);
for (entry, contract) in entries.into_iter().zip(contracts) {
- assert!(entry.is_bound(), "{} must have a production-bound parser", contract.method);
- let required: Vec<_> = entry.schema.inputs.iter().filter(|input| input.required).map(|input| input.name).collect();
- let optional: Vec<_> = entry.schema.inputs.iter().filter(|input| !input.required).map(|input| input.name).collect();
- assert_eq!(required, contract.required, "{} required fields", contract.method);
- assert_eq!(optional, contract.optional, "{} optional fields", contract.method);
+ assert!(
+ entry.is_bound(),
+ "{} must have a production-bound parser",
+ contract.method
+ );
+ let required: Vec<_> = entry
+ .schema
+ .inputs
+ .iter()
+ .filter(|input| input.required)
+ .map(|input| input.name)
+ .collect();
+ let optional: Vec<_> = entry
+ .schema
+ .inputs
+ .iter()
+ .filter(|input| !input.required)
+ .map(|input| input.name)
+ .collect();
+ assert_eq!(
+ required, contract.required,
+ "{} required fields",
+ contract.method
+ );
+ assert_eq!(
+ optional, contract.optional,
+ "{} optional fields",
+ contract.method
+ );
for example in contract.examples {
- let params = example.as_object().expect("voice example is an object").clone();
- validate_params(&entry.schema, &params).expect("registered schema accepts voice example");
- entry.decode_params(params).expect("actual raw registry parser accepts voice example");
+ let params = example
+ .as_object()
+ .expect("voice example is an object")
+ .clone();
+ validate_params(&entry.schema, &params)
+ .expect("registered schema accepts voice example");
+ entry
+ .decode_params(params)
+ .expect("actual raw registry parser accepts voice example");
}
for name in contract.required {
@@ -435,11 +580,18 @@ fn production_registry_binds_every_core_voice_controller_to_its_parser() {
if remove {
broken.inputs.retain(|input| input.name != name);
} else {
- broken.inputs.iter_mut().find(|input| input.name == name)
- .expect("independent required name is present").required = false;
+ broken
+ .inputs
+ .iter_mut()
+ .find(|input| input.name == name)
+ .expect("independent required name is present")
+ .required = false;
}
- assert!(required_input_contract(&broken, contract.required).is_err(),
- "{} independent required contract rejects {name} removal/optional mutation", contract.method);
+ assert!(
+ required_input_contract(&broken, contract.required).is_err(),
+ "{} independent required contract rejects {name} removal/optional mutation",
+ contract.method
+ );
}
}
}