Skip to content

Commit eaa7168

Browse files
committed
fix(ci): enforce C0/NUL corruption in-step; warn on invisible Unicode
Second layer of the empty-linter fix, scoped by an owner ruling after a census. DETECTION (layer 1, earlier commit on this branch) sees everything the pattern covers. ENFORCEMENT (this commit) distinguishes two classes: BLOCKING C0 control characters and NUL. Never legitimate; proven damage - a backspace byte made a workflow unloadable (it never ran once), and LaTeX maths in wiki files was silently mangled where a generation step turned backslash-b commands into backspaces. ADVISORY NBSP, BOM, zero-width marks. A gate-lens census found ~2,100 first-party files carry these as legitimate typography in prose; blocking would fail 2,333 files estate-wide for no safety gain. Enforcement lives INSIDE the scan step: if the scanner crashes, the step fails the job directly, so empty counts can never drift into a separate check that passes silently (review finding). The blocking count re-greps only the files the full pattern already flagged, so the find expression is not duplicated and cannot drift. 1 file(s). YAML re-parsed per edit; reverted on any mis-apply.
1 parent a69de22 commit eaa7168

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

.github/workflows/dogfood-gate.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,41 @@ jobs:
147147
echo "exit_code=$EL_EXIT" >> "$GITHUB_OUTPUT"
148148
echo "ready=true" >> "$GITHUB_OUTPUT"
149149
150+
# Blocking subset: C0 controls and NUL only (owner ruling 2026-08-28).
151+
# Invisible Unicode (NBSP/BOM/zero-width) stays ADVISORY - about 2,100
152+
# estate files carry it as legitimate typography in prose.
153+
blocking=0
154+
while IFS= read -r bf; do
155+
[ -z "$bf" ] && continue
156+
if grep -qaP '\x00|[\x01-\x08\x0B\x0C\x0E-\x1F]' "$bf"; then
157+
blocking=$((blocking+1))
158+
echo "::error file=${bf#$GITHUB_WORKSPACE/}::C0 control characters or NUL bytes - file corruption, blocks the gate"
159+
fi
160+
done < /tmp/empty-lint-results.txt
161+
echo "blocking=$blocking" >> "$GITHUB_OUTPUT"
162+
150163
# Emit annotations for each file with invisible chars
151164
while IFS= read -r filepath; do
152165
[ -z "$filepath" ] && continue
153166
REL_PATH="${filepath#$GITHUB_WORKSPACE/}"
154167
echo "::warning file=${REL_PATH}::Invisible Unicode characters detected (zero-width space, BOM, NBSP, etc.)"
155168
done < /tmp/empty-lint-results.txt
156169
170+
# Enforce (owner ruling 2026-08-28): C0/NUL corruption BLOCKS; other
171+
# invisible Unicode stays advisory. Enforcement lives inside this step
172+
# so a crash above fails the job directly - counts can never arrive
173+
# empty into a separate check that then passes silently.
174+
if [ "$EL_EXIT" -ne 0 ]; then
175+
echo "::warning::invisible-character scan exited $EL_EXIT - results may be incomplete"
176+
fi
177+
if [ "${blocking:-0}" -gt 0 ]; then
178+
echo "## Empty-linter: BLOCKED - $blocking file(s) with C0/NUL corruption" >> "$GITHUB_STEP_SUMMARY"
179+
echo "::error::$blocking file(s) contain C0 control characters or NUL bytes - corruption, not typography. See file annotations."
180+
exit 1
181+
elif [ "${FINDINGS:-0}" -gt 0 ]; then
182+
echo "::notice::$FINDINGS file(s) carry invisible Unicode (NBSP/BOM/zero-width) - advisory only"
183+
fi
184+
157185
- name: Write summary
158186
run: |
159187
if [ "${{ steps.lint.outputs.ready }}" = "true" ]; then

0 commit comments

Comments
 (0)