diff --git a/crates/tinyinference-llm/src/providers/overrides.rs b/crates/tinyinference-llm/src/providers/overrides.rs index 59f4e9a2..078f272a 100644 --- a/crates/tinyinference-llm/src/providers/overrides.rs +++ b/crates/tinyinference-llm/src/providers/overrides.rs @@ -227,7 +227,6 @@ pub type CatalogListing = pub type CatalogLimitsFuture = BoxFuture>; /// Input to an async provider catalog limits resolver. -#[derive(Debug)] pub struct CatalogLimitsRequest { /// Model whose supported limits are being discovered. pub model: String, @@ -235,6 +234,16 @@ pub struct CatalogLimitsRequest { pub context: Ctx, } +impl std::fmt::Debug for CatalogLimitsRequest { + fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .debug_struct("CatalogLimitsRequest") + .field("model", &self.model) + .field("context", &"") + .finish() + } +} + /// Builds the provider limit discovery request for a model, if supported. pub type CatalogLimits = Arc) -> CatalogLimitsFuture + Send + Sync>; diff --git a/crates/tinyinference-llm/tests/provider_overrides.rs b/crates/tinyinference-llm/tests/provider_overrides.rs index ac160a9c..2c3613bf 100644 --- a/crates/tinyinference-llm/tests/provider_overrides.rs +++ b/crates/tinyinference-llm/tests/provider_overrides.rs @@ -380,3 +380,17 @@ fn registered_chat_entry_exposes_all_provider_model_metadata() { assert_eq!(request.metadata["caller"], "retained"); assert_eq!(request.metadata["reasoning_disabled"], true); } + +#[test] +fn catalog_limits_request_debug_redacts_the_host_context() { + let request = CatalogLimitsRequest { + model: "gpt-test".to_string(), + context: "sk-live-secret", + }; + + let printed = format!("{request:?}"); + + assert!(printed.contains("gpt-test"), "{printed}"); + assert!(printed.contains(""), "{printed}"); + assert!(!printed.contains("sk-live-secret"), "{printed}"); +}