From a3334bfb101ba6bc23adb051874114b4e5b51092 Mon Sep 17 00:00:00 2001 From: rysweet Date: Tue, 28 Jul 2026 22:21:45 +0000 Subject: [PATCH] test(journal): pin bare + agent-prefixed NODE_OPTIONS banner collapse (#1093) Follow-up to PR #4977 (merged), which landed the strip_recipe_noise launcher-banner guard in plainify_pr_title but without these additional regression assertions. Adds two anti-weakening cases to plain_summary_drops_node_options_launcher_banner_title: - Bare banner with NO Conventional-Commits prefix (the first colon lives in the trailing `To change:` path, so strip_conventional_prefix is a no-op and the whole banner must still collapse via strip_recipe_noise). - Banner still wearing the recipe-runner per-agent log prefix ([HH:MM:SS] [amplihack:copilot:PID] ...), which strip_recipe_noise peels before applying the launcher-line predicate. Both must collapse to the neutral "A code change." fallback. Test-only; no production change. Pins currently-correct behaviour against regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/journal/tests_pr_source.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/journal/tests_pr_source.rs b/src/journal/tests_pr_source.rs index 24fd740e..5f4c10ed 100644 --- a/src/journal/tests_pr_source.rs +++ b/src/journal/tests_pr_source.rs @@ -196,6 +196,31 @@ fn plain_summary_drops_node_options_launcher_banner_title() { To change: /home/azureuser/.amplihack/config", ); assert_eq!(fix, "A code change.", "banner leaked into journal: {fix}"); + + // Bare banner with NO Conventional-Commits prefix: the first colon lives in + // the trailing `To change:` path, so `strip_conventional_prefix` is a no-op + // and the whole banner reaches `strip_recipe_noise` — it must still collapse. + let bare = plainify_pr_title( + "\u{2139} NODE_OPTIONS=--max-old-space-size=32768 (saved preference). \ + To change: /home/azureuser/.amplihack/config", + ); + assert_eq!( + bare, "A code change.", + "bare banner leaked into journal: {bare}" + ); + + // Banner still wearing the recipe-runner per-agent log prefix + // (`[HH:MM:SS] [amplihack:copilot:PID] …`), which `strip_recipe_noise` + // peels before applying the launcher-line predicate. + let prefixed = plainify_pr_title( + "[08:26:10] [amplihack:copilot:460198] \u{2139} \ + NODE_OPTIONS=--max-old-space-size=32768 (saved preference). \ + To change: /home/azureuser/.amplihack/config", + ); + assert_eq!( + prefixed, "A code change.", + "agent-prefixed banner leaked into journal: {prefixed}" + ); } /// Anti-weakening guard (issue #1093): the filter must match the launcher banner