refactor: cut the engine's backtest-metrics edge via RunReport<M>

C28 phase 2 (Stratification); realizes item 1 of the deferred #147. The
engine's production surface no longer names a backtest-metric type:

- RunReport becomes generic over its metric payload M; sweep/mc/walkforward/
  blueprint thread the parameter (SweepPoint<M>, SweepFamily<M>, WindowRun<M>,
  WalkForwardResult<M>). RunManifest stays concrete and engine-owned (its
  selection: Option<FamilySelection> embeds the foundation-grade analysis type).
- summarize and the MC assembly (McDraw/McFamily/McAggregate/RBootstrap/
  r_bootstrap/monte_carlo) move to aura-backtest - McAggregate::from_draws reads
  RunMetrics fields by name, so generifying it is the phase-6 metric-vocabulary
  abstraction (#147 item 2), still deferred; wholesale relocation is the honest
  cut. The concrete instantiation lives in aura-backtest as
  `type RunReport = aura_engine::RunReport<RunMetrics>` + sibling aliases.
- the statistics kernel (MetricStats/quantile/resample_block/SplitMix64) moves
  to the aura-analysis foundation; the engine re-imports it (inner->foundation,
  legal) and re-exports it so existing consumers stay source-compatible.

Dependency inversion in one commit: aura-engine drops aura-backtest from
[dependencies] (back to dev-deps for its SimBroker/RunMetrics test fixtures);
aura-backtest gains aura-engine. Cycle-free for lib targets - the cycle closes
only through the engine's dev-dep edge, the pattern aura-vocabulary already
uses. aura-backtest reaches the kernel transitively through the engine
re-export, so no aura-backtest -> aura-analysis edge exists (the C28 ladder
permits backtest -> {core, engine} only). run_indexed / SplitMix64::next_f64
widened pub(crate) -> pub for cross-crate use.

Consumers (registry/campaign/cli/composites/ingest/bench) rewired by import
path only, no call-site logic changed. The c28_layering structural test extends
to the full ladder: aura-analysis (no aura-* deps), aura-engine ⊆ {core,
analysis}, aura-backtest ⊆ {core, engine}.

Behaviour-preserving: 1448/0 tests, clippy -D warnings clean, serde shapes
byte-identical (C18 - RunReport<M> keeps field order manifest,metrics; the
CLI pre-serialized-splice contract unchanged), moved code traceable via git
rename detection. Cycle-introduced broken intra-doc links fixed.

closes #292
This commit is contained in:
2026-07-20 13:25:07 +02:00
parent 94aaa4cde8
commit a56ab7859d
45 changed files with 768 additions and 593 deletions
@@ -24,7 +24,7 @@
use std::sync::Arc;
use aura_core::{Cell, Scalar, Timestamp};
use aura_engine::{summarize, RunMetrics};
use aura_backtest::{summarize, RunMetrics};
use chrono_tz::Europe::Berlin;
use aura_ingest::{default_data_server, open_ohlc, DataServer, DEFAULT_DATA_PATH};
@@ -16,7 +16,8 @@
use std::sync::Arc;
use aura_core::{Cell, Scalar, Timestamp};
use aura_engine::{sweep, summarize, GridSpace, RunManifest, RunReport};
use aura_backtest::{summarize, RunReport};
use aura_engine::{sweep, GridSpace, RunManifest};
use chrono_tz::Europe::Berlin;
use aura_ingest::{default_data_server, open_ohlc, DataServer, DEFAULT_DATA_PATH};
@@ -18,9 +18,10 @@
use std::sync::Arc;
use aura_core::{Cell, Scalar, Timestamp};
use aura_backtest::{summarize, RunReport, WindowRun};
use aura_engine::{
sweep, summarize, walk_forward, GridSpace, RollMode, RunManifest, RunReport, WindowBounds,
WindowRoller, WindowRun,
sweep, walk_forward, GridSpace, RollMode, RunManifest, WindowBounds,
WindowRoller,
};
use chrono::TimeZone;
use chrono_tz::Europe::Berlin;
@@ -40,10 +40,10 @@ use std::sync::mpsc;
use aura_core::{NodeSchema, Scalar, ScalarKind, Timestamp};
use aura_engine::{
join_on_ts, summarize, Composite, Edge, FlatGraph, GraphBuilder, Harness, RunManifest,
RunReport, SourceSpec, Target,
join_on_ts, Composite, Edge, FlatGraph, GraphBuilder, Harness, RunManifest,
SourceSpec, Target,
};
use aura_backtest::SimBroker;
use aura_backtest::{summarize, RunReport, SimBroker};
use aura_market::{Resample, Session};
use aura_std::{And, Delay, EqConst, Gt, Latch, Recorder};
use chrono::TimeZone;
@@ -31,7 +31,7 @@ fn run_real(
server: &Arc<DataServer>,
from: Timestamp,
to: Timestamp,
) -> (aura_engine::RunReport, Vec<(f64, f64)>) {
) -> (aura_backtest::RunReport, Vec<(f64, f64)>) {
let sources =
open_ohlc(server, SYMBOL, from, to).expect("GER40 has data in the Sept-2024 window");
let (mut h, taps) = build_harness();
@@ -21,9 +21,10 @@
use std::sync::Arc;
use aura_core::{Cell, Scalar, Timestamp};
use aura_backtest::{summarize, RunReport, WindowRun};
use aura_engine::{
sweep, summarize, walk_forward, GridSpace, RollMode, RunManifest, RunReport, WindowBounds,
WindowRoller, WindowRun,
sweep, walk_forward, GridSpace, RollMode, RunManifest, WindowBounds,
WindowRoller,
};
use chrono::TimeZone;
use chrono_tz::Europe::Berlin;
+2 -2
View File
@@ -9,11 +9,11 @@ use std::sync::Arc;
use aura_core::{Firing, NodeSchema, PortSpec, Scalar, ScalarKind, Timestamp};
use aura_engine::{
f64_field, summarize, Edge, FlatGraph, Harness, RunManifest, RunReport, SourceSpec, Target,
f64_field, Edge, FlatGraph, Harness, RunManifest, SourceSpec, Target,
VecSource,
};
use aura_ingest::load_m1_window;
use aura_backtest::SimBroker;
use aura_backtest::{summarize, RunReport, SimBroker};
use aura_std::{Recorder, Sma, Sub};
use aura_strategy::Bias;
use data_server::{DataServer, DEFAULT_DATA_PATH};
+2 -2
View File
@@ -9,11 +9,11 @@ use std::sync::Arc;
use aura_core::{Firing, NodeSchema, PortSpec, Scalar, ScalarKind, Timestamp};
use aura_engine::{
f64_field, summarize, Edge, FlatGraph, Harness, RunManifest, RunReport, Source, SourceSpec,
f64_field, Edge, FlatGraph, Harness, RunManifest, Source, SourceSpec,
Target,
};
use aura_ingest::{M1Field, M1FieldSource};
use aura_backtest::SimBroker;
use aura_backtest::{summarize, RunReport, SimBroker};
use aura_std::{Recorder, Sma, Sub};
use aura_strategy::Bias;
use data_server::loader::CHUNK_SIZE;