🔧 fix: Replace Literal NUL Bytes in handlers.spec Test Fixture + Normalize CRLF#12852
Conversation
…dex P3, copilot review)
Two test-file hygiene fixes:
1. **Literal NUL bytes**. The `'rejects binary content (NUL bytes)
post-fetch'` test embedded raw `\x00` bytes directly in the source
string (`const binaryWithNul = '<3 NULs>\rIHDR<2 NULs>\x04'`).
Embedding NULs in source files breaks editors, linters, ts-loader,
and most git tooling — `grep` even classifies the file as binary
("Binary file matches"). Replace with `\x00` escape sequences in the
string literal so the source is plain ASCII while the runtime string
value is unchanged.
2. **CRLF line endings**. My earlier commits to this file picked up
Windows-style `\r\n` from git's `core.autocrlf=true` checkout
conversion, then staged them as `\r\n`. The diff against `dev`
showed the entire file as changed even though only a few lines were
touched semantically. Normalize the whole file back to LF so future
diffs read clean.
The diff for this commit is large (~1248 lines marked changed) but
every change is one of: CRLF → LF, or the single `binaryWithNul`
escape-sequence rewrite. No semantic test changes.
Tests: 39/39 pass (unchanged behavior).
There was a problem hiding this comment.
Pull request overview
Cleans up a Jest test fixture in handlers.spec.ts by removing literal NUL bytes (replacing them with \x00 escape sequences) and normalizing the file’s line endings back to LF to avoid “entire file changed” diffs and tooling/editor issues.
Changes:
- Replaced embedded literal NUL (
\x00) bytes in thebinaryWithNulfixture string with\x00escape sequences (runtime value preserved). - Normalized
packages/api/src/agents/handlers.spec.tsline endings from CRLF to LF (mechanical change).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GitNexus: 🚀 deployedThe |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…alize CRLF (danny-avila#12852) Two test-file hygiene fixes: 1. **Literal NUL bytes**. The `'rejects binary content (NUL bytes) post-fetch'` test embedded raw `\x00` bytes directly in the source string (`const binaryWithNul = '<3 NULs>\rIHDR<2 NULs>\x04'`). Embedding NULs in source files breaks editors, linters, ts-loader, and most git tooling — `grep` even classifies the file as binary ("Binary file matches"). Replace with `\x00` escape sequences in the string literal so the source is plain ASCII while the runtime string value is unchanged. 2. **CRLF line endings**. My earlier commits to this file picked up Windows-style `\r\n` from git's `core.autocrlf=true` checkout conversion, then staged them as `\r\n`. The diff against `dev` showed the entire file as changed even though only a few lines were touched semantically. Normalize the whole file back to LF so future diffs read clean. The diff for this commit is large (~1248 lines marked changed) but every change is one of: CRLF → LF, or the single `binaryWithNul` escape-sequence rewrite. No semantic test changes. Tests: 39/39 pass (unchanged behavior).
…alize CRLF (danny-avila#12852) Two test-file hygiene fixes: 1. **Literal NUL bytes**. The `'rejects binary content (NUL bytes) post-fetch'` test embedded raw `\x00` bytes directly in the source string (`const binaryWithNul = '<3 NULs>\rIHDR<2 NULs>\x04'`). Embedding NULs in source files breaks editors, linters, ts-loader, and most git tooling — `grep` even classifies the file as binary ("Binary file matches"). Replace with `\x00` escape sequences in the string literal so the source is plain ASCII while the runtime string value is unchanged. 2. **CRLF line endings**. My earlier commits to this file picked up Windows-style `\r\n` from git's `core.autocrlf=true` checkout conversion, then staged them as `\r\n`. The diff against `dev` showed the entire file as changed even though only a few lines were touched semantically. Normalize the whole file back to LF so future diffs read clean. The diff for this commit is large (~1248 lines marked changed) but every change is one of: CRLF → LF, or the single `binaryWithNul` escape-sequence rewrite. No semantic test changes. Tests: 39/39 pass (unchanged behavior).
Follow-up to #12851 (already merged) — two test-file hygiene fixes Codex (P3) and Copilot flagged but didn't make the merge:
1. Literal NUL bytes in test fixture
The
'rejects binary content (NUL bytes) post-fetch'test embedded raw\x00bytes directly in the source string:Embedding NUL bytes in source files breaks editors, linters, ts-loader, and most git tooling —
grepeven classifies the file as binary. Replaced with\x00escape sequences in the literal so the source is plain ASCII while the runtime string value is unchanged. Test continues to pass.2. CRLF line endings
Earlier commits to this file picked up Windows-style
\r\nfrom git'score.autocrlf=truecheckout conversion, then committed with CRLF endings. The diff againstdevshowed the entire file as changed even though only a few lines were touched semantically. Normalized the whole file back to LF.Diff size
The diff for this PR is large (~1248 lines marked changed) but every change is one of:
binaryWithNulliteral → escape-sequence rewriteNo semantic test changes.
Test plan
npx jest src/agents/handlers.spec.ts— 39/39 pass (unchanged behavior)