Skip to content

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

Open
hyperpolymath wants to merge 3 commits into
mainfrom
fix/invisible-gate-canonical-scanner
Open

fix(ci): the invisible-character gate never matched anything#743
hyperpolymath wants to merge 3 commits into
mainfrom
fix/invisible-gate-canonical-scanner

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Supersedes #734 (unmergeable: DIRTY, and its inline Python scanner violates the estate language policy).

What

Replaces the broken character-mode PCRE escapes in dogfood-gate.yml's empty-lint job (\xc2\xa0 in grep -P asks for the two characters U+00C2 U+00A0 — present in no file, so the gate matched nothing for months) with the canonical byte-safe scanner that rsr-template-repo#49 hardened through four owner review rounds:

  • scripts/check-invisible-characters.sh — ported verbatim from rsr-template-repo main. Matches UTF-8 byte sequences under LC_ALL=C (robust to invalid-UTF-8 files), NUL-delimited enumeration, fail-closed on find/grep errors.
  • tests/invisible-characters-test.sh — the regression controls: NBSP, soft hyphen, zero-width/bidi, word-joiner, leading BOM, NUL, backspace, invalid UTF-8, permitted TAB/LF/CR, newline-bearing filenames, injected grep/find failures.
  • Workflow wiring: two-tier semantics — typographic invisibles ::warning, C0/NUL corruption ::error + exit 1, scanner failure exit 2 (no partial pass). The job runs the regression proof before every scan.
  • The seven NBSP-bearing docs the old gate never saw, fixed (carried over from fix(ci): the invisible-character gate never matched anything #734).

What this does NOT carry from #734

  • The inline python3 heredoc scanner (Python is deny-listed estate-wide).
  • The governance.yml reusable-workflow SHA bump — already stale again (standards HEAD has moved past it); re-pins are their own sweep.
  • The .hypatia-exemptions.adoc wording fix — an equivalent fix already landed on main.

Verification (local, on this branch)

  • tests/invisible-characters-test.sh → pass (10/10 fixtures detected, incl. leading BOM; blocking set exactly {NUL, backspace}; all three injected-failure controls fail closed).
  • Full-tree scan of this branch → 0 findings, both tiers.
  • Scanner vs the pre-fix doc versions from main → all flagged in the warn tier (the port detects the real defects the old gate missed).

Toolset integration map: hyperpolymath/empty-linter docs/INTEGRATION.adoc (landing separately).

🤖 Generated with Claude Code

Replace the character-mode PCRE escapes (\xc2\xa0 asks for the two
characters U+00C2 U+00A0, never present in any file) with the canonical
byte-safe two-tier scanner from rsr-template-repo (rsr#49):
scripts/check-invisible-characters.sh matches UTF-8 byte sequences under
LC_ALL=C, so typographic invisibles (NBSP, soft hyphen, zero-width/bidi,
BOM) warn while C0/NUL corruption blocks, and scanner failure refuses a
partial pass instead of going green. tests/invisible-characters-test.sh
proves the detector against fixtures that MUST trip it — including a
leading BOM — and the workflow runs that proof before every scan.

Also fixes the seven NBSP-bearing docs the old gate never saw.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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: Team

Run ID: 58820e53-453f-4e14-bb76-4ca4c13fae3b

📥 Commits

Reviewing files that changed from the base of the PR and between 0e91342 and 0026c7d.

📒 Files selected for processing (10)
  • .audittraining/path-reference-drift/TYPOLOGY.adoc
  • .audittraining/release-candidates/REPORT.adoc
  • .github/workflows/dogfood-gate.yml
  • docs/proof-debt.adoc
  • docs/proofs/HANDOVER-neural-convergence.adoc
  • docs/status/handover-2026-06-20.adoc
  • docs/tech-debt-2026-05-26.adoc
  • scripts/check-invisible-characters.sh
  • src/ui/gossamer/BURBLE-DEFERRAL.adoc
  • tests/invisible-characters-test.sh

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. (66)
  • GitHub Check: governance / Exemption ratchet
  • GitHub Check: governance / Workflow security linter
  • GitHub Check: governance / Trusted-base reduction policy
  • GitHub Check: governance / Well-Known (RFC 9116 + RSR)
  • GitHub Check: governance / Allowlist Preflight
  • GitHub Check: governance / Licence consistency
  • GitHub Check: governance / Security policy checks
  • GitHub Check: governance / Guix packaging policy (Nix retired)
  • GitHub Check: governance / Debt ratchet
  • GitHub Check: scan / shell-secrets
  • GitHub Check: scan / rust-secrets
  • GitHub Check: governance / Code quality + docs
  • GitHub Check: governance / Live Actions policy (credentialed advisory)
  • GitHub Check: governance / Check Workflow Staleness
  • GitHub Check: governance / Language / package anti-pattern policy
  • GitHub Check: scan / gitleaks
  • GitHub Check: hypatia / Hypatia Neurosymbolic Analysis
  • GitHub Check: Build AsciiDoc
  • GitHub Check: Validate Documentation
  • GitHub Check: docs
  • GitHub Check: lint
  • GitHub Check: Check
  • GitHub Check: Secret Detection (TruffleHog)
  • GitHub Check: CodeQL Analysis (actions)
  • GitHub Check: Build Test Images
  • GitHub Check: Generate SBOM
  • GitHub Check: Aspect — Rule Module Coverage
  • GitHub Check: E2E — Elixir Scanner Pipeline
  • GitHub Check: criterion + baseline gate
  • GitHub Check: Rust Dependency Audit
  • GitHub Check: E2E — Rust CLI Scan
  • GitHub Check: Secret Detection (Gitleaks)
  • GitHub Check: Rust License & Ban Check
  • GitHub Check: Container Security (Trivy) (deploy/Containerfile)
  • GitHub Check: License Compliance Check
  • GitHub Check: Generate Rust SBOM
  • GitHub Check: CodeQL SAST (actions)
  • GitHub Check: Rust License & Ban Check
  • GitHub Check: Test
  • GitHub Check: Rust Dependency Audit
  • GitHub Check: ts_check
  • GitHub Check: Secret Detection
  • GitHub Check: Cargo check + clippy + fmt
  • GitHub Check: detect-fuzz-targets
  • GitHub Check: Validate A2ML manifests
  • GitHub Check: Format
  • GitHub Check: Groove manifest check
  • GitHub Check: Validate K9 contracts
  • GitHub Check: stress-test
  • GitHub Check: Clippy
  • GitHub Check: Detect Haskell tree
  • GitHub Check: Rust Format
  • GitHub Check: k9iser manifest + build
  • GitHub Check: check
  • GitHub Check: Empty-linter (invisible characters)
  • GitHub Check: Rust Check & Clippy
  • GitHub Check: Validate Ephapax sources exist
  • GitHub Check: analyze (javascript-typescript, none)
  • GitHub Check: analyze (actions, none)
  • GitHub Check: Build AsciiDoc
  • GitHub Check: docs
  • GitHub Check: check
  • GitHub Check: Validate Documentation
  • GitHub Check: Prepare Release
  • GitHub Check: lint
  • GitHub Check: ts_check
🔇 Additional comments (10)
.audittraining/path-reference-drift/TYPOLOGY.adoc (1)

47-47: LGTM!

.audittraining/release-candidates/REPORT.adoc (1)

146-146: LGTM!

docs/proof-debt.adoc (1)

20-20: LGTM!

src/ui/gossamer/BURBLE-DEFERRAL.adoc (1)

35-35: LGTM!

docs/proofs/HANDOVER-neural-convergence.adoc (1)

61-61: LGTM!

docs/status/handover-2026-06-20.adoc (1)

73-73: LGTM!

docs/tech-debt-2026-05-26.adoc (1)

33-33: LGTM!

scripts/check-invisible-characters.sh (1)

1-70: LGTM!

tests/invisible-characters-test.sh (1)

1-93: LGTM!

.github/workflows/dogfood-gate.yml (1)

136-138: LGTM!

Also applies to: 148-150, 154-160, 162-172, 174-184, 187-187, 190-193


📝 Summary

Summary by CodeRabbit

  • New Features

    • Added a dedicated invisible-character scanner for source and documentation files.
    • The scanner identifies problematic Unicode characters and forbidden control characters, with blocking findings reported clearly in CI.
  • Bug Fixes

    • Improved CI annotations and reporting for invisible-character findings, including accurate result and blocking counts.
    • Added coverage for malformed text, invalid encodings, unusual filenames, and scanner failure conditions.
  • Documentation

    • Normalised whitespace across several documentation and audit records without changing their meaning.

Walkthrough

The change adds an invisible-character scanner, tests its detection and failure modes, and integrates it into the dogfood gate. It also replaces non-breaking spaces with regular spaces in seven documentation entries.

Changes

Invisible-character detection

Layer / File(s) Summary
Scanner implementation
scripts/check-invisible-characters.sh
Adds byte-safe scanning, filtered file enumeration, result files, blocking-character classification, and error handling.
Scanner validation
tests/invisible-characters-test.sh
Tests supported character cases, NUL-delimited paths, blocking results, and fail-closed behaviour.
CI integration
.github/workflows/dogfood-gate.yml
Runs the scanner and fixture test, publishes escaped annotations and counts, and fails on blocking findings.

Whitespace normalisation

Layer / File(s) Summary
Documentation whitespace normalisation
.audittraining/..., docs/..., src/ui/gossamer/BURBLE-DEFERRAL.adoc
Replaces non-breaking spaces with regular spaces without changing text meaning.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 0026c

The scanner, tests, and CI integration correctly detect the intended invisible characters without an outstanding actionable risk.

Sequence Diagram(s)

sequenceDiagram
  participant DogfoodGate as dogfood-gate.yml
  participant Scanner as check-invisible-characters.sh
  participant Results as result files
  participant GitHub as GitHub annotations
  DogfoodGate->>Scanner: Scan repository files
  Scanner->>Results: Write findings and blocking findings
  DogfoodGate->>GitHub: Publish escaped findings and counts
  DogfoodGate->>DogfoodGate: Fail on blocking findings
Loading

Poem

A rabbit scans each file,
Invisible marks appear,
The gate records each finding,
Blocking bytes trigger failure,
Clean spaces cross the page,
Tidy documents remain.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the CI scanner replacement, regression tests, workflow behaviour, and documentation fixes. It matches the changeset.
Title check ✅ Passed The title accurately identifies the main change: fixing the CI invisible-character gate so that it detects matches.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (8 skipped: 8 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • 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.

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