feat(cli): ship r-sma demo as a proven blueprint-data example (#159 cut 1)

Cut 1 of the hard-wired demo retirement — the copy+prove phase. The r-sma demo
strategy now ships as runnable blueprint data under crates/aura-cli/examples/
(r_sma.json closed 2/4, r_sma_open.json open), emitted from the current builder
so it is byte-for-byte the builder's serialization.

Two load-bearing proofs, captured while the builder is still alive:
- byte-fidelity: the shipped examples equal blueprint_to_json(&sma_signal(..)) —
  the "the copy is identical to the original" evidence the retirement method
  requires before any original is removed;
- grade anchor: `aura run examples/r_sma.json` reproduces the built-in
  `--harness r-sma` metrics byte-for-byte (expectancy_r/sqn/total_pips/n_trades).

Plus two property tests on the shipped copies (beyond the plan, kept as on-topic
proof strengthening): the closed example introspects to zero unbound params
(genuinely closed), and the open example lists exactly its two SMA-length axes
from the public gallery location.

Purely additive: the builder (sma_signal) and every inline r-sma surface are
retained. The recon showed deleting the builder has a large transitive closure
(the synthetic inline surface, the Strategy::RSma enum, ~40 integration tests);
that removal is cut 1b, a separate cycle, made safe by the byte-fidelity proof
frozen here.

Full workspace suite green; clippy -D warnings clean.

refs #159
This commit is contained in:
2026-07-07 12:40:14 +02:00
parent 83b375af66
commit d7fa4b4743
5 changed files with 100 additions and 0 deletions
+31
View File
@@ -6416,6 +6416,37 @@ mod tests {
std::fs::write("tests/fixtures/sma_signal_open.json", json).expect("write fixture");
}
/// Regenerates the shipped r-sma demo examples (crates/aura-cli/examples/) from
/// the current builder. Ignored by default; run with `--ignored` after a signal
/// change so the byte-fidelity proof stays green. (#159 copy+prove.)
#[test]
#[ignore = "regenerates the committed r-sma example blueprints"]
fn emit_r_sma_examples() {
std::fs::create_dir_all("examples").expect("create examples dir");
let closed = blueprint_to_json(&sma_signal(Some(2), Some(4))).expect("serializes");
std::fs::write("examples/r_sma.json", closed).expect("write closed example");
let open = blueprint_to_json(&sma_signal(None, None)).expect("serializes");
std::fs::write("examples/r_sma_open.json", open).expect("write open example");
}
/// The shipped examples under crates/aura-cli/examples/ ARE the builder's
/// serialization — the load-bearing proof the demo copy is identical to the
/// original, captured while the builder is alive (#159 copy+prove). Cut 1b's
/// builder deletion + synth-site swap rest on this.
#[test]
fn shipped_r_sma_examples_are_byte_identical_to_the_builder() {
assert_eq!(
include_str!("../examples/r_sma.json"),
blueprint_to_json(&sma_signal(Some(2), Some(4))).expect("serializes"),
"closed example drifted from sma_signal(2,4) — re-run emit_r_sma_examples --ignored",
);
assert_eq!(
include_str!("../examples/r_sma_open.json"),
blueprint_to_json(&sma_signal(None, None)).expect("serializes"),
"open example drifted from sma_signal(None,None) — re-run emit_r_sma_examples --ignored",
);
}
/// The cycle-1 keystone (C1): a signal serialized → loaded back through the
/// public `blueprint_from_json` path runs bit-identically to its Rust-built
/// twin — same metrics, same traces, same topology_hash.