Skip to content

fix(test): make setup_label assertion color-independent - #31

Open
xqqmdy wants to merge 2 commits into
OneNoted:mainfrom
xqqmdy:fix/test-color-independent
Open

xqqmdy wants to merge 2 commits into
OneNoted:mainfrom
xqqmdy:fix/test-color-independent

Conversation

@xqqmdy

@xqqmdy xqqmdy commented Oct 30, 2026

Copy link
Copy Markdown

setup_label() embeds ANSI styling via tier_token(), so asserting contains("[Recommended ]") on the raw string fails whenever colors are forced (CLICOLOR_FORCE=1) — e.g. running cargo test from an interactive shell that sets it, including through the pre-push hook. Strip the escape codes with console::strip_ansi_codes() before asserting.

Stack note: This is one of four single-commit PRs reviewed bottom-up:

Until the lower PRs merge, "Files changed" also shows their commits. The stacking exists because the local pre-push hook runs full CI on the working tree: on clang >= 22 machines the vulkan feature check cannot build without PR 3, and clippy 1.99 fails without PR 1, so each branch needs the ones below it to be locally verifiable. PRs 1–2 are independently green on GitHub CI (clang 18).

clippy 1.99 (useless_borrows_in_formatting) denies these under -D warnings;
local pre-push CI runs clippy with a newer toolchain than the one that last
touched src/ui.rs, so the hook fails on main without this.
setup_label embeds ANSI styling via tier_token, so asserting on the raw
string fails on terminals that force colors (CLICOLOR_FORCE=1), e.g. when
the pre-push hook runs cargo test from an interactive shell. Strip the
escape codes before asserting.
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6fd80390-e881-46f3-ab4b-3f7ea4139493
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@xqqmdy xqqmdy changed the title Fix/test color independent fix(test): make setup_label assertion color-independent Oct 30, 2026
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.

1 participant