Skip to content

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

test(inference): cover fragment redaction in bearer refusal diagnostics

Steven Enamakel8665093ef229
diff --git a/crates/openhuman-core/src/inference/readiness_tests.rs b/crates/openhuman-core/src/inference/readiness_tests.rs
index 23298baf5f..4557f783fc 100644
--- a/crates/openhuman-core/src/inference/readiness_tests.rs
+++ b/crates/openhuman-core/src/inference/readiness_tests.rs
@@ -8,7 +8,6 @@ async fn cached_probe_serves_definitive_negative_results() {
use crate::inference::registry::{register_chat_model_in, ChatModelEntry, ProviderModelHooks};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
- use tinyinference_llm::model::ChatModel;
let tmp = TempDir::new().unwrap();
let mut config = Config {
diff --git a/crates/openhuman-tinyhumans/src/inference/managed_embedding_tests.rs b/crates/openhuman-tinyhumans/src/inference/managed_embedding_tests.rs
index 414c871c91..d491052af3 100644
--- a/crates/openhuman-tinyhumans/src/inference/managed_embedding_tests.rs
+++ b/crates/openhuman-tinyhumans/src/inference/managed_embedding_tests.rs
@@ -3,7 +3,7 @@ use openhuman_embed::__host::config::Config;
use openhuman_embed::__host::security::credentials::AuthService;
use std::collections::HashMap;
use tinyinference_embeddings::{
- CloudEmbeddingModel, DEFAULT_CLOUD_DIMENSIONS, DEFAULT_CLOUD_MODEL,
+ CloudEmbeddingModel, EmbeddingModel, DEFAULT_CLOUD_DIMENSIONS, DEFAULT_CLOUD_MODEL,
};
fn test_config(tmp: &tempfile::TempDir) -> Config {
diff --git a/crates/openhuman-tinyhumans/src/inference/managed_model_tests.rs b/crates/openhuman-tinyhumans/src/inference/managed_model_tests.rs
index f77b004bb8..908a5a52d1 100644
--- a/crates/openhuman-tinyhumans/src/inference/managed_model_tests.rs
+++ b/crates/openhuman-tinyhumans/src/inference/managed_model_tests.rs
@@ -98,25 +98,40 @@ fn managed_bearer_refusal_redacts_foreign_endpoint_details() {
secrets_encrypt: false,
..ManagedOptions::default()
};
- let endpoint = "https://synthetic-user:[email protected]/private/SYNTHETIC_PATH?token=SYNTHETIC_QUERY";
-
- let error = options
- .resolve_bearer(endpoint)
- .expect_err("foreign endpoint must remain rejected");
- let diagnostic = error.to_string();
- for marker in [
- "synthetic-user",
- "SYNTHETIC_PASSWORD",
- "SYNTHETIC_PATH",
- "SYNTHETIC_QUERY",
- "SYNTHETIC_BEARER_MARKER",
+ for (endpoint, markers) in [
+ (
+ "https://synthetic-user:[email protected]/private/SYNTHETIC_PATH?token=SYNTHETIC_QUERY#SYNTHETIC_FRAGMENT",
+ [
+ "synthetic-user",
+ "SYNTHETIC_PASSWORD",
+ "SYNTHETIC_PATH",
+ "SYNTHETIC_QUERY",
+ "SYNTHETIC_FRAGMENT",
+ ],
+ ),
+ (
+ "https://foreign.example/private/SYNTHETIC_PATH?token=SYNTHETIC_QUERY#SYNTHETIC_FRAGMENT",
+ [
+ "unused-userinfo",
+ "unused-password",
+ "SYNTHETIC_PATH",
+ "SYNTHETIC_QUERY",
+ "SYNTHETIC_FRAGMENT",
+ ],
+ ),
] {
- assert!(
- !diagnostic.contains(marker),
- "refusal diagnostic exposed {marker}: {diagnostic}"
- );
+ let error = options
+ .resolve_bearer(endpoint)
+ .expect_err("foreign endpoint must remain rejected");
+ let diagnostic = error.to_string();
+ for marker in markers.into_iter().chain(["SYNTHETIC_BEARER_MARKER"]) {
+ assert!(
+ !diagnostic.contains(marker),
+ "refusal diagnostic exposed {marker}: {diagnostic}"
+ );
+ }
+ assert!(diagnostic.contains("refusing to send"), "{diagnostic}");
}
- assert!(diagnostic.contains("refusing to send"), "{diagnostic}");
}
async fn unauthorized_chat_response() -> axum::response::Response {