//! Axis 4 — project loading + bit-identical reproduction (C18/C1) as a library //! consumer. Opens the default `Env`, discovers a persisted family in the run //! registry (written by the sb_2_campaign fixture), inspects it via `load_family`, //! and re-derives it via `reproduce_family`. Also probes `reproduce_family_in`, //! the only variant that returns a programmatic `ReproduceReport`. No `aura` //! binary; library crates only. //! //! Usage: `… --bin sb_4_reproduce []` //! (omit the id to auto-pick the first family the registry holds). use aura_ingest::default_data_server; use aura_runner::family::DataSource; use aura_runner::reproduce::{load_family, reproduce_family, reproduce_family_in}; use aura_runner::Env; const SYMBOL: &str = "GER40"; const FROM_MS: i64 = 1_725_148_800_000; const TO_MS: i64 = 1_727_740_800_000; fn main() { let env = Env::std(); let reg = env.registry(); println!("runs root: {}", env.runs_root().display()); // Discover a persisted family id (or take one from argv). let arg_id = std::env::args().nth(1); let family_id = match arg_id { Some(id) => id, None => { let members = match reg.load_family_members() { Ok(m) => m, Err(e) => { println!("could not read registry: {e:?}"); return; } }; match members.first() { Some(rec) => rec.family.clone(), None => { println!("no persisted families — run the sb_2_campaign fixture first."); return; } } } }; println!("reproducing family: {family_id}"); // 1. Inspect the persisted family programmatically. match load_family(®, &family_id) { Ok(fam) => println!(" load_family OK: kind={:?} members={}", fam.kind, fam.members.len()), Err(e) => println!(" load_family failed: exit={} msg={}", e.exit_code, e.message), } // 2. The ergonomic path: reproduce_family(id, env) -> Result<(), RunnerError>. // Auto-derives the data source from the stored manifest. println!(" --- reproduce_family(id, env) ---"); match reproduce_family(&family_id, &env) { Ok(()) => println!(" reproduce_family returned Ok(()) — bit-identical (no per-member detail returned)."), Err(e) => println!(" reproduce_family failed: exit={} msg={}", e.exit_code, e.message), } // 3. The only variant that returns a ReproduceReport: reproduce_family_in, // which forces the consumer to re-specify the DataSource (symbol/window/pip) // that the family manifest already records. pip re-specified by hand here. println!(" --- reproduce_family_in(reg, id, data, env) -> ReproduceReport ---"); let data = DataSource::Real { server: default_data_server(), symbol: SYMBOL.to_string(), from_ms: Some(FROM_MS), to_ms: Some(TO_MS), pip: 1.0, }; match reproduce_family_in(®, &family_id, &data, &env) { Ok(report) => { let n = report.outcomes.len(); let identical = report.outcomes.iter().filter(|(_, ok)| *ok).count(); println!(" ReproduceReport: {identical}/{n} members bit-identical"); for (member, ok) in &report.outcomes { println!(" {} {member}", if *ok { "IDENTICAL" } else { "DIVERGED " }); } } Err(e) => println!(" reproduce_family_in failed: exit={} msg={}", e.exit_code, e.message), } }