Skip to content

fix(ci): strip ANSI escapes in just warnings before matching — gate works again - #39

Closed
gqf2008 wants to merge 1 commit into
tobi:mainfrom
gqf2008:scout/warnings-ansi
Closed

gqf2008 wants to merge 1 commit into
tobi:mainfrom
gqf2008:scout/warnings-ansi

Conversation

@gqf2008

@gqf2008 gqf2008 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What

just warnings is the preflight that fails a build when rustc emits warnings. Our CI exports
CARGO_TERM_COLOR=always, which makes rustc prefix every diagnostic with ANSI escapes — and the
recipe's anchored ^warning: grep then never matches, so a warning-bearing tree passed the gate
silently. (Reproduced in our CI run before this fix.)

Fix

Strip the escape sequences before matching:

plain="$(printf '%s\n' "$out" | sed $'s/\x1b\\[[0-9;]*m//g')"

The ESC is embedded as a bash $'…' literal so both BSD (macOS) and GNU sed accept it.

Verification

  • Planted an unused variable and ran the recipe with colors on: pre-fix recipe exited 0
    (reproducing the miss); post-fix it exits 1 and prints the warning.
  • Same check with colors off: green before and after (no behavior change on the clean path).

… works again

CI exports CARGO_TERM_COLOR=always, so rustc diagnostics carry ANSI escape
prefixes and the warnings recipe's anchored '^warning:' grep never matches:
a warning-bearing tree passed the gate.

Strip the escapes with a sed that embeds the ESC via a bash $'…' literal
(BSD and GNU sed both accept it) before matching. Verified end to end: with
a planted unused variable the old recipe exited 0; after the fix it exits
1 and shows the warning, with and without colors.
@tobi

tobi commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Landed on main as b81b15a. Thanks — CI's CARGO_TERM_COLOR=always was making just warnings a no-op.

@tobi tobi closed this Sep 5, 2026
@gqf2008
gqf2008 deleted the scout/warnings-ansi branch September 9, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants