From 67c7849cb6d499f5f9ae05bcdd6b2d7a462856f2 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 29 Oct 2026 12:18:50 +0100 Subject: [PATCH] claude-connector: pin every serve-error mapping to a field with no stored value Co-Authored-By: Claude Sonnet 5.5 --- crates/claude-connector/src/daemon.rs | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/crates/claude-connector/src/daemon.rs b/crates/claude-connector/src/daemon.rs index 4622b4c..87450a8 100644 --- a/crates/claude-connector/src/daemon.rs +++ b/crates/claude-connector/src/daemon.rs @@ -435,6 +435,54 @@ mod tests { } } + #[test] + fn serve_errors_name_a_field_or_stage_and_never_a_stored_value() { + const CANARY: &str = "canary-path-8e2a"; + let io = || std::io::Error::other(CANARY); + let cases: Vec<(ServeError, &str)> = vec![ + (ServeError::InvalidConfig("callers"), "callers"), + (ServeError::BackendUnready("work_dir"), "work_dir"), + ( + ServeError::FrameBound { + max_frame_bytes: 4099, + payload_bytes: 4096, + needed_frame_bytes: 9999, + }, + "max_frame_bytes", + ), + (ServeError::ConnectionKey(io()), "connection_key_file"), + ( + ServeError::Service(ServiceError::ReplayStore(format!("{CANARY}/replay.cc"))), + "replay_store", + ), + ( + ServeError::Service(ServiceError::UnpricedModel(CANARY.to_string())), + "prices", + ), + ( + ServeError::Service(ServiceError::InvalidAdmission), + "callers", + ), + ( + ServeError::Service(ServiceError::DuplicateCaller), + "callers", + ), + ( + ServeError::Service(ServiceError::SharedCallerKey), + "callers", + ), + (ServeError::Listen(io()), "listener"), + ]; + for (error, field) in cases { + let shown = ConfigError::from(error); + let text = format!("{shown} {shown:?}"); + assert!(text.contains(field), "{text}"); + for stored in [CANARY, "4099", "9999", "replay.cc"] { + assert!(!text.contains(stored), "{text}"); + } + } + } + #[test] fn the_log_gets_the_size_of_the_childs_stderr_and_never_its_bytes() { let log = Captured::default();