The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(config): cover legacy dictation settings migration
Steven Enamakelfee4afc6c3f5
diff --git a/crates/openhuman-core/src/config/schema/load/parse_tests.rs b/crates/openhuman-core/src/config/schema/load/parse_tests.rsindex 36fe638b24..9d4faf908b 100644--- a/crates/openhuman-core/src/config/schema/load/parse_tests.rs+++ b/crates/openhuman-core/src/config/schema/load/parse_tests.rs@@ -163,3 +163,46 @@ default_model = "claude-sonnet-4");assert_eq!(std::fs::read_to_string(config_path).unwrap(), once);}++#[tokio::test]+async fn legacy_dictation_and_voice_settings_load_and_save_only_the_stt_engine() {+ let dir = tempfile::tempdir().unwrap();+ let config_path = dir.path().join("config.toml");+ let workspace = dir.path().join("workspace");+ std::fs::create_dir(&workspace).unwrap();+ std::fs::write(+ &config_path,+ r#"+[dictation]+enabled = true+hotkey = "ctrl+shift+d"+activation_mode = "toggle"+llm_refinement = false+streaming = false+streaming_interval_ms = 700++[voice_server]+auto_start = true+hotkey = "ctrl+shift+v"+activation_mode = "tap"+stt_engine = "elevenlabs"+skip_cleanup = true+min_duration_secs = 0.8+silence_threshold = 0.02+custom_dictionary = ["OpenHuman"]+"#,+ )+ .unwrap();++ let mut config = Config::load_from_config_path(&config_path, &workspace)+ .await+ .unwrap();+ assert_eq!(config.voice_server.stt_engine, crate::config::schema::SttEngine::Elevenlabs);+ config.save().await.unwrap();++ let saved: toml::Value = toml::from_str(&std::fs::read_to_string(config_path).unwrap()).unwrap();+ let voice_server = saved["voice_server"].as_table().unwrap();+ assert_eq!(voice_server.len(), 1, "only the active engine setting should remain");+ assert_eq!(voice_server["stt_engine"].as_str(), Some("elevenlabs"));+ assert!(saved.get("dictation").is_none(), "retired dictation data must be dropped on save");+}diff --git a/crates/openhuman-core/src/core/invoke_tests.rs b/crates/openhuman-core/src/core/invoke_tests.rsindex ff4c3d4a27..6889beff48 100644--- a/crates/openhuman-core/src/core/invoke_tests.rs+++ b/crates/openhuman-core/src/core/invoke_tests.rs@@ -276,6 +276,19 @@ async fn invoke_method_unknown_method_returns_unknown_error() {assert!(err.contains("unknown method"));}+#[tokio::test]+async fn invoke_retired_dictation_settings_method_returns_unknown_error() {+ let err = invoke_method(+ DispatchCtx::ambient(),+ default_state(),+ "openhuman.config_get_dictation_settings",+ json!({}),+ )+ .await+ .expect_err("retired dictation settings method must be unknown");+ assert!(err.contains("unknown method"), "got: {err}");+}+#[tokio::test]async fn invoke_method_core_ping_via_tier1() {// core.* methods aren't in the registry; they route through tier 1.diff --git a/crates/openhuman-core/src/voice/schemas/handlers/provider_server_tests.rs b/crates/openhuman-core/src/voice/schemas/handlers/provider_server_tests.rsnew file mode 100644index 0000000000..5faa96e637--- /dev/null+++ b/crates/openhuman-core/src/voice/schemas/handlers/provider_server_tests.rs@@ -0,0 +1,33 @@+use super::*;++#[tokio::test]+async fn choosing_backend_resets_a_legacy_nondefault_stt_engine() {+ let _guard = crate::config::TEST_ENV_LOCK.lock().await;+ let dir = tempfile::tempdir().unwrap();+ let config_path = dir.path().join("config.toml");+ std::fs::write(+ &config_path,+ r#"[voice_server]+stt_engine = "elevenlabs"+"#,+ )+ .unwrap();+ unsafe {+ std::env::set_var("OPENHUMAN_WORKSPACE", dir.path());+ }++ let params = Map::from_iter([("stt_provider".to_string(), Value::String("cloud".into()))]);+ handle_voice_set_providers(DispatchCtx::process_default(), params)+ .await+ .expect("setting the backend provider should succeed");++ let config = crate::config::Config::load_from_config_path(&config_path, dir.path())+ .await+ .unwrap();+ assert_eq!(config.voice_server.stt_engine, crate::config::SttEngine::Backend);+ assert_eq!(crate::voice::effective_stt_provider(&config), "cloud");++ unsafe {+ std::env::remove_var("OPENHUMAN_WORKSPACE");+ }+}