From eb8cc1799359a5ef5b4a4ee3a4202b87e80bfe6c Mon Sep 17 00:00:00 2001 From: "Cyrene (Mem)" Date: Wed, 22 Jul 2026 13:57:50 +0700 Subject: [PATCH] fix(rust): remove unused imports, variables, and dead code causing CI build failures - Remove unused imports: AtomicBool, Future (provider.rs), debug (executor.rs) - Remove unused import WorkflowScript (workflow.rs) - Remove unused variables: tool_name, t_ctx, t_args (executor.rs) - Remove dead variable class_indent (semantic_search.rs) CI was failing with 'error: could not compile zesdex-infrastructure due to 10 previous errors' caused by -D warnings treating unused code as compilation errors. --- apps/infrastructure/src/llm/provider.rs | 2 -- apps/infrastructure/src/tools/executor.rs | 12 ------------ apps/infrastructure/src/tools/semantic_search.rs | 3 --- apps/infrastructure/src/tools/workflow.rs | 2 +- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/apps/infrastructure/src/llm/provider.rs b/apps/infrastructure/src/llm/provider.rs index c781821..d956648 100644 --- a/apps/infrastructure/src/llm/provider.rs +++ b/apps/infrastructure/src/llm/provider.rs @@ -2,9 +2,7 @@ //! supporting both non-streaming and SSE-streaming requests with automatic retry. use rand_core::RngCore; -use std::sync::atomic::AtomicBool; use std::time::Duration; -use std::future::Future; use zesdex_domain::core::{ ChatMessage, ChatRequest, ChatResponse, SseParser, StreamEvent, StreamOptions, ToolDef, diff --git a/apps/infrastructure/src/tools/executor.rs b/apps/infrastructure/src/tools/executor.rs index 540a7fa..3681bb8 100644 --- a/apps/infrastructure/src/tools/executor.rs +++ b/apps/infrastructure/src/tools/executor.rs @@ -2,7 +2,6 @@ use std::future::Future; use anyhow::Result; use zesdex_application::agent::ToolExecutor; use crate::tools::{all_tools, Tool, ToolCtx}; -use tracing::debug; pub struct InfrastructureToolExecutor { ctx: ToolCtx, @@ -32,17 +31,6 @@ impl ToolExecutor for InfrastructureToolExecutor { async move { match tool_opt { Some(tool) => { - // Tool::run is synchronous, so we run it in a blocking task if needed - // For now, since they run fast and we are transitioning, we can just block in place. - // Or tokio::task::spawn_blocking: - let tool_name = tool.name().to_string(); - let t_ctx = ctx.clone(); - let t_args = args.clone(); - - // Because Tool isn't easily cloned, we might just block on the current thread, - // or use tokio::task::block_in_place if we're in a tokio runtime. - // But `tool.run` takes `&self`, and we have `&self` borrowed. - // For now we just call it directly. tokio::task::block_in_place(move || { tool.run(&ctx, &args) }) diff --git a/apps/infrastructure/src/tools/semantic_search.rs b/apps/infrastructure/src/tools/semantic_search.rs index 30c9918..04d2134 100644 --- a/apps/infrastructure/src/tools/semantic_search.rs +++ b/apps/infrastructure/src/tools/semantic_search.rs @@ -872,7 +872,6 @@ fn extract_python(content: &str, rel_path: &str) -> Vec { // Track current class for method nesting // Reset when we see a non-indented line outside a class. let mut current_class: Option = None; - let mut class_indent: Option = None; for (i, line) in lines.iter().enumerate() { let line_num = i + 1; @@ -882,14 +881,12 @@ fn extract_python(content: &str, rel_path: &str) -> Vec { // Reset class tracking when we leave its indentation level. if current_class.is_some() && indent == 0 && !trimmed.is_empty() { current_class = None; - class_indent = None; } // Class if let Some(caps) = r.py_class.captures(trimmed) { let name = caps.get(1).unwrap().as_str().to_string(); current_class = Some(name.clone()); - class_indent = Some(indent); symbols.push(CodeSymbol { name, kind: SymbolKind::Class, diff --git a/apps/infrastructure/src/tools/workflow.rs b/apps/infrastructure/src/tools/workflow.rs index 945d39d..878176b 100644 --- a/apps/infrastructure/src/tools/workflow.rs +++ b/apps/infrastructure/src/tools/workflow.rs @@ -14,7 +14,7 @@ use crate::tools::{arg_str, Tool, ToolCtx}; use crate::workflow::engine::execution::execute_workflow; use crate::workflow::hive_mind::cycle::execute_cycle; use crate::workflow::hive_mind::synthesis::synthesize_consensus; -use zesdex_domain::workflow::{CognitiveCycle, NodeDirective, NodeOutput, WorkflowScript}; +use zesdex_domain::workflow::{CognitiveCycle, NodeDirective, NodeOutput}; /// Execute a multi-step workflow defined in YAML. ///