Skip to content

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

test(config): use default struct update for ephemeral routes

Steven Enamakel24841bfa5048
diff --git a/crates/openhuman-core/src/config/ops/loader_current_tests.rs b/crates/openhuman-core/src/config/ops/loader_current_tests.rs
index 5100821b9e..3f5fc959f1 100644
--- a/crates/openhuman-core/src/config/ops/loader_current_tests.rs
+++ b/crates/openhuman-core/src/config/ops/loader_current_tests.rs
@@ -20,6 +20,7 @@ async fn a_context_route_follows_every_load_of_the_context_config() {
endpoint: "http://127.0.0.1:9/v1".to_string(),
api_key: "test-key".to_string(),
headers: Vec::new(),
+ ..EphemeralRoute::default()
});
let loaded = load_current_or_init(&DispatchCtx::new(context_with(config)))
diff --git a/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs b/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs
index d8ebcfcc8f..569c674c80 100644
--- a/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs
+++ b/crates/openhuman-core/src/config/schema/ephemeral_route_tests.rs
@@ -54,6 +54,7 @@ fn route() -> EphemeralRoute {
endpoint: "http://127.0.0.1:41234/openai".to_string(),
api_key: "mdl-token".to_string(),
headers: Vec::new(),
+ ..EphemeralRoute::default()
}
}
@@ -67,6 +68,7 @@ fn from_params_needs_both_halves() {
endpoint: "http://x/openai".into(),
api_key: "k".into(),
headers: Vec::new(),
+ ..EphemeralRoute::default()
})
);
// An endpoint with no credential and a credential with no endpoint are both
@@ -96,6 +98,7 @@ fn from_params_treats_blank_as_absent_and_trims() {
endpoint: "http://x/openai".into(),
api_key: "k".into(),
headers: Vec::new(),
+ ..EphemeralRoute::default()
})
);
}
@@ -197,6 +200,7 @@ fn apply_twice_leaves_one_entry() {
endpoint: "http://127.0.0.1:9999/openai".into(),
api_key: "mdl-other".into(),
headers: Vec::new(),
+ ..EphemeralRoute::default()
},
);
let entries: Vec<_> = config
@@ -274,6 +278,7 @@ fn a_changed_route_is_applied_and_logged_once() {
endpoint: "http://127.0.0.1:9999/openai".into(),
api_key: "mdl-other".into(),
headers: Vec::new(),
+ ..EphemeralRoute::default()
};
apply(&mut config, changed.clone());
@@ -313,6 +318,7 @@ fn debug_never_discloses_route_bearer_or_header_values() {
endpoint: "https://fixture.example/v1".into(),
api_key: "u2-unique-route-secret".into(),
headers: vec![("x-private".into(), "u2-unique-header-secret".into())],
+ ..EphemeralRoute::default()
};
let debug = format!("{route:?}");
assert!(!debug.contains("u2-unique-route-secret"));
diff --git a/crates/openhuman-core/src/core/runtime/direct_profile_provider.rs b/crates/openhuman-core/src/core/runtime/direct_profile_provider.rs
index f0c198d8b9..f2716efb5b 100644
--- a/crates/openhuman-core/src/core/runtime/direct_profile_provider.rs
+++ b/crates/openhuman-core/src/core/runtime/direct_profile_provider.rs
@@ -51,6 +51,7 @@ impl DirectProfileProvider {
endpoint,
api_key,
headers: Vec::new(),
+ ..EphemeralRoute::default()
},
model,
})
diff --git a/crates/openhuman-core/src/doctor/checks/inference_live_tests.rs b/crates/openhuman-core/src/doctor/checks/inference_live_tests.rs
index aaa618de6a..2d029bd237 100644
--- a/crates/openhuman-core/src/doctor/checks/inference_live_tests.rs
+++ b/crates/openhuman-core/src/doctor/checks/inference_live_tests.rs
@@ -53,6 +53,7 @@ fn config_for(server: &MockServer, model: &str) -> Fixture {
endpoint: format!("{}/openai/{ENDPOINT_SECRET}", server.uri()),
api_key: TEST_BEARER.to_string(),
headers: Vec::new(),
+ ..EphemeralRoute::default()
},
);
fixture.config = config;
diff --git a/crates/openhuman-core/src/inference/provider/factory_tests.rs b/crates/openhuman-core/src/inference/provider/factory_tests.rs
index 7a87fe318a..04f5d7eb14 100644
--- a/crates/openhuman-core/src/inference/provider/factory_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_tests.rs
@@ -490,6 +490,7 @@ fn routed_config(endpoint: &str, api_key: &str, model: &str) -> Config {
endpoint: endpoint.to_string(),
api_key: api_key.to_string(),
headers: Vec::new(),
+ ..EphemeralRoute::default()
},
);
config
diff --git a/crates/openhuman-core/src/inference/registry_tests.rs b/crates/openhuman-core/src/inference/registry_tests.rs
index 0b43c58347..337e133ec8 100644
--- a/crates/openhuman-core/src/inference/registry_tests.rs
+++ b/crates/openhuman-core/src/inference/registry_tests.rs
@@ -226,6 +226,7 @@ async fn a_registered_catalog_receives_the_entrys_provider_key() {
endpoint: "https://self-hosted.example/v1".into(),
api_key: "entry-key".into(),
headers: vec![],
+ ..EphemeralRoute::default()
}),
..Config::default()
};