diff --git a/crates/aura-cli/src/main.rs b/crates/aura-cli/src/main.rs index 361d347..7c5971b 100644 --- a/crates/aura-cli/src/main.rs +++ b/crates/aura-cli/src/main.rs @@ -112,6 +112,21 @@ fn sample_harness() -> ( (h, rx_eq, rx_ex) } +/// Build the sim-optimal `RunManifest`: the engine-external descriptor fields +/// (commit, seed-free synthetic run, broker label) are constant across the CLI's +/// built-in harnesses — only `params` and `window` vary. Centralizing the broker +/// label keeps it a single source (and a single edit point for #22's per-asset +/// pip work). +fn sim_optimal_manifest(params: Vec<(String, f64)>, window: (Timestamp, Timestamp)) -> RunManifest { + RunManifest { + commit: option_env!("AURA_COMMIT").unwrap_or("unknown").to_string(), + params, + window, + seed: 0, + broker: "sim-optimal(pip_size=0.0001)".to_string(), + } +} + /// Run the sample harness and fold it into a `RunReport` (drain both sinks → /// `f64_field` → `summarize` → pair with a `RunManifest`). Pure and deterministic /// (C1): the same build yields the same report. @@ -131,17 +146,14 @@ fn run_sample() -> RunReport { let metrics = summarize(&equity, &exposure); RunReport { - manifest: RunManifest { - commit: option_env!("AURA_COMMIT").unwrap_or("unknown").to_string(), - params: vec![ + manifest: sim_optimal_manifest( + vec![ ("sma_fast".to_string(), 2.0), ("sma_slow".to_string(), 4.0), ("exposure_scale".to_string(), 0.5), ], window, - seed: 0, - broker: "sim-optimal(pip_size=0.0001)".to_string(), - }, + ), metrics, } } @@ -277,13 +289,7 @@ fn sweep_family() -> SweepFamily { .map(|(ps, v)| (ps.name.clone(), scalar_as_param_f64(v))) .collect(); RunReport { - manifest: RunManifest { - commit: option_env!("AURA_COMMIT").unwrap_or("unknown").to_string(), - params, - window, - seed: 0, - broker: "sim-optimal(pip_size=0.0001)".to_string(), - }, + manifest: sim_optimal_manifest(params, window), metrics: summarize(&equity, &exposure), } }) @@ -462,18 +468,15 @@ fn run_macd() -> RunReport { let metrics = summarize(&equity, &exposure); RunReport { - manifest: RunManifest { - commit: option_env!("AURA_COMMIT").unwrap_or("unknown").to_string(), - params: vec![ + manifest: sim_optimal_manifest( + vec![ ("ema_fast".to_string(), 2.0), ("ema_slow".to_string(), 4.0), ("ema_signal".to_string(), 3.0), ("exposure_scale".to_string(), 0.5), ], window, - seed: 0, - broker: "sim-optimal(pip_size=0.0001)".to_string(), - }, + ), metrics, } }