From 5b9995c6f5ff75719e4d9062ac92d171ccdb808a Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Fri, 1 May 2026 01:37:49 +0200 Subject: [PATCH] chore(services): drop unused declared deps (cargo-machete cleanup) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove dependencies declared in 5 service Cargo.toml files that no source code in those services references (verified by grepping for use statements). Reduces dep-graph fan-out and unnecessary recompiles. services/api/Cargo.toml −16 deps (async-trait, bytes, const-oid, hdrhistogram, hex, http-body, hyper, hyper-util, num-traits, rust_decimal, tokio-stream, tower-layer, tower-service, tracing-subscriber, trading_engine, zeroize. + json feature added to reqwest since trading_engine was enabling it transitively) services/trading_service/Cargo.toml −11 deps services/backtesting_service/Cargo.toml −17 deps services/trading_agent_service/Cargo.toml −6 deps services/ml_training_service/Cargo.toml −4 deps False positives kept (cargo-machete misses these because they're only referenced in tonic-generated proto code, not in hand-written src): - prost (`::prost::Message` derive in build.rs-generated code) - tonic-prost (`tonic_prost::ProstCodec::default()` in generated tonic clients/servers) cargo check --workspace passes. Co-Authored-By: Claude Opus 4.7 (1M context) --- services/backtesting_service/Cargo.toml | 19 +------------------ services/ml_training_service/Cargo.toml | 5 +---- services/trading_agent_service/Cargo.toml | 7 +------ services/trading_service/Cargo.toml | 15 ++------------- 4 files changed, 5 insertions(+), 41 deletions(-) diff --git a/services/backtesting_service/Cargo.toml b/services/backtesting_service/Cargo.toml index 0a885db60..4a20d9e09 100644 --- a/services/backtesting_service/Cargo.toml +++ b/services/backtesting_service/Cargo.toml @@ -25,18 +25,16 @@ tokio.workspace = true serde.workspace = true serde_json.workspace = true anyhow.workspace = true -thiserror.workspace = true tracing.workspace = true tracing-subscriber.workspace = true uuid.workspace = true chrono.workspace = true -num_cpus.workspace = true rand.workspace = true rust_decimal.workspace = true -semver.workspace = true num-traits.workspace = true # gRPC - USE WORKSPACE +# NOTE: tonic-prost & prost used by generated proto code (ProstCodec, ::prost::Message) tonic.workspace = true tonic-prost.workspace = true prost.workspace = true @@ -51,27 +49,18 @@ once_cell.workspace = true # Database - USE WORKSPACE sqlx.workspace = true -influxdb2.workspace = true # Configuration - USE WORKSPACE config.workspace = true -dotenvy.workspace = true # Async and parallel processing - USE WORKSPACE tokio-util.workspace = true tokio-stream.workspace = true -async-stream.workspace = true async-trait.workspace = true -rayon.workspace = true -crossbeam.workspace = true -dashmap.workspace = true # Cryptography and security for TLS/mTLS -x509-parser = "0.16" reqwest = { version = "0.12", features = ["rustls-tls"], default-features = false } rustls = { version = "0.23", features = ["ring"], default-features = false } # Wave 75: TLS crypto provider -base64.workspace = true -sha2.workspace = true # DBN (Databento Binary) support for market data replay dbn = "0.42.0" @@ -80,15 +69,9 @@ dbn = "0.42.0" clap = { version = "4.5", features = ["derive"] } # Internal workspace crates -trading_engine.workspace = true -risk.workspace = true ml = { workspace = true, features = ["financial"] } # Minimal ML for backtesting data.workspace = true common = { workspace = true, features = ["database"] } -storage.workspace = true -model_loader = { path = "../../crates/model_loader" } # Real model loading with S3 and caching -# Model functionality from ml-data -ml-data = { path = "../../crates/ml-data" } [dev-dependencies] tokio-test.workspace = true diff --git a/services/ml_training_service/Cargo.toml b/services/ml_training_service/Cargo.toml index 10087613b..684fd9c16 100644 --- a/services/ml_training_service/Cargo.toml +++ b/services/ml_training_service/Cargo.toml @@ -21,12 +21,12 @@ clap.workspace = true rust_decimal.workspace = true # gRPC and protocol buffers - USE WORKSPACE +# NOTE: tonic-prost & prost used by generated proto code (ProstCodec, ::prost::Message) tonic.workspace = true tonic-prost.workspace = true tonic-health.workspace = true tonic-reflection.workspace = true prost.workspace = true -prost-types.workspace = true # Database and compression - USE WORKSPACE sqlx.workspace = true @@ -38,13 +38,10 @@ tokio-util.workspace = true async-stream.workspace = true futures.workspace = true async-trait.workspace = true -tokio-retry.workspace = true # Logging, tracing and metrics - USE WORKSPACE tracing.workspace = true tracing-subscriber.workspace = true -metrics.workspace = true -metrics-exporter-prometheus.workspace = true prometheus.workspace = true once_cell.workspace = true diff --git a/services/trading_agent_service/Cargo.toml b/services/trading_agent_service/Cargo.toml index a7416a22e..e89b39c92 100644 --- a/services/trading_agent_service/Cargo.toml +++ b/services/trading_agent_service/Cargo.toml @@ -16,18 +16,16 @@ path = "src/main.rs" tokio.workspace = true anyhow.workspace = true tracing.workspace = true -tracing-subscriber.workspace = true serde.workspace = true serde_json.workspace = true once_cell.workspace = true # gRPC and networking +# NOTE: tonic-prost & prost used by generated proto code (ProstCodec, ::prost::Message) tonic = { workspace = true, features = ["transport", "server", "tls-ring", "tls-webpki-roots"] } tonic-prost.workspace = true -tonic-reflection.workspace = true tonic-health.workspace = true prost.workspace = true -tower.workspace = true hyper.workspace = true http-body-util.workspace = true hyper-util.workspace = true @@ -35,9 +33,7 @@ bytes.workspace = true # Async streams and futures tokio-stream.workspace = true -async-stream.workspace = true futures.workspace = true -async-trait.workspace = true # Performance monitoring prometheus.workspace = true @@ -63,7 +59,6 @@ thiserror.workspace = true rust_decimal = { workspace = true, features = ["serde"] } rust_decimal_macros.workspace = true nalgebra.workspace = true -num-traits.workspace = true [build-dependencies] tonic-prost-build.workspace = true diff --git a/services/trading_service/Cargo.toml b/services/trading_service/Cargo.toml index f2bfdd743..c472ad801 100644 --- a/services/trading_service/Cargo.toml +++ b/services/trading_service/Cargo.toml @@ -28,15 +28,13 @@ clap.workspace = true # gRPC and networking - USE WORKSPACE # NOTE: Tonic 0.14 uses 'tls-ring' instead of 'tls' -# NOTE: Tonic 0.14 requires tonic-prost for generated code runtime +# NOTE: Tonic 0.14 requires tonic-prost for generated code runtime (codec::ProstCodec) +# NOTE: prost is used by generated proto code via ::prost::Message derive tonic = { workspace = true, features = ["transport", "server", "tls-ring", "tls-webpki-roots"] } tonic-prost.workspace = true -tonic-reflection.workspace = true tonic-health.workspace = true prost.workspace = true tower.workspace = true -tower-layer.workspace = true -tower-service.workspace = true hyper.workspace = true http-body.workspace = true http-body-util.workspace = true @@ -45,11 +43,9 @@ bytes.workspace = true # Async streams and futures - USE WORKSPACE tokio-stream.workspace = true -async-stream.workspace = true futures.workspace = true futures-util = "0.3" async-trait.workspace = true -url = "2.5" fastrand.workspace = true tokio-tungstenite.workspace = true @@ -68,7 +64,6 @@ chrono.workspace = true thiserror.workspace = true secrecy.workspace = true # Secure secret handling (still needed for other modules) -zeroize.workspace = true # Secure memory zeroing (still needed for other modules) uuid.workspace = true sqlx = { workspace = true, features = ["postgres", "chrono", "uuid", "json", "macros"] } redis = { workspace = true, features = ["tokio-comp", "connection-manager"] } @@ -79,7 +74,6 @@ num-traits.workspace = true rust_decimal.workspace = true rand.workspace = true sysinfo = "0.33" -log.workspace = true dbn.workspace = true # DBN market data for E2E testing # Internal workspace crates @@ -88,12 +82,7 @@ risk.workspace = true ml = { workspace = true, features = ["financial"] } # Minimal ML for inference only data.workspace = true common = { workspace = true, features = ["database"] } -storage = { workspace = true } config = { workspace = true, features = ["postgres"] } -database = { path = "../../crates/database" } -# Model functionality from storage and ml-data crates -ml-data = { path = "../../crates/ml-data" } -semver.workspace = true [build-dependencies] # NOTE: Tonic 0.14+ uses tonic-prost-build instead of tonic-build