Files
foxhunt/crates/ml-backtesting/tests/checkpoint_smoke.rs
jgrusewski 87b8303950 chore(ml-alpha): drop 'v2' naming — greenfield, no backward compat
Per project_ml_alpha_starting_capital greenfield posture: there is no V1
to differentiate from (the V1 trunk forward was dead code, no V1
checkpoint files exist in the wild). The 'v2' prefix on every identifier
was historical baggage from the migration period.

Renames:
- CheckpointV2 -> Checkpoint (also drops the version: u32 field —
  bincode either deserialises a current envelope or errors; no migration
  path needed)
- CheckpointVersionProbe removed (was only for V1 rejection)
- LAYER_NORM_CUBIN_V2 / VARIABLE_SELECTION_CUBIN_V2 / ATTENTION_POOL_CUBIN_V2
  -> LAYER_NORM_CUBIN / VARIABLE_SELECTION_CUBIN / ATTENTION_POOL_CUBIN
- _ln_module_v2 / _vsn_module_v2 / _attn_module_v2 -> drop _v2 suffix
- smoke_load_v2_checkpoint test -> smoke_load_checkpoint
- config/ml/sweep_v2_*.yaml -> config/ml/sweep_*.yaml
- migration-era 'V2 weight skeleton' / 'V2 fields' / etc. comments
  cleaned to remove the v2 prefix

Pre-existing 'v2' references in ml-backtesting CUDA files
(decision_policy.cu, pnl_track.cu) are NOT touched — those refer to
future planned 'v2' refinements (Portfolio mode, multi-fill averaging)
from the C1-C19 commits and reflect aspirational features unrelated to
this session's trunk-grows work.

Verification: ml-alpha + ml-backtesting + fxt-backtest all build clean.
perception_forward_golden bit-exact (max_diff = 0.000000).
2026-05-19 08:58:28 +02:00

58 lines
2.1 KiB
Rust

//! GPU integration smoke: load a real Checkpoint file, drive the
//! BacktestHarness for one cell at the realistic anchor, assert spec
//! §3.4 smoke criteria.
//!
//! Marked `#[ignore]`; activated via env vars:
//!
//! FOXHUNT_SMOKE_CKPT=/feature-cache/alpha-perception-runs/<sha>/trunk_best_h6000.bin \
//! FOXHUNT_SMOKE_MBP10=/data/futures-baseline-mbp10/ES.FUT \
//! cargo test -p ml-backtesting --test checkpoint_smoke \
//! -- --ignored --nocapture
//!
//! Compile-only check: `cargo test --no-run` validates the test signature
//! against the harness/trunk API without invoking GPU.
use std::path::PathBuf;
use anyhow::{Context, Result};
use ml_alpha::cfc::trunk::{CfcConfig, CfcTrunk};
use ml_backtesting::artifacts::Summary;
use ml_core::device::MlDevice;
fn locate_checkpoint() -> Result<PathBuf> {
let p = std::env::var("FOXHUNT_SMOKE_CKPT")
.map(PathBuf::from)
.context("set FOXHUNT_SMOKE_CKPT=<path to trunk_best_h6000.bin>")?;
if !p.exists() {
anyhow::bail!("checkpoint not found at {}", p.display());
}
Ok(p)
}
#[test]
#[ignore = "GPU + real Checkpoint file required; run with --ignored"]
fn smoke_load_checkpoint() -> Result<()> {
// Minimum smoke: verify load_checkpoint accepts a real checkpoint
// file and constructs a usable trunk. The full BacktestHarness
// end-to-end smoke requires the forward path to land in the trunk
// (X11), which is deferred — for now this asserts the producer/
// consumer wire-up itself works.
let ckpt = locate_checkpoint()?;
let dev = MlDevice::cuda(0).context("init MlDevice")?;
let cfg = CfcConfig::default();
let trunk = CfcTrunk::load_checkpoint(&dev, &cfg, &ckpt)
.context("load_checkpoint(Checkpoint)")?;
// Sanity: the loaded trunk owns Mamba2 stacks 1 and 2.
let _ = trunk; // silence unused
Ok(())
}
#[test]
fn summary_max_drawdown_pct_field_present() {
// Compile-time witness that the Summary schema includes the new
// max_drawdown_pct field (X16) — required by the verdict emitter.
let s = Summary::default();
assert_eq!(s.max_drawdown_pct, 0.0);
}