From 48979193b9525c4aaf3cf96e78e7eec399a10e8b Mon Sep 17 00:00:00 2001 From: claude Date: Fri, 24 Jul 2026 00:58:20 +0200 Subject: [PATCH] tidy(cli): pluralization-aware zero-trade note wording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Milestone-fieldtest friction: a single-OOS-window walk-forward printed "all 1 walk-forward windows recorded zero trades" (captured RED evidence: fieldtests/milestone-stderr-honesty/captured/ example2_singular.err). The message text moves into a pure zero-trade_note_text builder — singular "the single walk-forward window recorded zero trades", plural unchanged so the existing e2e phrase pins hold — with a unit pin on both forms. refs #278 --- crates/aura-cli/src/diag.rs | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/crates/aura-cli/src/diag.rs b/crates/aura-cli/src/diag.rs index d3cedb6..1be3c04 100644 --- a/crates/aura-cli/src/diag.rs +++ b/crates/aura-cli/src/diag.rs @@ -19,6 +19,19 @@ macro_rules! warning { pub(crate) use {note, warning}; +/// The zero-trade note's message text (#313), pluralization-aware — the +/// milestone fieldtest tripped over "all 1 walk-forward windows" +/// (captured: `fieldtests/milestone-stderr-honesty/captured/ +/// example2_singular.err`). Pure over the count so the wording is +/// unit-pinned. +fn zero_trade_note_text(n_windows: usize) -> String { + if n_windows == 1 { + "the single walk-forward window recorded zero trades".to_string() + } else { + format!("all {n_windows} walk-forward windows recorded zero trades") + } +} + /// The #313 zero-trade note, shared by both walk-forward paths (the /// synthetic-blueprint path in `main.rs` and the `--real` sugar path in /// `verb_sugar.rs`) so the wording AND the condition live in exactly one @@ -27,6 +40,26 @@ pub(crate) use {note, warning}; pub(crate) fn note_zero_trade_windows(mut window_trades: impl ExactSizeIterator) { let n_windows = window_trades.len(); if n_windows > 0 && window_trades.all(|n| n == 0) { - note!("all {n_windows} walk-forward windows recorded zero trades"); + note!("{}", zero_trade_note_text(n_windows)); + } +} + +#[cfg(test)] +mod tests { + use super::zero_trade_note_text; + + #[test] + /// #278 fieldtest friction: the single-window form must read as + /// grammatical English while the plural form keeps the exact phrase + /// the e2e pins grep for. + fn zero_trade_note_pluralizes() { + assert_eq!( + zero_trade_note_text(1), + "the single walk-forward window recorded zero trades" + ); + assert_eq!( + zero_trade_note_text(3), + "all 3 walk-forward windows recorded zero trades" + ); } }