From fcedfa041154269fa60faabe677cc7ef0c97f4c4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 3 Dec 2026 16:05:44 +0100 Subject: [PATCH] Test fixtures name lanes by one neutral id; the live connector test reads its ids from env (cut-mp-lane-models-deploy-config) Co-Authored-By: Claude Opus 5.5 --- crates/ghostlight-dungeon/src/begin.rs | 12 +++--- crates/ghostlight-dungeon/src/test_support.rs | 8 +++- crates/ghostlight-dungeon/src/waves.rs | 12 +++--- crates/ghostlight/src/controllers.rs | 42 +++++++++++-------- 4 files changed, 42 insertions(+), 32 deletions(-) diff --git a/crates/ghostlight-dungeon/src/begin.rs b/crates/ghostlight-dungeon/src/begin.rs index 6afbfe4..1bb411f 100644 --- a/crates/ghostlight-dungeon/src/begin.rs +++ b/crates/ghostlight-dungeon/src/begin.rs @@ -585,13 +585,13 @@ pub(crate) mod tests { Shared { inference: port.clone(), models: ControllerModels { - projector: "claude-sonnet-5-5".into(), - persona: "claude-sonnet-5-5".into(), - interpreter: "claude-haiku-5-5".into(), - operational_agent: "claude-haiku-5-5".into(), - elaborator: "claude-sonnet-5-5".into(), + projector: crate::test_support::TEST_LANE_MODEL.into(), + persona: crate::test_support::TEST_LANE_MODEL.into(), + interpreter: crate::test_support::TEST_LANE_MODEL.into(), + operational_agent: crate::test_support::TEST_LANE_MODEL.into(), + elaborator: crate::test_support::TEST_LANE_MODEL.into(), }, - play_model: "claude-sonnet-5-5".into(), + play_model: crate::test_support::TEST_LANE_MODEL.into(), permits: Arc::new(Semaphore::new(2)), }, fatal, diff --git a/crates/ghostlight-dungeon/src/test_support.rs b/crates/ghostlight-dungeon/src/test_support.rs index 5825058..b7a2398 100644 --- a/crates/ghostlight-dungeon/src/test_support.rs +++ b/crates/ghostlight-dungeon/src/test_support.rs @@ -10,6 +10,10 @@ use crate::{ runtime::AppState, timelines::Timelines, }; +/// The one neutral model id every test lane runs on: ids are opaque exact +/// strings, so no fixture names a provider or tier. +pub(crate) const TEST_LANE_MODEL: &str = "test/lane-a"; + use chrono::Utc; use ghostlight::{ InferenceFault, InferenceOutput, InferencePort, InferenceRequest, PreparedInference, @@ -159,7 +163,7 @@ mod tests { let request = InferenceRequest::play( ghostlight::CommandId::new(), 0, - "claude-opus-5-5", + TEST_LANE_MODEL, "be brief", vec![], vec![], @@ -168,6 +172,6 @@ mod tests { .unwrap(); let prepared = port.prepare(request).unwrap(); let seen = serde_json::to_value(&prepared).unwrap(); - assert_eq!(model_of(&seen).as_deref(), Some("claude-opus-5-5")); + assert_eq!(model_of(&seen).as_deref(), Some(TEST_LANE_MODEL)); } } diff --git a/crates/ghostlight-dungeon/src/waves.rs b/crates/ghostlight-dungeon/src/waves.rs index 6a80b54..57c9fcf 100644 --- a/crates/ghostlight-dungeon/src/waves.rs +++ b/crates/ghostlight-dungeon/src/waves.rs @@ -445,11 +445,11 @@ pub(crate) mod tests { fn models() -> ControllerModels { ControllerModels { - projector: "claude-sonnet-5-5".into(), - persona: "claude-sonnet-5-5".into(), - interpreter: "claude-haiku-5-5".into(), - operational_agent: "claude-haiku-5-5".into(), - elaborator: "claude-sonnet-5-5".into(), + projector: crate::test_support::TEST_LANE_MODEL.into(), + persona: crate::test_support::TEST_LANE_MODEL.into(), + interpreter: crate::test_support::TEST_LANE_MODEL.into(), + operational_agent: crate::test_support::TEST_LANE_MODEL.into(), + elaborator: crate::test_support::TEST_LANE_MODEL.into(), } } @@ -587,7 +587,7 @@ pub(crate) mod tests { Shared { inference, models: models(), - play_model: "claude-sonnet-5-5".into(), + play_model: crate::test_support::TEST_LANE_MODEL.into(), permits: Arc::new(Semaphore::new(2)), }, fatal, diff --git a/crates/ghostlight/src/controllers.rs b/crates/ghostlight/src/controllers.rs index 698dba2..46349e0 100644 --- a/crates/ghostlight/src/controllers.rs +++ b/crates/ghostlight/src/controllers.rs @@ -7725,6 +7725,9 @@ fn purpose_name(purpose: InferencePurpose) -> &'static str { #[cfg(test)] mod tests { + /// The one neutral model id the tests give every lane: ids are opaque + /// exact strings, so no fixture names a provider or tier. + const TEST_LANE_MODEL: &str = "test/lane-a"; /// The connector port's share of the no-input-text rule: a key-file path /// and a runtime identity each arrive as a canary, and the fault names @@ -7781,7 +7784,7 @@ mod tests { caller_runtime_id: "runtime".into(), native_request_sha256: [1; 32], provider_request_sha256: [2; 32], - model: "claude-haiku-5-5".into(), + model: TEST_LANE_MODEL.into(), provider: "anthropic-messages".into(), foreign_reasoning_dropped: 0, outcome, @@ -8003,7 +8006,7 @@ mod tests { #[test] fn a_stale_invocation_is_renewed_and_a_live_one_is_sent_as_it_is() { let skew = REQUEST_EXPIRY.as_millis() as u64; - let request = persona_request(CommandId::new(), "claude-haiku-5-5", "Speak.".into()).unwrap(); + let request = persona_request(CommandId::new(), TEST_LANE_MODEL, "Speak.".into()).unwrap(); let prepared = PreparedInference::prepare("runtime", 1_000_000 + skew, request).unwrap(); let live = prepared.invocation.clone(); let sent = renewed_invocation(live.clone(), 1_000_000).unwrap(); @@ -8035,7 +8038,7 @@ mod tests { let endpoint = listener.local_addr().unwrap(); let peer = std::thread::spawn(move || drop(listener.accept().unwrap())); let port = ConnectorInferencePort::new(endpoint, "test-key".into(), "runtime").unwrap(); - let request = persona_request(CommandId::new(), "claude-haiku-5-5", "Speak.".into()).unwrap(); + let request = persona_request(CommandId::new(), TEST_LANE_MODEL, "Speak.".into()).unwrap(); let prepared = port.prepare(request).unwrap(); let fault = port.infer(prepared).await.expect_err("a hung-up peer answered"); peer.join().unwrap(); @@ -8050,7 +8053,7 @@ mod tests { /// choose each lane's cache retention in `lane_cache_retention`. #[test] fn every_lane_builds_a_bounded_typed_v4_request() { - let persona = persona_request(CommandId::new(), "claude-haiku-5-5", "Speak.".into()).unwrap(); + let persona = persona_request(CommandId::new(), TEST_LANE_MODEL, "Speak.".into()).unwrap(); assert_eq!(persona.provider.max_output_tokens, 1_200); assert_eq!(persona.provider.reasoning_effort, Some(ReasoningEffort::Low)); assert_eq!(persona.provider.cache_retention, None::); @@ -8059,7 +8062,7 @@ mod tests { CommandId::new(), 0, purpose, - "claude-haiku-5-5", + TEST_LANE_MODEL, "Decide.", vec![InputItem::UserText { text: "x".into() }], Vec::new(), @@ -8081,7 +8084,7 @@ mod tests { let play = InferenceRequest::play( CommandId::new(), 0, - "claude-haiku-5-5", + TEST_LANE_MODEL, "Play.", vec![InputItem::UserText { text: "x".into() }], Vec::new(), @@ -8091,7 +8094,7 @@ mod tests { assert_eq!(play.provider.cache_retention, Some(CacheRetention::Long)); assert_eq!(play.uncached().provider.cache_retention, None); let interpreter = - interpreter_request(CommandId::new(), 0, "claude-haiku-5-5", vec![InputItem::UserText { text: "x".into() }]) + interpreter_request(CommandId::new(), 0, TEST_LANE_MODEL, vec![InputItem::UserText { text: "x".into() }]) .unwrap(); assert_eq!(interpreter.provider.max_output_tokens, DECISION_REQUEST_SHAPE.max_output_tokens); assert_eq!(interpreter.provider.reasoning_effort, Some(ReasoningEffort::Medium)); @@ -8175,7 +8178,7 @@ mod tests { /// tools, automatic choice, serial calls and no output schema. #[test] fn the_prose_shape_gate_refuses_each_deviation() { - let request = persona_request(CommandId::new(), "claude-haiku-5-5", "Speak.".into()).unwrap(); + let request = persona_request(CommandId::new(), TEST_LANE_MODEL, "Speak.".into()).unwrap(); let valid = PreparedInference::prepare("runtime", 4_102_444_800_000, request).unwrap(); assert!(prose_request_shape_is_valid(&valid)); assert!(persona_request_shape_is_valid(&valid)); @@ -8216,7 +8219,7 @@ mod tests { /// included. #[test] fn the_trace_renders_every_input_kind_and_the_tools() { - let mut provider = ProviderRequest::new("r", "c", "claude-haiku-5-5", "Be brief.", 100); + let mut provider = ProviderRequest::new("r", "c", TEST_LANE_MODEL, "Be brief.", 100); provider.input = vec![ InputItem::UserText { text: "u-text".into() }, InputItem::AssistantText { text: "a-text".into() }, @@ -8267,7 +8270,8 @@ mod tests { /// The live check, run by hand on the host that carries claude-connector: /// Ghostlight's own port completes a plain, a tool and an output-schema - /// request on haiku and a plain request on sonnet, with usage reported. + /// request on the model `GHOSTLIGHT_LIVE_MODEL_A` names and a plain request + /// on the one `GHOSTLIGHT_LIVE_MODEL_B` names, with usage reported. /// The key reaches the process only as the systemd credential /// `connector-key`, for example /// `systemd-run -p LoadCredential=connector-key: ...`. @@ -8285,6 +8289,8 @@ mod tests { ) .expect("the port opens"); let stamp = unix_ms().unwrap(); + let model_a = std::env::var("GHOSTLIGHT_LIVE_MODEL_A").expect("GHOSTLIGHT_LIVE_MODEL_A names a model id"); + let model_b = std::env::var("GHOSTLIGHT_LIVE_MODEL_B").expect("GHOSTLIGHT_LIVE_MODEL_B names a model id"); let build = |label: &str, model: &str, edit: &dyn Fn(&mut ProviderRequest)| { let mut provider = ProviderRequest::new( format!("live-{label}-{stamp}"), @@ -8322,12 +8328,12 @@ mod tests { ); }; let cases = [ - build("plain", "claude-haiku-5-5", &|_| {}), - build("tool", "claude-haiku-5-5", &tool), - build("schema", "claude-haiku-5-5", &schema), - build("sonnet", "claude-sonnet-5-5", &|_| {}), + build("plain", &model_a, &|_| {}), + build("tool", &model_a, &tool), + build("schema", &model_a, &schema), + build("second", &model_b, &|_| {}), ]; - for (label, request) in ["plain", "tool", "schema", "sonnet"].into_iter().zip(cases) { + for (label, request) in ["plain", "tool", "schema", "second"].into_iter().zip(cases) { let prepared = port.prepare(request).expect("the request prepares"); let output = port.infer(prepared).await.unwrap_or_else(|fault| { panic!("{label}: the connector faulted: {fault:?}"); @@ -11712,7 +11718,7 @@ assert!(projector_text.contains("I ask about the hinge."), "the player's own tur operational_request( command_id, 0, - "claude-opus-5", + TEST_LANE_MODEL, &granted, vec![InputItem::UserText { text: "Hold the bridge.".into(), @@ -11748,7 +11754,7 @@ assert!(projector_text.contains("I ask about the hinge."), "the player's own tur text: "Hold the bridge.".into(), }] }; - let model = "claude-opus-5"; + let model = TEST_LANE_MODEL; assert!( canonical_model(model), "the SDK-routed model is not a canonical controller model" @@ -11835,7 +11841,7 @@ assert!(projector_text.contains("I ask about the hinge."), "the player's own tur else { panic!("an empty interpreter transcript finalized") }; - let request = interpreter_request(command_id, 0, "claude-opus-5", conversation).unwrap(); + let request = interpreter_request(command_id, 0, TEST_LANE_MODEL, conversation).unwrap(); let work = ControllerWork::Narrative(NarrativeCheckpoint::InterpreterInFlight { command_id, turn: turn.clone(),