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(inference): add native provider factory tests
Steven Enamakel77581ab8c720
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rsindex a8c2b9d47b..9d79c0a5d6 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs@@ -1,4 +1,5 @@use super::*;+use crate::security::egress::EgressLedger;use crate::inference::provider::factory::cloud_slug::try_create_cloud_slug_chat_model_from_string_with_native_tools;@@ -16,6 +17,7 @@ fn custom_ca_bundle_builds_a_provider_scoped_chat_client() {"team:private-model",&config,true,+ &EgressLedger::none(),).expect("configured provider").expect("custom CA client should build");@@ -94,6 +96,7 @@ fn enforce_local_only_inference_errors_on_external_when_local_only() {route,true,Some("privacy-test-thread"),+ &EgressLedger::none(),).map(|(model, _)| model)};@@ -288,13 +291,13 @@ fn explicit_local_provider_string_routes_to_crate_native_model() {fn try_create_local_runtime_returns_none_for_managed_and_cloud() {let _guard = crate::inference::inference_test_guard();// Default config resolves to the managed backend, not a local runtime.- assert!(try_create_local_runtime_chat_model("chat", &Config::default()).is_none());+ assert!(try_create_local_runtime_chat_model("chat", &Config::default(), &EgressLedger::none()).is_none());// A BYOK cloud slug is not a local runtime either — it falls through to the// `Provider` path.let mut cloud = Config::default();cloud.cloud_providers.push(openai_entry("p_oai", "openai"));cloud.chat_provider = Some("openai:gpt-4o-mini".to_string());- assert!(try_create_local_runtime_chat_model("chat", &cloud).is_none());+ assert!(try_create_local_runtime_chat_model("chat", &cloud, &EgressLedger::none()).is_none());}#[test]@@ -326,7 +329,7 @@ fn turn_model_route_metadata_uses_post_remap_cloud_model() {config.chat_provider = Some("deepseek:hint:chat".to_string());let (_model, provider, resolved_model) =- create_turn_chat_model_with_native_tools_and_route("chat", &config, "hint:chat", 0.7, true)+ create_turn_chat_model_with_native_tools_and_route("chat", &config, "hint:chat", 0.7, true, &EgressLedger::none()).expect("abstract BYOK tier must build");assert_eq!(provider, "deepseek");@@ -401,6 +404,7 @@ fn anthropic_auth_cloud_slug_in_text_mode_keeps_the_compat_client() {"anthropic:claude-sonnet-4-6",&config,false,+ &EgressLedger::none(),).expect("anthropic slug resolves").expect("build");@@ -422,7 +426,7 @@ fn configured_openhuman_jwt_slug_routes_to_managed_chat_model() {// the managed default, never reaches the backend verbatim.config.chat_provider = Some("openhuman:reasoning-v1".to_string());- let (model, model_id) = try_create_cloud_slug_chat_model("chat", &config)+ let (model, model_id) = try_create_cloud_slug_chat_model("chat", &config, &EgressLedger::none()).expect("configured OpenhumanJwt slug should be recognized").expect("managed model should build");@@ -430,7 +434,7 @@ fn configured_openhuman_jwt_slug_routes_to_managed_chat_model() {// A concrete catalog id is forwarded verbatim.config.chat_provider = Some("openhuman:openrouter/deepseek/deepseek-v4-pro".to_string());- let (_, pinned_id) = try_create_cloud_slug_chat_model("chat", &config)+ let (_, pinned_id) = try_create_cloud_slug_chat_model("chat", &config, &EgressLedger::none()).expect("configured OpenhumanJwt slug should be recognized").expect("managed model should build");assert_eq!(pinned_id, "openrouter/deepseek/deepseek-v4-pro");@@ -457,7 +461,7 @@ async fn openhuman_jwt_slug_discloses_pinned_model() {let mut config = Config::default();config.cloud_providers.push(oh_entry("p_oh"));let provider = format!("openhuman:{marker}");- let _ = try_create_cloud_slug_chat_model_from_string("chat", &provider, &config)+ let _ = try_create_cloud_slug_chat_model_from_string("chat", &provider, &config, &EgressLedger::none()).expect("configured OpenhumanJwt slug should be recognized").expect("managed model should build");@@ -580,6 +584,7 @@ fn openhuman_jwt_slug_preserves_forced_text_mode() {"openhuman:reasoning-v1",&config,false,+ &EgressLedger::none(),).expect("configured OpenhumanJwt slug should be recognized").expect("managed model should build");@@ -599,7 +604,7 @@ fn openhuman_jwt_slug_without_model_preserves_managed_role_tier() {config.cloud_providers.push(oh_entry("p_oh"));let (_model, model_id) =- try_create_cloud_slug_chat_model_from_string("summarization", "openhuman:", &config)+ try_create_cloud_slug_chat_model_from_string("summarization", "openhuman:", &config, &EgressLedger::none()).expect("configured OpenhumanJwt slug should be recognized").expect("managed model should build");@@ -614,7 +619,7 @@ fn try_create_cloud_slug_flips_openai_but_declines_non_cloud() {let mut openai = Config::default();openai.cloud_providers.push(openai_entry("p_oai", "openai"));openai.chat_provider = Some("openai:gpt-4o-mini".to_string());- let (model, model_id) = try_create_cloud_slug_chat_model("chat", &openai)+ let (model, model_id) = try_create_cloud_slug_chat_model("chat", &openai, &EgressLedger::none()).expect("openai should flip crate-native").expect("build");assert_eq!(model_id, "gpt-4o-mini");@@ -625,11 +630,11 @@ fn try_create_cloud_slug_flips_openai_but_declines_non_cloud() {// Managed (default), local runtimes, and unconfigured slugs are not cloud// slugs — they decline and fall through to their own paths.- assert!(try_create_cloud_slug_chat_model("chat", &Config::default()).is_none());+ assert!(try_create_cloud_slug_chat_model("chat", &Config::default(), &EgressLedger::none()).is_none());let mut local = Config::default();local.chat_provider = Some("ollama:qwen2.5".to_string());- assert!(try_create_cloud_slug_chat_model("chat", &local).is_none());+ assert!(try_create_cloud_slug_chat_model("chat", &local, &EgressLedger::none()).is_none());let mut unconfigured = Config::default();unconfigured.chat_provider = Some("deepseek:deepseek-chat".to_string());- assert!(try_create_cloud_slug_chat_model("chat", &unconfigured).is_none());+ assert!(try_create_cloud_slug_chat_model("chat", &unconfigured, &EgressLedger::none()).is_none());}