Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The reported bug is addressed with comprehensive regression coverage and no unresolved blocking issues.
Pull request overview
Fixes CRLF detection when \r and \n arrive in separate chunks.
Changes:
- Defers processing of trailing CR bytes.
- Adds comprehensive chunk-boundary and edge-case tests.
- Fixes
sanitizeHeaderformatting.
File summaries
| File | Description |
|---|---|
test/newline-chunks.test.js |
Adds regression and boundary tests. |
index.js |
Implements deferred CR handling and formatting fix. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains:
Breaking Changes?
If yes, please describe the breakage.
Please Describe Your Changes
When the first CRLF is split across chunks, newline detection treats the trailing CR as a standalone separator before the LF arrives. The example in #234 consequently produces an extra record and leading LF characters in values.
Defer this decision until the next chunk, revisiting the pending CR without counting it twice towards maxRowBytes. Preserve existing EOF handling, custom newline behavior, and quoted content.
Add nine tests covering the reported split, representative boundaries and byte-by-byte input, empty chunks, standalone CR, EOF, custom newlines, quoted CRLF, skipped lines/comments, byte offsets, and row-size limits. Also fix the pre-existing missing space in the sanitizeHeader declaration so ESLint passes.
Validation on Windows with Node 24.19.0: all 50 AVA tests passed, plus tsd and ESLint. The existing shell-based CLI test used the installed PowerShell as ComSpec; no tests were skipped or changed to accommodate Windows. Fixtures were checked using their original repository bytes.
Fixes #234.
Hosted CI and other Node versions have not been verified; the results above are local validation.