6885a217cd
Adversarial review with per-package counts and 13 reintroduced bugs, all caught. Fixes from the review: the trace geocell is capped at 6 characters (~1 km; 16 allowed centimetres), one forbidden-word hit per place, and an e2e guard that meta charset stays within the first 1024 bytes. CLAUDE.md §6.2 no longer contradicts itself about care acts; §2 and §3 say what Phase 0 actually built.
23 lines
1.3 KiB
Markdown
23 lines
1.3 KiB
Markdown
# Code
|
|
|
|
## An agent's write tool can turn `\u00a0` into a real non-breaking space
|
|
|
|
**What happened.** `packages/content/src/copy-lint.ts` was written with the regex
|
|
`[\s\u00a0]`. On disk the file held `[\s` + the bytes `C2 A0` + `]`: an actual U+00A0.
|
|
ESLint's `no-irregular-whitespace` caught it. Fixing it with `sed`, then with a
|
|
`node -e` replace, then with a quoted heredoc each wrote the same character back. The
|
|
fix that worked built both strings from char codes (`String.fromCharCode(160)`,
|
|
`String.fromCharCode(92) + 'u00a0'`).
|
|
|
|
**Why it bit.** Somewhere between the agent and the file, a single-backslash
|
|
`\uXXXX` in the input was decoded. A double-backslash `\\u00a0` inside a JS string
|
|
(`forbidden.ts`) survived. The bug is invisible on screen: the two forms look the same.
|
|
|
|
**How to apply it.** Prefer `\s` or a named class over a literal Unicode escape in a
|
|
regex. When one is needed, check the bytes after writing.
|
|
This entry was itself written with two literal NBSPs where it named the escape, and was
|
|
fixed the same way. Check with `grep -n $'\xc2\xa0' file` (the two UTF-8 bytes) or
|
|
`sed -n Np file | od -c`. Do not use `grep -P '\xA0'`: it matches the last byte of `≠`
|
|
and other characters, and raised a false alarm on the review document. Keep
|
|
`no-irregular-whitespace` on.
|