Skip to content

Commit eadbea5

Browse files
committed
fix(lint): spell the dedup key's NUL separator as a backslash-u-0000 escape, not a raw byte (#4763)
`check:nul-bytes` was red: `validate-null-guards.ts` carried a literal 0x00 at byte offset 10987, inside the composite dedup key. Byte-identical at runtime -- this is purely how the character is spelled in source. It is not cosmetic. A raw NUL makes grep/ripgrep classify the whole file as binary and silently return ZERO matches, so the file drops out of code search and out of every grep-based lint. git does not warn, because it only inspects the first 8000 bytes to decide binary-ness and this one sits past that. A new gate whose own source is invisible to code search is a bad way to start. The unicode escape rather than the octal one, matching `packages/rest/src/rest-server.ts:1065`: the octal form becomes a legacy-escape error the moment a digit follows it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018iARDqtrhQgz6fVHDeDkbQ
1 parent 8e69fef commit eadbea5

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/lint/src/validate-null-guards.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,15 @@ export function findUnguardedNullableOperands(
286286
if (!f) return;
287287
if (!opts.nullableFields.has(f.field)) return;
288288
if (guards.has(f.operand)) return;
289-
const key = `${f.operand}${operator}`;
289+
// NUL separates the composite key's two halves (it can appear in neither a
290+
// field path nor an operator). Written as the `\u0000` ESCAPE, never as a raw
291+
// byte: a raw NUL makes grep/ripgrep treat the whole file as binary and
292+
// silently return ZERO matches, so the file drops out of code search and out
293+
// of every grep-based lint - and git will not warn you, because it only
294+
// inspects the first 8000 bytes to decide binary-ness. Same convention as
295+
// `packages/rest/src/rest-server.ts`. `\u0000` rather than `\0`, which turns
296+
// into a legacy-octal-escape error the moment a digit follows it.
297+
const key = `${f.operand}\u0000${operator}`;
290298
if (seen.has(key)) return;
291299
seen.add(key);
292300
findings.push({

0 commit comments

Comments
 (0)