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
chore(search): add tests for search config and providers
Steven Enamakele6a5faa25c19
diff --git a/crates/openhuman-core/src/config/ops/search_tests.rs b/crates/openhuman-core/src/config/ops/search_tests.rsindex dd06fa7015..bde3414389 100644--- a/crates/openhuman-core/src/config/ops/search_tests.rs+++ b/crates/openhuman-core/src/config/ops/search_tests.rs@@ -177,7 +177,7 @@ fn settings_view_reports_status_roles_and_never_keys() {assert_eq!(provider(&view, "brave")["status"], "disabled");// Deep research rides on the Gemini key and is reported on the gemini row.assert_eq!(view["effective_roles"]["answer"], json!(["gemini", "exa"]));- assert_eq!(view["effective_roles"]["search"], json!(["exa"]));+ assert_eq!(view["effective_roles"]["search"], json!(["exa", "gemini"]));assert!(!view.to_string().contains("secret-gemini"));assert!(view["providers"].as_array()diff --git a/crates/openhuman-core/src/modules/search/config_tests.rs b/crates/openhuman-core/src/modules/search/config_tests.rsindex cb0d7f1c40..bebca8b490 100644--- a/crates/openhuman-core/src/modules/search/config_tests.rs+++ b/crates/openhuman-core/src/modules/search/config_tests.rs@@ -96,7 +96,11 @@ fn role_tools_follow_provider_selection() {.into_iter().map(|spec| spec.name).collect();- assert_eq!(names, vec!["web_answer_tool".to_string()]);+ // Gemini serves Search (grounded) as well as Answer.+ assert_eq!(+ names,+ vec!["web_search_tool".to_string(), "web_answer_tool".to_string()]+ );}#[test]diff --git a/crates/openhuman-core/src/modules/search/mod.rs b/crates/openhuman-core/src/modules/search/mod.rsindex 8ccbde4ae3..61afb2f7cf 100644--- a/crates/openhuman-core/src/modules/search/mod.rs+++ b/crates/openhuman-core/src/modules/search/mod.rs@@ -140,7 +140,16 @@ pub fn module_config(config: &Config) -> ModuleSearchConfig {let roles = ROLES.into_iter()- .map(|role| (role, providers::role_order(config, role)))+ .map(|role| {+ let order = if direct_profile {+ // A profile's role order is exact: an empty role is off, never+ // the default fallback order (which could add Exa answers).+ providers::exact_role_order(config, role)+ } else {+ providers::role_order(config, role)+ };+ (role, order)+ }).collect();let presentation = PresentationConfig {mode: match config.search.presentation {diff --git a/crates/openhuman-core/src/search/providers.rs b/crates/openhuman-core/src/search/providers.rsindex f205651f40..bdc9f8768f 100644--- a/crates/openhuman-core/src/search/providers.rs+++ b/crates/openhuman-core/src/search/providers.rs@@ -141,6 +141,21 @@ pub fn role_order(config: &Config, role: Role) -> Vec<String> {.collect()}+/// The configured provider order for `role` with no default fallback: an+/// unset or empty role stays empty. Used by direct profiles, whose operator+/// fixes exactly which providers serve which role.+pub fn exact_role_order(config: &Config, role: Role) -> Vec<String> {+ config+ .search+ .roles+ .get(role_key(role))+ .into_iter()+ .flatten()+ .filter(|provider| provider_roles(provider).contains(&role))+ .cloned()+ .collect()+}+/// Usable providers for `role`, in serving order. The first one answers; the/// rest are fallbacks.pub fn effective_role_providers(