Files
Aura/crates/aura-vocabulary/tests/c28_layering.rs
T
claude 5c2ac982bc refactor: extract the member-run recipe into library crates (#295 part 1)
The shell no longer defines what an aura backtest is. Tasks 1-9 of the
shell-boundary cycle — structural extraction, behaviour byte-identical:

- aura-runner (new; the C28 assembly position): input binding (the C26
  module, moved whole), the C1-load-bearing param<->config translators,
  harness assembly (wrap_r / run_signal_r / run_blueprint_member and the
  probe/reopen cluster), axis + risk-regime conventions (bind_axes et
  al.), the campaign family builders + MC guards, reproduce
  (process::exit -> RunnerError, shell remaps to identical bytes), the
  measurement-run orchestration, project loading (Env / cdylib load /
  charter / staleness, moved whole), the coverage gap-walk (deduplicated
  onto interior_gap_months), and DefaultMemberRunner — the public
  implementation of aura_campaign::MemberRunner (ex CliMemberRunner).
  The MemberRunner trait stays in aura-campaign; the column still
  imports no harness/data-binding machinery.
- aura-measurement (new; seeds C28 rung 3): the IcMetrics/IcKey
  vocabulary + information_coefficient, verbatim incl. serde derives
  (#294 duplicate-timestamp semantics move as-is, unresolved).
- aura-backtest: the pure per-run scaffold (point_from_params,
  wf_ms_sizes / fit_wf_ms_sizes, intersect_shared_window).
- shell residue: main.rs / campaign_run.rs keep argv/dispatch,
  argv->document translation, and presentation only;
  walkforward_summary_json_from_reports now calls the public
  aura_engine::param_stability instead of its inline twin.
- worked example (crates/aura-runner/examples/world_member_run.rs): a
  World program runs a member backtest through the library alone.

Held quality findings, adjudicated: the plan's literal pub-visibility
list for binding.rs kept (cosmetic); ~20 refusal sites inside
aura-runner (family/member/measure/translate) still process::exit —
behaviour-identical today, conversion to RunnerError is filed forward
(refs #297); rustfmt line-width drift on re-pathed call sites left for
a repo-wide fmt decision.

Verification: cargo test --workspace green (1471 passed, 0 failed);
cargo clippy --workspace --all-targets -D warnings clean. Byte-identity
is pinned by the untouched shell E2E suites (cli_run, measure_ic,
run_measurement, research_docs, run_refuses_unrunnable_blueprint,
tap_recording — zero assertion edits).

Remaining in this cycle: full-workspace c28_layering + shell-content
check, ledger amendments (C28 assembly position, C25/C14 control-surface
consequence, C26 realization note).

refs #295
2026-07-21 05:20:27 +02:00

60 lines
2.4 KiB
Rust

//! C28 structural fitness: the node crates obey the ladder import direction.
//! The compiler only rejects import cycles; an acyclic-but-outward dependency
//! (e.g. `aura-std` -> `aura-market`) would compile silently. This test reads
//! each node crate's `[dependencies]` table and asserts its intra-workspace edges
//! stay within the inner set C28 permits for that layer. `[dev-dependencies]` are
//! C28-exempt (tests may cross layers) and are deliberately not inspected.
use std::path::PathBuf;
fn workspace_root() -> PathBuf {
// aura-vocabulary/ + /../.. = workspace root (the repo idiom for reaching it).
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("..").join("..")
}
/// The `aura-*` keys under `[dependencies]` (NOT `[dev-dependencies]`) of a crate.
fn prod_intra_workspace_deps(crate_name: &str) -> Vec<String> {
let manifest = workspace_root()
.join("crates")
.join(crate_name)
.join("Cargo.toml");
let text = std::fs::read_to_string(&manifest)
.unwrap_or_else(|e| panic!("read {}: {e}", manifest.display()));
let doc: toml::Value = toml::from_str(&text).expect("Cargo.toml parses as TOML");
match doc.get("dependencies").and_then(|d| d.as_table()) {
Some(deps) => deps
.keys()
.filter(|k| k.starts_with("aura-"))
.cloned()
.collect(),
None => Vec::new(),
}
}
#[test]
fn node_crates_obey_the_c28_import_direction() {
// (crate, the intra-workspace [dependencies] C28 permits for its layer)
let allowed: &[(&str, &[&str])] = &[
("aura-analysis", &[]), // foundation: no aura-* deps
("aura-measurement", &["aura-core", "aura-analysis"]),
("aura-std", &["aura-core"]),
("aura-market", &["aura-core"]),
("aura-strategy", &["aura-core"]),
("aura-engine", &["aura-core", "aura-analysis"]),
("aura-backtest", &["aura-core", "aura-engine"]),
(
"aura-vocabulary",
&["aura-core", "aura-std", "aura-market", "aura-strategy", "aura-backtest"],
),
];
for (crate_name, permitted) in allowed {
for dep in prod_intra_workspace_deps(crate_name) {
assert!(
permitted.contains(&dep.as_str()),
"C28 import-direction violation: `{crate_name}` [dependencies] on `{dep}`, \
outside its permitted inner set {permitted:?}"
);
}
}
}