fix(cli): unwrap the walkforward UnknownKnob Debug frame into bare prose
render_bind_error's catch-all Debug-framed UnknownKnob although its payload is already a fully-prosed message; the variant now renders the payload alone. The two tests that pinned the frame verbatim repoint to the prose fragments. Exit 2 unchanged. Completes the #247 defect family: no Rust identifier reaches a user's stderr on either verb path. closes #269
This commit is contained in:
@@ -1920,12 +1920,10 @@ fn override_paths(
|
||||
/// (`KindMismatch { .. }` / `MissingKnob("..")`), the two variants the sweep
|
||||
/// terminal actually raises past `override_paths`' own pre-flight (which
|
||||
/// already rejects an unresolvable axis name as prose before either call
|
||||
/// site below ever reaches the terminal). Other variants keep the
|
||||
/// established `{:?}` rendering unchanged — in particular `UnknownKnob`
|
||||
/// already carries a fully-prosed message string at both call sites here
|
||||
/// (wrapped from `override_paths`' own `Result<_, String>`), and pinned
|
||||
/// tests (`aura_walkforward_emits_an_unknown_axis_rejection_once` et al.)
|
||||
/// depend on that Debug-wrapped shape.
|
||||
/// site below ever reaches the terminal). `UnknownKnob` already carries a
|
||||
/// fully-prosed message string (wrapped from `override_paths`' own
|
||||
/// `Result<_, String>`) — unwrapped here rather than Debug-framed (#269), so
|
||||
/// the walkforward path's rejection reaches stderr as bare prose too.
|
||||
fn render_bind_error(e: &BindError) -> String {
|
||||
match e {
|
||||
BindError::MissingKnob(name) => format!(
|
||||
@@ -1936,6 +1934,7 @@ fn render_bind_error(e: &BindError) -> String {
|
||||
"axis {knob}: expected {expected:?}, supplied {got:?} — \
|
||||
see `aura sweep <bp> --list-axes`"
|
||||
),
|
||||
BindError::UnknownKnob(msg) => msg.clone(),
|
||||
other => format!("{other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4563,8 +4563,8 @@ fn aura_walkforward_over_a_blueprint_rejects_an_unknown_axis() {
|
||||
assert_eq!(out.status.code(), Some(2), "an unknown axis must fail clean, not panic");
|
||||
let stderr = String::from_utf8(out.stderr).expect("utf-8");
|
||||
assert!(
|
||||
stderr.contains("Knob") && stderr.contains("nope"),
|
||||
"names the unresolved axis via BindError: {stderr}"
|
||||
stderr.contains("names no param") && stderr.contains("nope"),
|
||||
"names the unresolved axis via the prose payload (#269): {stderr}"
|
||||
);
|
||||
assert!(!stderr.contains("panicked"), "must reject cleanly, never panic: {stderr}");
|
||||
}
|
||||
@@ -4596,7 +4596,7 @@ fn aura_walkforward_emits_an_unknown_axis_rejection_once() {
|
||||
assert_eq!(out.status.code(), Some(2), "an unknown axis must fail clean, not panic");
|
||||
let stderr = String::from_utf8(out.stderr).expect("utf-8");
|
||||
assert!(!stderr.contains("panicked"), "must reject cleanly, never panic: {stderr}");
|
||||
let emits = stderr.matches("UnknownKnob").count();
|
||||
let emits = stderr.matches("names no param").count();
|
||||
assert_eq!(
|
||||
emits, 1,
|
||||
"attempt {attempt}: the axis rejection must be emitted exactly once, got {emits}: {stderr:?}",
|
||||
|
||||
Reference in New Issue
Block a user