Skip to content

🔧 fix: Replace Literal NUL Bytes in handlers.spec Test Fixture + Normalize CRLF#12852

Merged
danny-avila merged 1 commit into
devfrom
claude/read-file-followups
Apr 28, 2026
Merged

🔧 fix: Replace Literal NUL Bytes in handlers.spec Test Fixture + Normalize CRLF#12852
danny-avila merged 1 commit into
devfrom
claude/read-file-followups

Conversation

@danny-avila

Copy link
Copy Markdown
Owner

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 \x00 bytes directly in the source string:

const binaryWithNul = '<3 NULs>\rIHDR<2 NULs>\x04';

Embedding NUL bytes in source files breaks editors, linters, ts-loader, and most git tooling — grep even classifies the file as binary. Replaced with \x00 escape 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\n from git's core.autocrlf=true checkout conversion, then committed with CRLF endings. The diff against dev showed 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:

  • CRLF → LF (mechanical, line-ending normalization)
  • the single binaryWithNul literal → escape-sequence rewrite

No semantic test changes.

Test plan

  • npx jest src/agents/handlers.spec.ts — 39/39 pass (unchanged behavior)
  • No NUL bytes remain in the file (verified)
  • No CRLF line endings remain in the file (verified)

…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).
Copilot AI review requested due to automatic review settings April 28, 2026 01:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the binaryWithNul fixture string with \x00 escape sequences (runtime value preserved).
  • Normalized packages/api/src/agents/handlers.spec.ts line endings from CRLF to LF (mechanical change).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown
Contributor

GitNexus: 🚀 deployed

The LibreChat-pr-12852 index is now live on the MCP server.
Deploy run

@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@danny-avila danny-avila merged commit 7070eb7 into dev Apr 28, 2026
13 checks passed
@danny-avila danny-avila deleted the claude/read-file-followups branch April 28, 2026 02:20
fuuuzzy pushed a commit to fuuuzzy/LibreChat that referenced this pull request May 3, 2026
…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).
jcbartle pushed a commit to jcbartle/LibreChat that referenced this pull request May 11, 2026
…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).
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.

2 participants