cleanup(ml): remove 31 disabled imports and commented-out module blocks

Removes dead code across 28 files:
- 31 commented-out "DISABLED" import lines (mostly safe_operations, error_handling)
- Commented-out module declarations in lib.rs (deployment, model_loader_integration, tests)
- Commented-out re-exports in lib.rs (training_pipeline, deployment::ModelVersion)
- Commented-out adaptive strategy modules in regime/mod.rs

All are in git history if ever needed. Net -74 lines removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-02-20 18:23:41 +01:00
parent 533459570b
commit bdf5b690b7
28 changed files with 3 additions and 80 deletions

View File

@@ -20,7 +20,6 @@ mod tests {
use super::*;
use std::collections::HashMap;
use crate::ensemble::{ModelSignal, SignalMetadata};
// use crate::safe_operations; // DISABLED - module not found
fn create_test_signal(
model_id: &str,

View File

@@ -12,9 +12,7 @@ use serde::{Deserialize, Serialize};
use super::aggregator::ModelSignal;
use crate::{HealthStatus, MLError};
// use crate::regime_detection::MarketRegime;
use super::*;
// CIRCULAR DEPENDENCY FIX: Use MarketRegime from core types
use common::trading::MarketRegime;
/// Configuration for ensemble models
@@ -395,7 +393,6 @@ fn current_timestamp() -> u64 {
#[cfg(test)]
mod tests {
use super::*;
// use crate::safe_operations; // DISABLED - module not found
fn create_test_ensemble() -> EnsembleModel {
let config = EnsembleConfig::default();

View File

@@ -91,7 +91,6 @@ pub struct VotingResult {
mod tests {
use super::*;
use std::collections::HashMap;
// use crate::safe_operations; // DISABLED - module not found
fn create_test_signals() -> Vec<ModelSignal> {
vec![

View File

@@ -8,7 +8,6 @@ use std::collections::HashMap;
// CIRCULAR DEPENDENCY FIX: Use MarketRegime from core types
use crate::MLError;
// use crate::regime_detection::MarketRegime;
use super::*;
#[derive(Debug, Clone)]
@@ -143,7 +142,6 @@ pub fn calculate_entropy(weights: &HashMap<String, f64>) -> f64 {
mod tests {
use super::*;
use std::collections::HashMap;
// use crate::safe_operations; // DISABLED - module not found
#[test]
fn test_model_weights_initialization() {

View File

@@ -19,7 +19,6 @@ use crate::liquid::training::{ActivationType, LiquidTrainer, LiquidTrainingConfi
mod tests {
use super::*;
use crate::training::{TrainingConfig, TrainingPipeline};
// use crate::safe_operations; // DISABLED - module not found
#[tokio::test]
async fn test_gpu_infrastructure_initialization() {

View File

@@ -25,11 +25,7 @@ use common::types::{Price, Symbol};
use tracing::{error, info, warn};
use uuid::Uuid;
// use error_handling::{AppResult, TradingError}; // Commented out - crate doesn't exist
use crate::bridge::MLFinancialBridge;
// REMOVED: UnifiedFinancialFeatures does not exist in ml::features
// use crate::features::UnifiedFinancialFeatures;
use crate::memory_optimization::quantization::{QuantizationConfig, QuantizationType, Quantizer};
use crate::safety::{MLSafetyError, MLSafetyManager, SafetyResult};

View File

@@ -16,7 +16,6 @@ use tracing::{debug, info, warn};
use super::{IntegrationHubConfig, ServingMode};
use crate::{InferenceResult, MLError, ModelMetadata, ModelType};
// use crate::safe_operations; // DISABLED - module not found
/// Configuration for ensemble coordination
#[derive(Debug, Clone, Serialize, Deserialize)]

View File

@@ -3,8 +3,6 @@
//! Implements knowledge distillation to create ultra-fast micro models
//! from complex ensemble models, enabling sub-100μs inference.
// use crate::safe_operations; // DISABLED - module not found
// Implementation ready
// This is a production file for knowledge distillation

View File

@@ -7,8 +7,6 @@ use std::collections::HashMap;
use std::sync::Arc;
use std::time::{Instant, SystemTime, UNIX_EPOCH};
// ONNX Runtime removed - keeping interface for compatibility
// use ort::{Environment, GraphOptimizationLevel, SessionBuilder};
use serde::{Deserialize, Serialize};
use tokio::sync::RwLock;
use tracing::{info, warn};
@@ -23,8 +21,6 @@ pub struct Session;
use super::{InferencePriority, IntegrationHubConfig};
use crate::{InferenceResult, MLError, ModelMetadata, ModelType};
// use crate::safe_operations; // DISABLED - module not found
/// Configuration for fallback prediction to eliminate dangerous hardcoded values
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FallbackPredictionConfig {

View File

@@ -12,7 +12,6 @@ use tokio::sync::RwLock;
use super::*;
use crate::MLError;
// use crate::safe_operations; // DISABLED - module not found
// Re-export integration submodules
pub mod coordinator;

View File

@@ -10,7 +10,6 @@ use super::{ModelDeployment, ModelSearchCriteria, ModelState, ModelStatus};
#[cfg(test)]
use super::{ModelType, ServingMode};
use crate::MLError;
// use crate::safe_operations; // DISABLED - module not found
/// Model Registry for managing ML model deployments
#[derive(Debug)]

View File

@@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize};
use tokio::sync::RwLock; // Use local AlertSeverity with Warning variant
use super::IntegrationHubConfig;
// use crate::safe_operations; // DISABLED - module not found
/// Performance sample for monitoring
#[derive(Debug, Clone, Serialize, Deserialize)]

View File

@@ -13,7 +13,6 @@ use tokio::sync::RwLock;
use crate::dqn::agent::{DQNAgent, DQNConfig};
use crate::dqn::{Experience, TradingState};
use crate::MLError;
// use crate::safe_operations; // DISABLED - module not found
/// Strategy feature input for `DQN` bridge
#[derive(Debug, Clone, Serialize, Deserialize)]

View File

@@ -1052,15 +1052,8 @@ pub mod metrics; // Performance metrics (Sharpe ratio, etc.)
pub mod training;
// ========== MODEL DEPLOYMENT AND FACTORY ==========
// TEMPORARILY DISABLED: deployment module has 250+ compilation errors
// Needs proper implementation of missing types (ModelSwapEngine, ABTestManager, etc.)
// #[cfg(feature = "deployment")]
// pub mod deployment;
pub mod model_factory;
// Re-export commonly used deployment types at root
// pub use deployment::versioning::ModelVersion;
// ========== CORE EXPORTS ==========
// Core exports
pub mod error;
@@ -1081,12 +1074,7 @@ pub mod portfolio_transformer; // Portfolio-specific transformer
pub mod regime; // Wave D: Structural breaks and regime classification
pub mod regime_detection; // Market regime detection
pub mod tensor_ops;
// TLOB transformer implementation moved to tlob module
pub mod examples;
// Removed examples_stubs module - contained only placeholder implementations
// DISABLED: model_loader_integration requires external model_loader crate that doesn't exist
// Production deployment requires implementing proper model loading infrastructure
// pub mod model_loader_integration;
pub mod models_demo;
pub mod observability;
pub mod qat_metrics_exporter; // QAT Prometheus metrics export
@@ -1094,18 +1082,10 @@ pub mod stress_testing; // Stress testing framework
pub mod training_pipeline; // Complete training pipeline system
pub mod traits; // Common traits for ML models // Production observability and monitoring // Integration with model_loader crate
// ML Readiness Validation modules (Wave 152+)
pub mod real_data_loader; // Load real DBN data and extract ML features
// TEMPORARILY DISABLED for compilation: pub mod inference_validator; // Validate model inference pipelines
pub mod real_data_loader;
pub mod data_validation;
pub mod random_model; // Random baseline model for testing // Automated data quality validation (Wave 160+)
// Model versioning and registry (Wave 152 - Agent 47)
pub mod model_registry; // Model versioning with PostgreSQL storage
// Temporarily disabled due to compilation errors
// #[cfg(test)]
// pub mod tests; // Test modules
pub mod random_model;
pub mod model_registry;
// ========== MISSING TYPES STUBS ==========
@@ -2262,16 +2242,6 @@ impl ModelType {
}
}
// TEMPORARILY COMMENTED OUT - These modules need to be checked for availability
// Re-export training pipeline system (from existing training_pipeline module)
// pub use training_pipeline::{
// ProductionMLTrainingSystem, ProductionTrainingConfig, ProductionTrainingMetrics,
// FinancialFeatures, MicrostructureFeatures, RiskFeatures, TrainingResult,
// };
// Note: All types in this module are already public and available
// External crates can import them directly as: use ml::{Features, ModelPrediction, etc.}
/// Prelude module for convenient imports of commonly used ML types
///
/// This module re-exports the most commonly used types and traits from the ML crate
@@ -2305,10 +2275,6 @@ pub mod prelude {
// Constants
pub use crate::{MAX_INFERENCE_LATENCY_US, PRECISION_FACTOR};
// Deployment types
// DISABLED until deployment module is fixed
// pub use crate::deployment::versioning::ModelVersion;
// Tensor types from candle
pub use candle_core::{Device, Tensor};
pub use candle_nn::{Module, VarBuilder, VarMap};

View File

@@ -6,7 +6,6 @@
use std::error::Error;
use std::fmt;
// use error_handling::{AppResult, ErrorSeverity, FoxhuntError}; // TODO: Re-enable when error_handling crate is available
use serde::{Deserialize, Serialize};
// Import MarketRegime from core types to avoid type conflicts

View File

@@ -31,7 +31,6 @@ use std::arch::x86_64::*;
#[cfg(target_arch = "aarch64")]
use std::arch::aarch64::*;
// use crate::safe_operations; // DISABLED - module not found
/// Hardware capability detection
#[derive(Debug, Clone)]

View File

@@ -66,7 +66,6 @@ use uuid::Uuid;
use crate::cuda_compat::layer_norm_with_fallback;
use crate::MLError;
// use crate::safe_operations; // DISABLED - module not found
/// Optimizer type for training
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]

View File

@@ -25,7 +25,6 @@ use tracing::{debug, instrument};
use super::{Mamba2Config, Mamba2State};
use crate::MLError;
// use crate::safe_operations; // DISABLED - module not found
/// Configuration for selective state space mechanism
#[derive(Debug, Clone)]

View File

@@ -25,7 +25,6 @@ use tracing::instrument;
use super::{Mamba2Config, Mamba2State};
use crate::MLError;
// use crate::safe_operations; // DISABLED - module not found
/// Structured State Duality (SSD) Layer implementation
#[derive(Debug)]

View File

@@ -23,8 +23,3 @@ pub mod volatile;
// Wave D: Transition Probability Features (Agent D15)
pub mod transition_probability_features;
// Wave D: Adaptive Strategies (Agents D9-D12)
// pub mod position_sizer;
// pub mod dynamic_stops;
// pub mod performance_tracker;
// pub mod ensemble;

View File

@@ -754,7 +754,6 @@ impl MultiHeadGating {
mod tests {
use super::*;
use ndarray::array;
// use crate::safe_operations; // DISABLED - module not found
#[test]
fn test_gating_mechanism() -> Result<(), Box<dyn std::error::Error>> {

View File

@@ -383,7 +383,6 @@ impl MarketGraph {
mod tests {
use super::*;
use crate::tgnn::EdgeType;
// use crate::safe_operations; // DISABLED - module not found
#[test]
fn test_graph_creation() -> Result<(), MLError> {

View File

@@ -981,7 +981,6 @@ impl GATMessagePassing {
// mod tests {
// use super::*;
// use ndarray::array;
// // use crate::safe_operations; // DISABLED - module not found
//
// #[test]
// fn test_message_passing_layer() -> Result<(), Box<dyn std::error::Error>> {

View File

@@ -1126,7 +1126,6 @@ impl TGGNTrainingPipeline {
#[cfg(test)]
mod tests {
use super::*;
// use crate::safe_operations; // DISABLED - module not found
#[tokio::test]
async fn test_tggn_creation() -> Result<(), MLError> {

View File

@@ -294,7 +294,6 @@ impl BreakdownDetector {
// // #[cfg(test)]
// mod tests {
// use super::*;
// // use crate::safe_operations; // DISABLED - module not found
//
// #[test]
// fn test_correlation_analysis_engine_creation() {

View File

@@ -4,14 +4,12 @@
//! Uses multiple metrics including bid-ask spreads, market impact, and volume patterns.
// Price imported from crate root (lib.rs)
// use error_handling::AppResult; // Commented out - crate doesn't exist
// DISABLED: Tests require LiquidityScorer, Price, Volume types not exported from ml crate
// #[cfg(test)]
// mod tests {
// use super::*;
// use serde::{Serialize, Deserialize};
// // use crate::safe_operations; // DISABLED - module not found
//
// #[test]
// fn test_liquidity_scoring() {

View File

@@ -4,14 +4,12 @@
//! Implements multi-timeframe momentum scoring, cross-sectional ranking, and momentum regime detection.
// Price imported from crate root (lib.rs)
// use error_handling::AppResult; // Commented out - crate doesn't exist
// DISABLED: Tests require MomentumRanker, Price, Volume, Utc, Duration types not available
// #[cfg(test)]
// mod tests {
// use super::*;
// use serde::{Serialize, Deserialize};
// // use crate::safe_operations; // DISABLED - module not found
//
// #[test]
// fn test_momentum_scoring() {

View File

@@ -10,7 +10,6 @@ use serde::{Deserialize, Serialize};
use super::*;
use crate::{MLError, PRECISION_FACTOR};
// use crate::safe_operations; // DISABLED - module not found
/// Volatility regime classification
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]