Repository navigation
fix(csv-generate): consume fixed-size buffered remainders once - #555
Merged
wdavidw merged 1 commit intoNov 3, 2026
Merged
Conversation
Drain oversized remainders before generating more records and clear consumed buffered text. Add sync, stream and callback regression tests. AI assistance: implemented and tested with OpenAI Codex.
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.
fixed_sizecan duplicate or drop generated text when a record leaves a remainder larger than the next read size. Even a single record is affected:The same options with three records currently produce
"abcc\nabc\nabc"instead of"abc\nabc\nabc". This also affects the stream and callback APIs, including custom columns longer than ordinary chunk sizes.Drain oversized buffered remainders before generating another record, and clear a remainder when transferring it into the current output. This prevents negative split offsets and repeated final suffixes. The patch keeps the existing character-based sizing and encoding behavior. Generated distributions were rebuilt and checked, and are left to the release build process.
Found by code inspection and independently reproduced on master
9fabcbe, csv-generate 4.6.2. No matching issue or PR found in searches for fixed-size generation,fixedSize,fixed_sizeandfixed_size_buffer. This concerns text-mode remainder consumption; #522 concerns object-mode generation.Validation on Linux / Node.js v24.22.1:
test/options.fixed_size.jspass afterward. Covers sync, async stream iteration, callback, several chunk sizes and custom delimiter/EOF output.npm ci: passed, including the normal Husky setup.npm test: passed for all 14 workspaces; 1,101 tests passing and five existing tests pending. TypeScript checks pass.npm run build: passed for all seven build projects.npm run lint:check: zero errors, five existing pending-test warnings.npm run lint:stagedand commitlint passed. The test file passes Prettier. The existingwhile(true){formatting inread.jsfails a standalone Prettier check on both the untouched base and this patch; left unchanged.git diff --cached --check: passed.