fix: resolve all compilation errors and clippy warnings
This commit fixes 12 categories of errors across the codebase: - Fix owlen-mcp-llm-server build target conflict by renaming lib.rs to main.rs - Resolve ambiguous glob re-exports in owlen-core by using explicit exports - Add Default derive to MockMcpClient and MockProvider test utilities - Remove unused imports from owlen-core test files - Fix needless borrows in test file arguments - Improve Config initialization style in mode_tool_filter tests - Make AgentExecutor::parse_response public for testing - Remove non-existent max_tool_calls field from AgentConfig usage - Fix AgentExecutor::new calls to use correct 3-argument signature - Fix AgentResult field access in agent tests - Use Debug formatting instead of Display for AgentResult - Remove unnecessary default() calls on unit structs All changes ensure the project compiles cleanly with: - cargo check --all-targets ✓ - cargo clippy --all-targets -- -D warnings ✓ - cargo test --no-run ✓ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -82,10 +82,9 @@ async fn test_agent_single_tool_scenario() {
|
||||
model: "llama3.2".to_string(),
|
||||
temperature: Some(0.7),
|
||||
max_tokens: None,
|
||||
max_tool_calls: 10,
|
||||
};
|
||||
|
||||
let executor = AgentExecutor::new(provider, mcp_client, config, None);
|
||||
let executor = AgentExecutor::new(provider, mcp_client, config);
|
||||
|
||||
// Simple query that should complete in one tool call
|
||||
let result = executor
|
||||
@@ -93,9 +92,12 @@ async fn test_agent_single_tool_scenario() {
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Ok(answer) => {
|
||||
assert!(!answer.is_empty(), "Answer should not be empty");
|
||||
println!("Agent answer: {}", answer);
|
||||
Ok(agent_result) => {
|
||||
assert!(
|
||||
!agent_result.answer.is_empty(),
|
||||
"Answer should not be empty"
|
||||
);
|
||||
println!("Agent answer: {}", agent_result.answer);
|
||||
}
|
||||
Err(e) => {
|
||||
// It's okay if this fails due to LLM not following format
|
||||
@@ -116,10 +118,9 @@ async fn test_agent_multi_step_workflow() {
|
||||
model: "llama3.2".to_string(),
|
||||
temperature: Some(0.5), // Lower temperature for more consistent behavior
|
||||
max_tokens: None,
|
||||
max_tool_calls: 20,
|
||||
};
|
||||
|
||||
let executor = AgentExecutor::new(provider, mcp_client, config, None);
|
||||
let executor = AgentExecutor::new(provider, mcp_client, config);
|
||||
|
||||
// Query requiring multiple steps: list -> read -> analyze
|
||||
let result = executor
|
||||
@@ -127,9 +128,9 @@ async fn test_agent_multi_step_workflow() {
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Ok(answer) => {
|
||||
assert!(!answer.is_empty());
|
||||
println!("Multi-step answer: {}", answer);
|
||||
Ok(agent_result) => {
|
||||
assert!(!agent_result.answer.is_empty());
|
||||
println!("Multi-step answer: {:?}", agent_result);
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Multi-step test skipped: {}", e);
|
||||
@@ -148,10 +149,9 @@ async fn test_agent_iteration_limit() {
|
||||
model: "llama3.2".to_string(),
|
||||
temperature: Some(0.7),
|
||||
max_tokens: None,
|
||||
max_tool_calls: 5,
|
||||
};
|
||||
|
||||
let executor = AgentExecutor::new(provider, mcp_client, config, None);
|
||||
let executor = AgentExecutor::new(provider, mcp_client, config);
|
||||
|
||||
// Complex query that would require many iterations
|
||||
let result = executor
|
||||
@@ -186,14 +186,13 @@ async fn test_agent_tool_budget_enforcement() {
|
||||
let mcp_client = Arc::clone(&provider) as Arc<RemoteMcpClient>;
|
||||
|
||||
let config = AgentConfig {
|
||||
max_iterations: 20,
|
||||
max_iterations: 3, // Very low iteration limit to enforce budget
|
||||
model: "llama3.2".to_string(),
|
||||
temperature: Some(0.7),
|
||||
max_tokens: None,
|
||||
max_tool_calls: 3, // Very low tool call budget
|
||||
};
|
||||
|
||||
let executor = AgentExecutor::new(provider, mcp_client, config, None);
|
||||
let executor = AgentExecutor::new(provider, mcp_client, config);
|
||||
|
||||
// Query that would require many tool calls
|
||||
let result = executor
|
||||
@@ -238,7 +237,7 @@ fn create_test_executor() -> AgentExecutor {
|
||||
let mcp_client = Arc::clone(&provider) as Arc<RemoteMcpClient>;
|
||||
|
||||
let config = AgentConfig::default();
|
||||
AgentExecutor::new(provider, mcp_client, config, None)
|
||||
AgentExecutor::new(provider, mcp_client, config)
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -248,7 +247,7 @@ fn test_agent_config_defaults() {
|
||||
assert_eq!(config.max_iterations, 10);
|
||||
assert_eq!(config.model, "ollama");
|
||||
assert_eq!(config.temperature, Some(0.7));
|
||||
assert_eq!(config.max_tool_calls, 20);
|
||||
// max_tool_calls field removed - agent now tracks iterations instead
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -258,12 +257,10 @@ fn test_agent_config_custom() {
|
||||
model: "custom-model".to_string(),
|
||||
temperature: Some(0.5),
|
||||
max_tokens: Some(2000),
|
||||
max_tool_calls: 30,
|
||||
};
|
||||
|
||||
assert_eq!(config.max_iterations, 15);
|
||||
assert_eq!(config.model, "custom-model");
|
||||
assert_eq!(config.temperature, Some(0.5));
|
||||
assert_eq!(config.max_tokens, Some(2000));
|
||||
assert_eq!(config.max_tool_calls, 30);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user