Skip to content

Commit ed24804

Browse files
AlexMikhalevclaude
andcommitted
fix(tests): Remove duplicate llm_router fields from Role definitions
- Remove duplicate llm_router_enabled and llm_router_config fields that were accidentally added after the extra field in 13 test files - Fix unused import warning in proxy_client.rs (remove std::sync::Arc) - Add #[allow(dead_code)] to proxy_client.rs methods used only in tests - Prefix unused test variables with underscore in proxy_client.rs - Remove redundant inherent name() method from routed_adapter.rs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c8aac7e commit ed24804

16 files changed

Lines changed: 7 additions & 68 deletions

crates/terraphim_config/examples/atomic_server_config.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
136136
.with_atomic_secret(Some("your-base64-secret-here".to_string())),
137137
],
138138
extra: ahash::AHashMap::new(),
139-
llm_router_enabled: false,
140-
llm_router_config: None,
141139
llm_enabled: false,
142140
llm_api_key: None,
143141
llm_model: None,
@@ -175,8 +173,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
175173
.with_atomic_secret(Some("secret-for-server-2".to_string())),
176174
],
177175
extra: ahash::AHashMap::new(),
178-
llm_router_enabled: false,
179-
llm_router_config: None,
180176
llm_enabled: false,
181177
llm_api_key: None,
182178
llm_model: None,
@@ -220,8 +216,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
220216
// No authentication (atomic_server_secret: None is default)
221217
)],
222218
extra: ahash::AHashMap::new(),
223-
llm_router_enabled: false,
224-
llm_router_config: None,
225219
llm_enabled: false,
226220
llm_api_key: None,
227221
llm_model: None,
@@ -272,8 +266,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
272266
),
273267
],
274268
extra: ahash::AHashMap::new(),
275-
llm_router_enabled: false,
276-
llm_router_config: None,
277269
llm_enabled: false,
278270
llm_api_key: None,
279271
llm_model: None,
@@ -433,8 +425,6 @@ fn create_config_from_environment() -> Result<Config, Box<dyn std::error::Error>
433425
haystacks: vec![Haystack::new(server_url, ServiceType::Atomic, read_only)
434426
.with_atomic_secret(secret)],
435427
extra: ahash::AHashMap::new(),
436-
llm_router_enabled: false,
437-
llm_router_config: None,
438428
llm_enabled: false,
439429
llm_api_key: None,
440430
llm_model: None,

crates/terraphim_mcp_server/tests/mcp_autocomplete_e2e_test.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ async fn create_autocomplete_test_config() -> Result<String> {
101101
llm_router_enabled: false,
102102
llm_router_config: None,
103103
extra: ahash::AHashMap::new(),
104-
llm_router_enabled: false,
105-
llm_router_config: None,
106104
};
107105

108106
let mut config = ConfigBuilder::new()
@@ -581,8 +579,6 @@ async fn test_autocomplete_error_handling() -> Result<()> {
581579
llm_router_enabled: false,
582580
llm_router_config: None,
583581
extra: ahash::AHashMap::new(),
584-
llm_router_enabled: false,
585-
llm_router_config: None,
586582
};
587583

588584
let invalid_config = ConfigBuilder::new()

crates/terraphim_mcp_server/tests/mcp_rolegraph_validation_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ async fn create_terraphim_engineer_config() -> Result<String> {
110110
llm_router_enabled: false,
111111
llm_router_config: None,
112112
extra: ahash::AHashMap::new(),
113-
llm_router_enabled: false,
114-
llm_router_config: None,
115113
};
116114

117115
let mut config = ConfigBuilder::new()

crates/terraphim_middleware/tests/haystack_refactor_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,6 @@ async fn test_complete_ripgrep_workflow_with_extra_parameters() {
273273
llm_router_enabled: false,
274274
llm_router_config: None,
275275
extra: AHashMap::new(),
276-
llm_router_enabled: false,
277-
llm_router_config: None,
278276
};
279277

280278
let config = ConfigBuilder::new()

crates/terraphim_middleware/tests/mcp_haystack_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ async fn mcp_live_haystack_smoke() {
3838
llm_router_enabled: false,
3939
llm_router_config: None,
4040
extra: ahash::AHashMap::new(),
41-
llm_router_enabled: false,
42-
llm_router_config: None,
4341
};
4442

4543
let mut config = ConfigBuilder::new()

crates/terraphim_middleware/tests/perplexity_haystack_test.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ async fn test_perplexity_service_type_integration() {
108108
llm_router_enabled: false,
109109
llm_router_config: None,
110110
extra: ahash::AHashMap::new(),
111-
llm_router_enabled: false,
112-
llm_router_config: None,
113111
};
114112

115113
assert_eq!(role.haystacks.len(), 1);
@@ -206,8 +204,6 @@ async fn test_perplexity_missing_api_key() {
206204
llm_router_enabled: false,
207205
llm_router_config: None,
208206
extra: ahash::AHashMap::new(),
209-
llm_router_enabled: false,
210-
llm_router_config: None,
211207
};
212208

213209
let mut config = ConfigBuilder::new()
@@ -306,8 +302,6 @@ async fn perplexity_live_api_test() {
306302
llm_router_enabled: false,
307303
llm_router_config: None,
308304
extra: ahash::AHashMap::new(),
309-
llm_router_enabled: false,
310-
llm_router_config: None,
311305
};
312306

313307
let mut config = ConfigBuilder::new()

crates/terraphim_service/src/llm/proxy_client.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//! terraphim-llm-proxy service running on port 3456. This provides
55
//! service mode routing without embedding proxy routing logic in main codebase.
66
7-
use std::sync::Arc;
87
use async_trait::async_trait;
98
use serde_json::{json, Value};
109
use log::{debug, error, warn};
@@ -23,6 +22,7 @@ pub struct ProxyClientConfig {
2322
/// Request timeout (default: 60 seconds)
2423
pub timeout_secs: u64,
2524
/// Enable request/response logging
25+
#[allow(dead_code)]
2626
pub log_requests: bool,
2727
}
2828

@@ -61,11 +61,13 @@ impl ProxyLlmClient {
6161
}
6262

6363
/// Check if external proxy mode is active
64+
#[allow(dead_code)]
6465
pub fn is_proxy_mode(&self) -> bool {
6566
true
6667
}
6768

68-
/// Get client name for logging
69+
/// Get client name for logging (inherent method for tests)
70+
#[allow(dead_code)]
6971
pub fn name(&self) -> &'static str {
7072
"external_proxy_llm"
7173
}
@@ -290,7 +292,7 @@ mod tests {
290292

291293
#[tokio::test]
292294
async fn test_summarize_request_format() {
293-
let client = ProxyLlmClient::new(ProxyClientConfig::default());
295+
let _client = ProxyLlmClient::new(ProxyClientConfig::default());
294296

295297
let opts = SummarizeOptions {
296298
max_length: 500,
@@ -317,14 +319,14 @@ mod tests {
317319

318320
#[tokio::test]
319321
async fn test_chat_request_format() {
320-
let client = ProxyLlmClient::new(ProxyClientConfig::default());
322+
let _client = ProxyLlmClient::new(ProxyClientConfig::default());
321323

322324
let messages = vec![
323325
json!({"role": "system", "content": "You are helpful"}),
324326
json!({"role": "user", "content": "Hello"}),
325327
];
326328

327-
let opts = ChatOptions {
329+
let _opts = ChatOptions {
328330
temperature: Some(0.5),
329331
max_tokens: Some(100),
330332
};

crates/terraphim_service/src/llm/routed_adapter.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ impl RoutedLlmClient {
3939
fn is_routing_enabled(&self) -> bool {
4040
self.config.enabled
4141
}
42-
43-
/// Get the name of this client
44-
pub fn name(&self) -> &'static str {
45-
if self.is_routing_enabled() {
46-
"routed_llm"
47-
} else {
48-
self.client.as_ref().name()
49-
}
50-
}
5142
}
5243

5344
#[async_trait]

crates/terraphim_service/tests/chat_with_context_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ fn create_test_ollama_role(base_url: &str) -> terraphim_config::Role {
290290
extra: AHashMap::new(),
291291
llm_router_enabled: false,
292292
llm_router_config: None,
293-
llm_router_enabled: false,
294-
llm_router_config: None,
295293
};
296294

297295
role.extra

crates/terraphim_service/tests/kg_preprocessing_test.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ async fn test_kg_preprocessing_basic_functionality() {
4949
extra: AHashMap::new(),
5050
llm_router_enabled: false,
5151
llm_router_config: None,
52-
llm_router_enabled: false,
53-
llm_router_config: None,
5452
};
5553
config.roles.insert(role_name.clone(), role);
5654
config.selected_role = role_name.clone();
@@ -116,8 +114,6 @@ async fn test_kg_preprocessing_respects_terraphim_it_flag() {
116114
extra: AHashMap::new(),
117115
llm_router_enabled: false,
118116
llm_router_config: None,
119-
llm_router_enabled: false,
120-
llm_router_config: None,
121117
};
122118

123119
// Role with KG disabled
@@ -141,8 +137,6 @@ async fn test_kg_preprocessing_respects_terraphim_it_flag() {
141137
extra: AHashMap::new(),
142138
llm_router_enabled: false,
143139
llm_router_config: None,
144-
llm_router_enabled: false,
145-
llm_router_config: None,
146140
};
147141

148142
config
@@ -214,8 +208,6 @@ async fn test_kg_preprocessing_prevents_double_processing() {
214208
extra: AHashMap::new(),
215209
llm_router_enabled: false,
216210
llm_router_config: None,
217-
llm_router_enabled: false,
218-
llm_router_config: None,
219211
};
220212
config.roles.insert(role_name.clone(), role);
221213
config.selected_role = role_name.clone();

0 commit comments

Comments
 (0)