From bb6be3a832fc9abd016082c49718a102e07a36a2 Mon Sep 17 00:00:00 2001 From: commis-ci-fix Date: Fri, 10 Apr 2026 21:59:28 +0200 Subject: [PATCH] refactor(arch): supprime 4 fonctions pub mortes identifiees par audit Supprime les fonctions sans aucun appelant dans le codebase : - ToolMatrix::all_runtime_scores (mcp/matrix.rs) - McpState::write_scorer (mcp/mod.rs) - catalog::all_names (tool_layer/catalog.rs) - write_pid_atomic (pid.rs) --- src/features/mcp/matrix.rs | 5 ----- src/features/mcp/mod.rs | 5 ----- src/features/tool_layer/catalog.rs | 5 ----- src/pid.rs | 17 ----------------- 4 files changed, 32 deletions(-) diff --git a/src/features/mcp/matrix.rs b/src/features/mcp/matrix.rs index 4449b7d9..172c8310 100644 --- a/src/features/mcp/matrix.rs +++ b/src/features/mcp/matrix.rs @@ -316,11 +316,6 @@ impl ToolMatrix { self.runtime_scores.insert(tool, provider, score).await; } - /// Returns a snapshot of all runtime scores as (tool, provider, score) triples. - pub async fn all_runtime_scores(&self) -> Vec<(String, String, ToolScore)> { - self.runtime_scores.snapshot().await - } - /// Returns a cloned handle to the runtime scores. /// /// Used internally by the bench engine to update scores directly. diff --git a/src/features/mcp/mod.rs b/src/features/mcp/mod.rs index 3a5eda72..6f7d2342 100644 --- a/src/features/mcp/mod.rs +++ b/src/features/mcp/mod.rs @@ -63,11 +63,6 @@ impl McpState { self.scorer.read().await } - /// Returns a write-locked reference to the scorer. - pub async fn write_scorer(&self) -> tokio::sync::RwLockWriteGuard<'_, ToolScorer> { - self.scorer.write().await - } - /// Returns a handle to the runtime scores for the bench engine. pub(crate) fn matrix_handle(&self) -> matrix::RuntimeScores { self.matrix.scores_handle() diff --git a/src/features/tool_layer/catalog.rs b/src/features/tool_layer/catalog.rs index 62c66399..d8955075 100644 --- a/src/features/tool_layer/catalog.rs +++ b/src/features/tool_layer/catalog.rs @@ -42,11 +42,6 @@ pub fn lookup(name: &str) -> Option<&'static CatalogEntry> { CATALOG.get(name) } -/// Returns all canonical tool names in the catalog. -pub fn all_names() -> impl Iterator { - CATALOG.keys().map(String::as_str) -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/pid.rs b/src/pid.rs index 954c8991..0de9a2b0 100644 --- a/src/pid.rs +++ b/src/pid.rs @@ -24,23 +24,6 @@ pub fn write_pid() -> io::Result<()> { Ok(()) } -/// Atomically write PID file (write to .tmp then rename). -/// Prevents partial reads during hot restarts. -pub fn write_pid_atomic() -> io::Result<()> { - let pid_file = pid_file_path(); - - if let Some(parent) = pid_file.parent() { - fs::create_dir_all(parent)?; - } - - let tmp_file = pid_file.with_extension("pid.tmp"); - let pid = std::process::id(); - fs::write(&tmp_file, pid.to_string())?; - fs::rename(&tmp_file, &pid_file)?; - tracing::info!("PID {} written atomically to {:?}", pid, pid_file); - Ok(()) -} - /// Read the PID from the PID file pub fn read_pid() -> io::Result { let pid_file = pid_file_path();