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:
2025-10-11 00:49:32 +02:00
parent 5c37df1b22
commit 40c44470e8
10 changed files with 55 additions and 65 deletions

View File

@@ -1,6 +1,5 @@
use owlen_core::mcp::client::McpClient;
use owlen_core::mcp::remote_client::RemoteMcpClient;
use owlen_core::mcp::McpToolCall;
use owlen_core::McpToolCall;
use std::fs::File;
use std::io::Write;
use tempfile::tempdir;
@@ -22,7 +21,7 @@ async fn remote_file_server_read_and_list() {
.join("../..")
.join("Cargo.toml");
let build_status = std::process::Command::new("cargo")
.args(&["build", "-p", "owlen-mcp-server", "--manifest-path"])
.args(["build", "-p", "owlen-mcp-server", "--manifest-path"])
.arg(manifest_path)
.status()
.expect("failed to run cargo build for MCP server");

View File

@@ -1,13 +1,12 @@
use owlen_core::mcp::client::McpClient;
use owlen_core::mcp::remote_client::RemoteMcpClient;
use owlen_core::mcp::McpToolCall;
use owlen_core::McpToolCall;
use tempfile::tempdir;
#[tokio::test]
async fn remote_write_and_delete() {
// Build the server binary first
let status = std::process::Command::new("cargo")
.args(&["build", "-p", "owlen-mcp-server"])
.args(["build", "-p", "owlen-mcp-server"])
.status()
.expect("failed to build MCP server");
assert!(status.success());
@@ -42,7 +41,7 @@ async fn remote_write_and_delete() {
async fn write_outside_root_is_rejected() {
// Build server (already built in previous test, but ensure it exists)
let status = std::process::Command::new("cargo")
.args(&["build", "-p", "owlen-mcp-server"])
.args(["build", "-p", "owlen-mcp-server"])
.status()
.expect("failed to build MCP server");
assert!(status.success());

View File

@@ -42,14 +42,16 @@ impl Tool for EchoTool {
#[tokio::test]
async fn test_tool_allowed_in_chat_mode() {
// Build a config where the `echo` tool is explicitly allowed in chat.
let mut cfg = Config::default();
cfg.modes = ModeConfig {
chat: ModeToolConfig {
allowed_tools: vec!["echo".to_string()],
},
code: ModeToolConfig {
allowed_tools: vec!["*".to_string()],
let cfg = Config {
modes: ModeConfig {
chat: ModeToolConfig {
allowed_tools: vec!["echo".to_string()],
},
code: ModeToolConfig {
allowed_tools: vec!["*".to_string()],
},
},
..Default::default()
};
let cfg = Arc::new(Mutex::new(cfg));
@@ -70,17 +72,18 @@ async fn test_tool_allowed_in_chat_mode() {
#[tokio::test]
async fn test_tool_not_allowed_in_any_mode() {
// Config that does NOT list `echo` in either mode.
let mut cfg = Config::default();
cfg.modes = ModeConfig {
chat: ModeToolConfig {
allowed_tools: vec!["web_search".to_string()],
},
code: ModeToolConfig {
allowed_tools: vec!["*".to_string()], // allow all in code
let cfg = Config {
modes: ModeConfig {
chat: ModeToolConfig {
allowed_tools: vec!["web_search".to_string()],
},
code: ModeToolConfig {
// Strict denial - only web_search allowed
allowed_tools: vec!["web_search".to_string()],
},
},
..Default::default()
};
// Remove the wildcard for code to simulate strict denial.
cfg.modes.code.allowed_tools = vec!["web_search".to_string()];
let cfg = Arc::new(Mutex::new(cfg));
let ui: Arc<dyn UiController> = Arc::new(NoOpUiController);