//! SP15 Phase 2B Group 1 — mean-revert market should reverse direction at ±2σ within 5 bars.
//! Anchor for: Phase 1+3.

use crate::synthetic_markets::ou_market;
use crate::harness::{evaluate_policy_on_market, BehavioralResult};

#[test]
#[ignore = "Phase 2B contract — green when Phase 1+3 land + harness exposes per-bar actions"]
fn test_2_3_mean_revert_reverses() {
    let mu: f32 = 4500.0;
    let sigma: f32 = 1.0;
    let bars = ou_market(10_000, 0.05, sigma, mu, 0.25, 42);
    let mut trainer = ();
    let _result: BehavioralResult = evaluate_policy_on_market(&mut trainer, &bars[5_000..], 0);

    // The full assertion requires per-bar action access from BehavioralResult,
    // which the Phase 2A harness stub does not yet expose. Phase 2B.b will
    // extend BehavioralResult with `actions: Vec<ActionEnum>`. Until then,
    // this test serves as the contract specification.
    //
    // Once per-bar actions are exposed:
    //   for (i, bar) in bars.iter().enumerate() {
    //       let z = (bar.price - mu) / sigma;
    //       if z.abs() > 2.0 {
    //           let next_5 = &result.actions[i+1..(i+6).min(result.actions.len())];
    //           let expected_dir = if z > 0.0 { /* Short */ } else { /* Long */ };
    //           assert!(next_5.iter().any(|a| matches_direction(a, expected_dir)),
    //               "no reverse at z={:.2}", z);
    //       }
    //   }
    // For now the test compiles + runs (no-op past the smoke).
}
