Skip to content

fix(ci): the invisible-character gate never matched anything - #34

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/empty-linter-pattern-never-matched
Aug 28, 2026
Merged

fix(ci): the invisible-character gate never matched anything#34
hyperpolymath merged 1 commit into
mainfrom
fix/empty-linter-pattern-never-matched

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Measured 2026-08-27: this gate caught 0 of 6 invisible-character test cases. It has never detected an NBSP, zero-width space, BOM, soft hyphen, bidi override or word joiner.

Root cause

The pattern used UTF-8 byte sequences (\xc2\xa0) while grep -P matches characters. Bytes c2 a0 are one character U+00A0; \xc2\xa0 asks for two, U+00C2 then U+00A0 — never present.

grep -P '\xc2\xa0'  ->  miss
grep -P '\x{a0}'    ->  MATCH

Only \x00 worked, being single-byte in both readings. The gate ran, passed, and could not see what it exists to see.

Fixed

  • codepoint escapes in place of byte sequences
  • C0 controls \x01-\x08,\x0B,\x0C,\x0E-\x1F added (TAB/LF/CR excluded)
  • grep -a — without it grep skips any NUL-bearing file as binary

The C0 range matters: a stray backspace byte made a workflow unparseable in developer-ecosystem, so it never ran — and this linter called it clean.

Canonical fix: hyperpolymath/empty-linter#70. 1 file(s) here.

Verified: YAML re-parsed, and the corrected pattern was confirmed to catch a real NBSP before the change was kept.

MEASURED 2026-08-27: this gate's pattern caught 0 OF 6 invisible-character test
cases. It has never detected an NBSP, zero-width space, BOM, soft hyphen, bidi
override or word joiner.

ROOT CAUSE: the pattern used UTF-8 BYTE sequences (\xc2\xa0) while grep -P
matches CHARACTERS. Bytes c2 a0 are ONE character U+00A0; \xc2\xa0 asks for TWO
characters, U+00C2 then U+00A0, which is never present.

  grep -P '\xc2\xa0'  ->  miss
  grep -P '\x{a0}'    ->  MATCH

Only \x00 worked, being single-byte in both readings.

FIXED: codepoint escapes; C0 control characters \x01-\x08,\x0B,\x0C,\x0E-\x1F
added (TAB/LF/CR excluded); and grep -a, without which grep skips any NUL-bearing
file as binary.

The C0 range matters: a stray BACKSPACE byte made a workflow unparseable in
developer-ecosystem, so it never ran, and this linter called it clean.

Canonical fix: hyperpolymath/empty-linter#70. 1 file(s) here.
VERIFIED: YAML re-parsed, and the corrected pattern was confirmed to catch a real
NBSP before the change was kept.
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: be1c68f5-211f-42c5-a082-9a08bc96db2c

📥 Commits

Reviewing files that changed from the base of the PR and between 9c3567d and 729908f.

📒 Files selected for processing (1)
  • .github/workflows/dogfood-gate.yml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
.github/workflows/dogfood-gate.yml (1)

122-122: LGTM!

Also applies to: 133-133


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of invisible and control characters during automated checks.
    • Scanning now includes binary files, helping identify hidden characters that could previously be missed.

Walkthrough

The workflow updates invisible-character detection to use Unicode code-point escapes, adds C0 controls and the word joiner, and scans binary files with grep -a.

Changes

Invisible-character gate

Layer / File(s) Summary
Pattern and scan coverage
.github/workflows/dogfood-gate.yml
The PATTERNS regex now uses Unicode code-point escapes and includes C0 control characters and the word joiner. The scan uses grep -aPrl so binary files are treated as text.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 72990

This PR corrects the workflow’s invisible-character matching and expands detection coverage; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

A rabbit checks each hidden sign
Unicode marks now align
Binary files join the queue
Control codes are counted too
The gate hops cleanly through the line

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes satisfy the codepoint escape, C0 control, and grep -a requirements for the inline CI gate. The linked issue also requires a separate leading-BOM check and alignment with the compiled linte… Add the separate byte-wise leading-BOM check and update the compiled linter configuration where applicable. If those changes belong to separate work, document the split and link the corresponding issue or pull request.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing the CI gate that failed to detect invisible characters.
Description check ✅ Passed The description directly explains the detection defect, root cause, implemented fixes, and verification related to the changeset.
Out of Scope Changes check ✅ Passed The PR changes only the intended dogfood-gate.yml detection pattern and grep invocation. No unrelated code changes are shown.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Linked Issues check

Explanation

The changes satisfy the codepoint escape, C0 control, and grep -a requirements for the inline CI gate. The linked issue also requires a separate leading-BOM check and alignment with the compiled linter, but this PR shows no such changes.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

@gitar-bot

gitar-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR fixes the invisible-character gate in the CI pipeline, which was previously ineffective. By transitioning to Unicode codepoint escapes and utilizing the -a flag for binary/NUL byte handling, the detection logic now correctly identifies NBSP, C0 control codes, and other hidden characters. Codacy analysis indicates the changes are up to standards.

While the logic improvements are sound, there is a notable gap in automated verification; no dummy files containing these characters were added to ensure the gate remains functional in the future. Additionally, an optimization is recommended for the find command to reduce process overhead during scans.

About this PR

  • The PR description mentions manual verification, but the repository lacks automated test fixtures (e.g., sample files containing invisible characters) to verify this CI gate. Adding such fixtures would prevent future regressions where the gate might become silent again.

Test suggestions

  • Detect NBSP (U+00A0) in a source file
  • Detect C0 control characters (e.g., Backspace \x08) in a source file
  • Detect NUL bytes (\x00) and ensure the file is not skipped by grep
  • Detect Zero-Width Joiners (U+200D)
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Detect NBSP (U+00A0) in a source file
2. Detect C0 control characters (e.g., Backspace \x08) in a source file
3. Detect NUL bytes (\x00) and ensure the file is not skipped by grep
4. Detect Zero-Width Joiners (U+200D)

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

-o -name '*.idr' -o -name '*.zig' -o -name '*.v' -o -name '*.jl' \
-o -name '*.gleam' -o -name '*.hs' -o -name '*.ml' -o -name '*.sh' \) \
-exec grep -Prl "$PATTERNS" {} \; > /tmp/empty-lint-results.txt 2>/dev/null
-exec grep -aPrl "$PATTERNS" {} \; > /tmp/empty-lint-results.txt 2>/dev/null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Suggestion: The -r flag is redundant here as find already provides the file paths. Using + instead of \; will significantly improve performance by batching many files into a single grep invocation.

Suggested change
-exec grep -aPrl "$PATTERNS" {} \; > /tmp/empty-lint-results.txt 2>/dev/null
-exec grep -aPl "$PATTERNS" {} + > /tmp/empty-lint-results.txt 2>/dev/null

@hyperpolymath
hyperpolymath merged commit a8b3d46 into main Aug 28, 2026
26 of 27 checks passed
@hyperpolymath
hyperpolymath deleted the fix/empty-linter-pattern-never-matched branch August 28, 2026 07:30
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