fix(cli): refuse --trace on sweep/walkforward instead of silently dropping it (#168)

The clap help promised "persists each member's/OOS window's taps" and the chart
NotFound hint recommended `aura sweep --trace`, but every blueprint-mode arm
discarded the flag (run_blueprint_sweep's `let _ = persist`, the --real sugar's
persist_taps: vec![]) — the surface advertised trace-recording the code dropped.
Refuse --trace up front on both verbs (exit 2, "--trace is not yet available on
<verb>; see #224"), mirroring the existing aura run / aura mc refusals; drop the
false promise from the two help lines and the chart NotFound hint. Delivering
per-member trace-writing is deferred to #224.

Collateral: four synthetic-sweep tests that used --trace as a family-name handle
move to --name (same handle, still accepted); the walkforward name/trace test now
pins the up-front #224 refusal.

Workspace suite green (62 groups / 0 failed), clippy -D warnings clean.

refs #168
This commit is contained in:
2026-07-09 23:47:32 +02:00
parent 53bbcedeec
commit abbfbdc208
2 changed files with 32 additions and 17 deletions
+21 -7
View File
@@ -447,7 +447,7 @@ fn emit_chart(name: &str, tap: Option<&str>, mode: ChartMode, env: &project::Env
NameKind::NotFound => {
eprintln!(
"aura: no recorded run or family '{name}' under runs/traces \
(run `aura run --trace {name}` or `aura sweep --trace {name}` first)"
(run `aura run --trace {name}` first)"
);
std::process::exit(1);
}
@@ -2174,7 +2174,7 @@ struct SweepCmd {
/// Family name (records to the registry without persisting per-member traces).
#[arg(long)]
name: Option<String>,
/// Family name that also persists each member's taps (mutually exclusive with --name).
/// Family name (not yet available on this verb; see #224).
#[arg(long)]
trace: Option<String>,
/// Blueprint sweep axis `<name>=<csv>` (repeatable; .json mode).
@@ -2201,7 +2201,7 @@ struct WalkforwardCmd {
/// Family name (records to the registry without persisting per-member traces).
#[arg(long)]
name: Option<String>,
/// Family name that also persists each OOS window's taps (mutually exclusive with --name).
/// Family name (not yet available on this verb; see #224).
#[arg(long)]
trace: Option<String>,
/// Campaign-path stop length (single value; --real mode).
@@ -2795,9 +2795,17 @@ fn dispatch_new(a: NewCmd, _env: &project::Env) {
fn dispatch_sweep(a: SweepCmd, env: &project::Env) {
// Single-sourced: the blueprint grammar and the no-blueprint usage error must
// stay in lockstep, so both arms below read this one closure.
let usage = || "Usage: aura sweep <blueprint.json> --axis <name>=<csv> [--axis …] [--name <n> | --trace <n>] [--real <SYM> [--from <ms>] [--to <ms>]]".to_string();
let usage = || "Usage: aura sweep <blueprint.json> --axis <name>=<csv> [--axis …] [--name <n>] [--real <SYM> [--from <ms>] [--to <ms>]]".to_string();
match is_blueprint_file(&a.blueprint) {
Some(path) => {
// No blueprint-mode arm persists per-member taps (synthetic drops it via
// `let _ = persist`, `--real` sugar sets `persist_taps: vec![]`) — refuse
// rather than silently accept an advertised-but-unhonoured flag, mirroring
// the `aura run`/`aura mc` --trace refusals.
if a.trace.is_some() {
eprintln!("aura: --trace is not yet available on sweep; see #224");
std::process::exit(2);
}
let doc = std::fs::read_to_string(path).unwrap_or_else(|e| {
eprintln!("aura: {path}: {e}");
std::process::exit(2);
@@ -2817,7 +2825,6 @@ fn dispatch_sweep(a: SweepCmd, env: &project::Env) {
// A query, not a sweep: it must stand alone.
if !a.axis.is_empty()
|| a.name.is_some()
|| a.trace.is_some()
|| a.real.is_some()
|| a.from.is_some()
|| a.to.is_some()
@@ -2901,9 +2908,16 @@ fn dispatch_sweep(a: SweepCmd, env: &project::Env) {
/// #220: arbitrary user blueprint + axes, formerly the welded r-sma branch).
fn dispatch_walkforward(a: WalkforwardCmd, env: &project::Env) {
// Single-sourced: both arms below read this one closure (house style, #179).
let usage = || format!("Usage: aura walkforward <blueprint.json> --axis <name>=<csv> [--axis …] [--select <argmax|plateau:mean|plateau:worst>] [--name <n>] | aura walkforward <blueprint.json> --real <SYMBOL> --axis <name>=<csv> [--axis …] [--stop-length <n> (default {R_SMA_STOP_LENGTH})] [--stop-k <x> (default {R_SMA_STOP_K:.1})] [--from <ms>] [--to <ms>] [--name <n> | --trace <n>]");
let usage = || format!("Usage: aura walkforward <blueprint.json> --axis <name>=<csv> [--axis …] [--select <argmax|plateau:mean|plateau:worst>] [--name <n>] | aura walkforward <blueprint.json> --real <SYMBOL> --axis <name>=<csv> [--axis …] [--stop-length <n> (default {R_SMA_STOP_LENGTH})] [--stop-k <x> (default {R_SMA_STOP_K:.1})] [--from <ms>] [--to <ms>] [--name <n>]");
match is_blueprint_file(&a.blueprint) {
Some(path) => {
// No blueprint-mode arm persists per-window taps — refuse rather than
// silently accept an advertised-but-unhonoured flag, mirroring the
// `aura run`/`aura mc` --trace refusals.
if a.trace.is_some() {
eprintln!("aura: --trace is not yet available on walkforward; see #224");
std::process::exit(2);
}
let doc = std::fs::read_to_string(path).unwrap_or_else(|e| {
eprintln!("aura: {path}: {e}");
std::process::exit(2);
@@ -2983,7 +2997,7 @@ fn dispatch_walkforward(a: WalkforwardCmd, env: &project::Env) {
return;
}
// Synthetic in-process family path — unchanged (#220 non-goal).
if a.stop_length.is_some() || a.stop_k.is_some() || a.trace.is_some() {
if a.stop_length.is_some() || a.stop_k.is_some() {
eprintln!("aura: {}", usage());
std::process::exit(2);
}