Skip to content

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

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

fix(ci): the invisible-character gate never matched anything#82
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.
@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: e43d4947-992b-435e-bdfa-12323a894bb0

📥 Commits

Reviewing files that changed from the base of the PR and between 3533cfa and 5bec968.

📒 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
🔇 Additional comments (1)
.github/workflows/dogfood-gate.yml (1)

144-155: 🎯 Functional Correctness

No byte-wise BOM check is required. grep -aPrl detects the leading UTF-8 BOM with the existing \x{feff} pattern, so the claimed gap does not occur.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of invisible and control characters in automated checks.
    • Updated scanning to reliably inspect binary files as text, reducing the chance of missed issues.

Walkthrough

The dogfood gate now matches invisible characters by Unicode code point, includes additional control characters and the word joiner, and scans binary files as text.

Changes

Invisible-character gate

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

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

Merge Risk: ⚪ Minimal · up to 5bec9

The workflow narrowly corrects invisible-character detection, including BOM handling, with no actionable merge-blocking risk remaining after normal checks and review.

Poem

I am a rabbit with codepoints bright
I check hidden marks in files at night
C0 controls now join the queue
Binary text gets inspected too
The gate can see what once hid from sight

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The workflow change addresses codepoint escapes, C0 controls, and grep -a. It does not include the separately required leading-BOM byte check, updates to stdlib/ByteDetector.affine and config.ncl, or … Add the leading-BOM byte-wise check, update stdlib/ByteDetector.affine and config.ncl with consistent C0-control detection, and apply the corrected pattern to all required inlined dogfood-gate.yml copies. Add verification for NBSP, zero-wid…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the CI fix for the invisible-character gate and matches the main change.
Description check ✅ Passed The description explains the root cause, changes, and verification results. It omits the template headings and RSR checklist, but it provides the required technical context and testing information.
Out of Scope Changes check ✅ Passed The changes are limited to the invisible-character detection logic in the dogfood-gate workflow. No unrelated 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 workflow change addresses codepoint escapes, C0 controls, and grep -a. It does not include the separately required leading-BOM byte check, updates to stdlib/ByteDetector.affine and config.ncl, or corrections across the other inlined gate copies required by issue #70.

Resolution

Add the leading-BOM byte-wise check, update stdlib/ByteDetector.affine and config.ncl with consistent C0-control detection, and apply the corrected pattern to all required inlined dogfood-gate.yml copies. Add verification for NBSP, zero-width space, soft hyphen, bidi override, word joiner, NUL, backspace, legitimate whitespace, clean files, and leading BOMs.

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

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.

@sonarqubecloud

Copy link
Copy Markdown

@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

This PR fixes the invisible-character linter which previously failed to match Unicode characters due to incorrect usage of UTF-8 byte sequences. It successfully transitions to codepoint escapes and expands detection to C0 control characters.

While the implementation logic is correct, there is a performance optimization identified in the use of find -exec. Additionally, there are no automated tests or sample files included to verify that these patterns work as intended or to prevent future regressions. The Codacy analysis is up to standards, and no critical security vulnerabilities were found.

About this PR

  • Although the manual verification confirms the fix, the PR lacks automated test cases or sample files containing the targeted characters. Without these, it is difficult to guarantee the gate remains functional as the environment or requirements evolve.

Test suggestions

  • Missing recommended test scenario: Verify detection of Non-Breaking Space (U+00A0) using codepoint escape.
  • Missing recommended test scenario: Verify detection of C0 control characters (e.g., Backspace \x08) to prevent CI failures.
  • Missing recommended test scenario: Ensure 'grep -a' correctly processes and scans files containing NUL bytes (\x00).
  • Missing recommended test scenario: Verify detection of Byte Order Mark (U+FEFF).
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Missing recommended test scenario: Verify detection of Non-Breaking Space (U+00A0) using codepoint escape.
2. Missing recommended test scenario: Verify detection of C0 control characters (e.g., Backspace \x08) to prevent CI failures.
3. Missing recommended test scenario: Ensure 'grep -a' correctly processes and scans files containing NUL bytes (\x00).
4. Missing recommended test scenario: Verify detection of Byte Order Mark (U+FEFF).

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.

⚪ LOW RISK

Suggestion: The -exec ... \; syntax spawns a new process for every file, which is inefficient. Using -exec ... + allows grep to process multiple files in a single batch, improving performance. Also, the -r flag is unnecessary since find is already providing specific file paths through recursion.

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 60c2b51 into main Aug 27, 2026
20 of 22 checks passed
@hyperpolymath
hyperpolymath deleted the fix/empty-linter-pattern-never-matched branch August 27, 2026 23:37
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