chore: cleanup dead code warnings and apply clippy fixes for v1.1.1

- Add #![allow(dead_code)] to deprecated tool modules (kept for
  backwards compatibility but not exposed in MCP tool list)
- Mark unused functions with #[allow(dead_code)] annotations
- Fix unused variable warnings (prefix with _)
- Apply clippy auto-fixes for redundant closures and derives
- Fix test to account for protocol version negotiation
- Reorganize tools/mod.rs to clarify active vs deprecated tools

Security review: LOW RISK - no critical vulnerabilities found
Dead code review: deprecated tools properly annotated

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sam Valladares 2026-01-27 01:23:27 -06:00
parent bfa91474a6
commit e06dd3d69a
27 changed files with 104 additions and 119 deletions

View file

@ -127,6 +127,7 @@ impl JsonRpcError {
Self::new(ErrorCode::ServerNotInitialized, "Server not initialized")
}
#[allow(dead_code)] // Reserved for future resource handling
pub fn resource_not_found(uri: &str) -> Self {
Self::new(ErrorCode::ResourceNotFound, &format!("Resource not found: {}", uri))
}

View file

@ -619,7 +619,13 @@ mod tests {
#[tokio::test]
async fn test_initialize_returns_server_info() {
let (mut server, _dir) = test_server().await;
let request = make_request("initialize", None);
// Send with current protocol version to get it back
let params = serde_json::json!({
"protocolVersion": MCP_VERSION,
"capabilities": {},
"clientInfo": { "name": "test", "version": "1.0" }
});
let request = make_request("initialize", Some(params));
let response = server.handle_request(request).await.unwrap();
let result = response.result.unwrap();

View file

@ -1,4 +1,5 @@
//! Codebase Tools
#![allow(dead_code)]
//! Codebase Tools (Deprecated - use codebase_unified instead)
//!
//! Remember patterns, decisions, and context about codebases.
//! This is a differentiating feature for AI-assisted development.

View file

@ -1,4 +1,5 @@
//! Consolidation Tool
#![allow(dead_code)]
//! Consolidation Tool (Deprecated)
//!
//! Run memory consolidation cycle with FSRS decay and embedding generation.

View file

@ -1,4 +1,5 @@
//! Context-Dependent Memory Tool
#![allow(dead_code)]
//! Context-Dependent Memory Tool (Deprecated)
//!
//! Retrieval based on encoding context match.
//! Based on Tulving & Thomson's Encoding Specificity Principle (1973).

View file

@ -1,4 +1,5 @@
//! Feedback Tools
#![allow(dead_code)]
//! Feedback Tools (Deprecated - use promote_memory/demote_memory instead)
//!
//! Promote and demote memories based on outcome quality.
//! Implements preference learning for Vestige.

View file

@ -1,4 +1,5 @@
//! Intentions Tools
#![allow(dead_code)]
//! Intentions Tools (Deprecated - use intention_unified instead)
//!
//! Prospective memory tools for setting and checking future intentions.

View file

@ -1,4 +1,5 @@
//! Knowledge Tools
#![allow(dead_code)]
//! Knowledge Tools (Deprecated - use memory_unified instead)
//!
//! Get and delete specific knowledge nodes.

View file

@ -1,4 +1,5 @@
//! Memory States Tool
#![allow(dead_code)]
//! Memory States Tool (Deprecated - use memory_unified instead)
//!
//! Query and manage memory states (Active, Dormant, Silent, Unavailable).
//! Based on accessibility continuum theory.

View file

@ -1,28 +1,42 @@
//! MCP Tools
//!
//! Tool implementations for the Vestige MCP server.
//!
//! The unified tools (codebase_unified, intention_unified, memory_unified, search_unified)
//! are the primary API. The granular tools below are kept for backwards compatibility
//! but are not exposed in the MCP tool list.
pub mod codebase;
pub mod consolidate;
pub mod ingest;
pub mod intentions;
pub mod knowledge;
pub mod recall;
pub mod review;
pub mod search;
pub mod smart_ingest;
pub mod stats;
// Neuroscience-inspired tools
pub mod context;
pub mod memory_states;
pub mod tagging;
// Feedback / preference learning
pub mod feedback;
// Unified tools (consolidate multiple operations into single tools)
// Active unified tools
pub mod codebase_unified;
pub mod ingest;
pub mod intention_unified;
pub mod memory_unified;
pub mod search_unified;
pub mod smart_ingest;
// Deprecated tools - kept for internal backwards compatibility
// These modules are intentionally unused in the public API
#[allow(dead_code)]
pub mod codebase;
#[allow(dead_code)]
pub mod consolidate;
#[allow(dead_code)]
pub mod context;
#[allow(dead_code)]
pub mod feedback;
#[allow(dead_code)]
pub mod intentions;
#[allow(dead_code)]
pub mod knowledge;
#[allow(dead_code)]
pub mod memory_states;
#[allow(dead_code)]
pub mod recall;
#[allow(dead_code)]
pub mod review;
#[allow(dead_code)]
pub mod search;
#[allow(dead_code)]
pub mod stats;
#[allow(dead_code)]
pub mod tagging;

View file

@ -1,4 +1,5 @@
//! Recall Tool
#![allow(dead_code)]
//! Recall Tool (Deprecated - use search_unified instead)
//!
//! Search and retrieve knowledge from memory.

View file

@ -1,4 +1,5 @@
//! Review Tool
#![allow(dead_code)]
//! Review Tool (Deprecated)
//!
//! Mark memories as reviewed using FSRS-6 algorithm.

View file

@ -1,4 +1,5 @@
//! Search Tools
#![allow(dead_code)]
//! Search Tools (Deprecated - use search_unified instead)
//!
//! Semantic and hybrid search implementations.

View file

@ -1,4 +1,5 @@
//! Stats Tools
#![allow(dead_code)]
//! Stats Tools (Deprecated - use memory_unified instead)
//!
//! Memory statistics and health check.

View file

@ -1,4 +1,5 @@
//! Synaptic Tagging Tool
#![allow(dead_code)]
//! Synaptic Tagging Tool (Deprecated)
//!
//! Retroactive importance assignment based on Synaptic Tagging & Capture theory.
//! Frey & Morris (1997), Redondo & Morris (2011).