Skip to content

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

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#61
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: 133a9fc6-2c9c-45e6-b308-debd3eaa824b

📥 Commits

Reviewing files that changed from the base of the PR and between 48e3ac9 and b0eb4d6.

📒 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. (26)
  • GitHub Check: Gitar
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: governance / Language / package anti-pattern policy
  • GitHub Check: governance / Code quality + docs
  • GitHub Check: governance / Workflow security linter
  • GitHub Check: governance / Trusted-base reduction policy
  • GitHub Check: governance / Well-Known (RFC 9116 + RSR)
  • GitHub Check: governance / Security policy checks
  • GitHub Check: governance / Guix primary / Nix fallback policy
  • GitHub Check: governance / Licence consistency
  • GitHub Check: governance / Check Workflow Staleness
  • GitHub Check: scan / shell-secrets
  • GitHub Check: scan / rust-secrets
  • GitHub Check: scan / gitleaks
  • GitHub Check: scan / Hypatia Neurosymbolic Analysis
  • GitHub Check: rust-ci / Detect Cargo.toml
  • GitHub Check: Hypatia neurosymbolic scan
  • GitHub Check: ABI ↔ FFI structural conformance
  • GitHub Check: Zig FFI builds + tests (Zig 0.14.0)
  • GitHub Check: Validate eclexiaiser manifest
  • GitHub Check: Validate A2ML manifests
  • GitHub Check: Validate K9 contracts
  • GitHub Check: panic-attack assail
  • GitHub Check: Groove manifest check
  • GitHub Check: analyze (actions, none)
  • GitHub Check: Empty-linter (invisible characters)
🔇 Additional comments (1)
.github/workflows/dogfood-gate.yml (1)

122-122: 🎯 Functional Correctness

Do not add a separate leading-BOM check. GNU grep 3.8 rejects this PATTERNS value before scanning (\x{200b} and \x{feff} are too large), so the claimed leading-BOM miss is not established.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of invisible and directional Unicode characters during automated checks.
    • Updated scanning to reliably inspect files that may contain binary data.

Walkthrough

The dogfood gate now detects a wider set of invisible characters using Unicode code-point escapes. It also scans binary files as text.

Changes

Invisible-character gate

Layer / File(s) Summary
Expand invisible-character scanning
.github/workflows/dogfood-gate.yml
The regex now detects control characters, directional formatting marks, the word joiner, and Unicode code points such as NBSP, zero-width space, and BOM. The scan uses grep -aPrl to include binary files.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to b0eb4

This localized workflow pattern change is merge-ready after normal checks; no actionable merge-blocking risk remains.

Poem

A rabbit checks each hidden sign

Code points now align
Binary files join the scan
Control marks reveal their plan
The gate sees what it can
And hops along the line

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The change satisfies the codepoint escape, C0 control range, and grep -a requirements in issue #70. It does not show the required separate leading-BOM check, compiled-linter alignment, or updates to t… Add the separate byte-wise leading-BOM check, update stdlib/ByteDetector.affine and config.ncl to keep compiled-linter behaviour aligned, and apply the correction to all other inlined copies required by issue #70. Verify the listed invisibl…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: fixing the CI invisible-character gate so it detects matches.
Description check ✅ Passed The description explains the root cause, the code changes, and verification results. It is on topic and mostly complete, although it does not use the template headings or include the checklist and tes…
Out of Scope Changes check ✅ Passed The changes are limited to the dogfood-gate workflow and directly support the linked issue objective of fixing invisible-character detection. 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: Description check

Explanation

The description explains the root cause, the code changes, and verification results. It is on topic and mostly complete, although it does not use the template headings or include the checklist and testing sections explicitly.

Full details: Linked Issues check

Explanation

The change satisfies the codepoint escape, C0 control range, and grep -a requirements in issue #70. It does not show the required separate leading-BOM check, compiled-linter alignment, or updates to the other inlined gate copies described in the issue.

Resolution

Add the separate byte-wise leading-BOM check, update stdlib/ByteDetector.affine and config.ncl to keep compiled-linter behaviour aligned, and apply the correction to all other inlined copies required by issue #70. Verify the listed invisible-character, corrupted-workflow, and clean-file cases after these 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

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

This PR successfully addresses the non-functional invisible-character gate by transitioning to PCRE-compatible Unicode escapes and incorporating the -a flag to prevent skipping files containing null bytes. The code is up to standards according to Codacy analysis.

However, there are opportunities to improve the efficiency of the search command and the robustness of the CI gate itself. The current implementation spawns a process for every file and suppresses potential errors that could indicate environment issues. Additionally, the lack of test fixtures or automated validation for these patterns leaves the gate at risk of future regressions.

About this PR

  • No automated tests or fixture files containing the targeted invisible characters (e.g., BOM, ZWSP, or C0 control characters) were added to the repository. Consider adding a 'test-fixtures' directory with samples of these characters to verify the regex patterns and prevent regressions.

Test suggestions

  • Detect Non-breaking space (U+00A0) using the updated codepoint escape
  • Detect C0 control characters (e.g., \x08 backspace) while ignoring TAB (\x09)
  • Verify grep -a correctly processes and scans files containing null bytes (\x00)
  • Detect Zero-width characters (U+200B, U+200C, U+200D) and BOM (U+FEFF)
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Detect Non-breaking space (U+00A0) using the updated codepoint escape
2. Detect C0 control characters (e.g., \x08 backspace) while ignoring TAB (\x09)
3. Verify grep -a correctly processes and scans files containing null bytes (\x00)
4. Detect Zero-width characters (U+200B, U+200C, U+200D) and BOM (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 search process is inefficient and contains redundant flags. Spawning a new grep process for every file using \; is slow; changing this to + allows find to pass multiple files to a single process. Additionally, the -r (recursive) flag is redundant because find already handles recursion, and redirecting stderr to /dev/null is discouraged as it masks potential issues such as missing PCRE support in the runner.

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

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