refactor: unify ModelType into common/model_types.rs

Consolidate 4 separate ModelType enum definitions (ml 15 variants,
model_loader 7, campaign 2, job_spawner 4) into a single canonical
definition in common/src/model_types.rs with the union of all variants
and all methods (file_extension, as_str, to_db_string, weight, from_str,
Display).

- ml/src/lib.rs: replace 15-variant enum with re-export
- model_loader/src/lib.rs: replace 7-variant enum with re-export,
  update PascalCase names (Dqn->DQN, Tft->TFT, etc)
- ml/hyperopt/campaign.rs: replace 2-variant enum with re-export
- services/ml_training_service/job_spawner.rs: replace 4-variant enum
  with re-export, MAMBA2->MAMBA
- Remove orphan impl ToString in ml/observability/metrics.rs (Display
  now provided by canonical type)
- Update backtesting_service and model_loader tests for new names

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-02-22 21:33:45 +01:00
parent 36a560ccb3
commit fd1b60bbf5
8 changed files with 246 additions and 146 deletions

View File

@@ -17,8 +17,8 @@ use std::time::SystemTime;
use storage::{ObjectStoreBackend, Storage};
use tracing::{debug, info, warn};
// Re-export canonical ModelType from ml crate (single source of truth)
pub use ml::ModelType;
// Re-export canonical ModelType from common crate
pub use common::model_types::ModelType;
/// Model metadata for version tracking
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -373,10 +373,17 @@ mod tests {
use super::*;
#[test]
<<<<<<< HEAD
fn test_model_type_s3_prefix() {
assert_eq!(ModelType::TLOB.s3_prefix(), "tlob_transformer");
assert_eq!(ModelType::DQN.s3_prefix(), "dqn");
assert_eq!(ModelType::MAMBA.s3_prefix(), "mamba2");
=======
fn test_model_type_as_str() {
assert_eq!(ModelType::TLOB.as_str(), "tlob_transformer");
assert_eq!(ModelType::DQN.as_str(), "dqn");
assert_eq!(ModelType::MAMBA.as_str(), "mamba2");
>>>>>>> dd4532a3 (refactor: unify ModelType into common/model_types.rs)
}
#[test]