audit(0075): cycle close — drift-clean; doc-link + trade_rs tripwire tidy; drop ephemera
Architect drift review (c99e7b8..2e77ab1) against the design ledger +
CLAUDE.md invariants: drift-clean, debt only — no contract or spec
violation. Verified intact: C18 wire shape (trade_rs is #[serde(skip)] +
excluded from the hand-written PartialEq; runs.jsonl/families.jsonl bytes
and digests unmoved; mc_r_bootstrap is a printed line, never a record),
C1 determinism (seeded r_bootstrap + disjoint walkforward windows, both
pinned by byte-identical-rerun e2e tests), C7 frictionless Stage-1
(round_trip_cost stays 0.0), C8/C12 streaming reduction (IS sweep folds
O(trades)/member, OOS run non-reduce). The verbatim summarize_r /
r_metrics_from_rs float duplication is guarded by the cross-reducer
equality test — sound.
Tidy applied this close:
- doc-link drift: the new E[R] notation in r_bootstrap / RBootstrap /
run_mc_r_bootstrap doc-comments was parsed by rustdoc as an intra-doc
link `[R]` (4 warnings). Wrapped in backticks; doc build now clean.
- coverage micro-gap [low, architect]: added a tripwire asserting a
populated trade_rs is absent from the serialized JSON (the serde(skip)
C18-preservation property had no direct test — only Vec::new() was
serialized before).
Carry-on (benign debt, not fixed): the mc usage literal carries a `usage:`
prefix the sibling sweep/walkforward usages omit — required because the
new `["mc", rest @ ..]` arm now handles the `--real` rejection and the
preserved golden asserts stderr.contains("usage"); churning the golden to
drop the prefix is not worth it.
Removed the cycle's ephemeral spec + plans (docs/specs/0075,
docs/plans/0075, docs/plans/0076) per the lifecycle rule.
Verified: cargo test --workspace 610 passed / 0 failed, clippy -D warnings
clean, cargo doc --no-deps clean.
closes #139
This commit is contained in:
@@ -2101,14 +2101,14 @@ fn parse_mc_args(rest: &[&str]) -> Result<McArgs, String> {
|
||||
|
||||
/// `aura mc --strategy stage1-r [--real <SYM>]`: run the stage1-r walk-forward, pool
|
||||
/// every OOS window's per-trade R series in roll order, and print one moving-block
|
||||
/// bootstrap `mc_r_bootstrap` line (E[R] distribution + P(E[R] <= 0)). Frictionless
|
||||
/// bootstrap `mc_r_bootstrap` line (`E[R]` distribution + P(`E[R]` <= 0)). Frictionless
|
||||
/// Stage-1 (no costs); deterministic given `seed` (C1).
|
||||
fn run_mc_r_bootstrap(data: DataSource, grid: &Stage1RGrid, block_len: usize, n_resamples: usize, seed: u64) {
|
||||
println!("{}", mc_r_bootstrap_report(&data, grid, block_len, n_resamples, seed));
|
||||
}
|
||||
|
||||
/// Assemble the `mc` R-bootstrap line: run the stage1-r walk-forward, pool the OOS
|
||||
/// per-trade R series in roll order, bootstrap E[R], and render the `mc_r_bootstrap`
|
||||
/// per-trade R series in roll order, bootstrap `E[R]`, and render the `mc_r_bootstrap`
|
||||
/// line. The body of `run_mc_r_bootstrap` minus the `println!`, so the full real-R
|
||||
/// wiring (walk-forward -> non-empty pooling -> bootstrap -> render) is reachable
|
||||
/// over synthetic data in a `#[cfg(test)]` unit, mirroring `mc_report` /
|
||||
|
||||
@@ -153,7 +153,7 @@ where
|
||||
McFamily { draws, aggregate }
|
||||
}
|
||||
|
||||
/// Distribution of E[R] under a moving-block bootstrap of an OOS per-trade R series
|
||||
/// Distribution of `E[R]` under a moving-block bootstrap of an OOS per-trade R series
|
||||
/// (#139). `block_len == 1` is the i.i.d. trade-shuffle; `block_len > 1` resamples
|
||||
/// contiguous runs, preserving the serial correlation of sequential trades a pure
|
||||
/// shuffle would erase. Deterministic (C1) given `seed`.
|
||||
|
||||
@@ -1477,6 +1477,16 @@ mod tests {
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn populated_trade_rs_is_absent_from_serialized_json() {
|
||||
// the in-memory conduit must never reach the wire: a populated trade_rs is
|
||||
// dropped by #[serde(skip)], so the C18 on-disk shape is byte-unperturbed (#139).
|
||||
let m = summarize_r(&pm_record_two_closed_trades(), 0.0);
|
||||
assert_eq!(m.trade_rs, vec![2.0, -1.0], "precondition: trade_rs is populated");
|
||||
let json = serde_json::to_string(&m).expect("RMetrics serializes");
|
||||
assert!(!json.contains("trade_rs"), "trade_rs must not reach the wire: {json}");
|
||||
}
|
||||
|
||||
/// A minimal dense PositionManagement record with two closed trades at R = +2, -1.
|
||||
/// Columns per `r_col` (CLOSED=0, REALIZED_R=1, DIRECTION=4, ENTRY_PRICE=6,
|
||||
/// STOP_PRICE=7, CONVICTION_AT_ENTRY=9, SIZE=10, OPEN=11, UNREALIZED_R=12); width 13.
|
||||
|
||||
Reference in New Issue
Block a user