//! Production-config smoke test.
//!
//! Single test with the full production Rainbow DQN stack:
//! branching + IQN + curiosity + CQL + Kelly + action masking +
//! circuit breaker + n-step + noisy nets + PER + dueling.
//! Real ES.FUT data, GPU-only.
use super::helpers::{assert_finite, smoke_trainer, test_data_dir};

/// Full production DQN config on real ES.FUT data — 3 epochs.
///
/// All features are always on in production. There is no code path
/// without curiosity, IQN, branching, etc. This single test validates
/// the entire fused CUDA training pipeline end-to-end.
#[test]
#[ignore] // Loads real training data — run via nightly CI or manual trigger
fn test_production_config_trains() -> anyhow::Result<()> {
    let data_dir = test_data_dir()
        .expect("FOXHUNT_TEST_DATA or test_data/ must exist — no synthetic fallback");
    let mut trainer = smoke_trainer()?;
    let rt = tokio::runtime::Builder::new_current_thread()
        .enable_all()
        .build()?;
    let metrics = rt.block_on(trainer.train(&data_dir, |_epoch, _bytes, _best| {
        Ok("skip".to_owned())
    }))?;
    assert_finite(metrics.loss, "production_loss");
    assert!(metrics.loss >= 0.0, "loss should be non-negative");
    assert!(
        metrics.epochs_trained >= 1,
        "expected at least 1 epoch, got {}",
        metrics.epochs_trained,
    );
    drop(trainer);
    drop(rt);
    Ok(())
}
