Skip to content

fix(core): build chunk() batches by appending and reset size per chunk - #1346

Open
sunitaprajapati89 wants to merge 2 commits into
masterfrom
fix/chunk-sparse-array
Open

sunitaprajapati89 wants to merge 2 commits into
masterfrom
fix/chunk-sparse-array

Conversation

@sunitaprajapati89

Copy link
Copy Markdown
Contributor

Summary

  • `chunk()` assigned into an index, so when the first item alone was >= `maxKB` it left a hole at `chunks[0]`. Since 2.23.0, `aggregateErrors` iterates results with `for...of`, which throws on the resulting `undefined`, so every flush failed and the queue never drained.
  • `rollingKBSize` was never reset per chunk, so once exceeded every remaining item became its own batch (e.g. 1200 ~1KB events produced 700 requests instead of 3).
  • `chunk()` now appends, always returns a dense array, resets the size accumulator per chunk, and isolates an oversized item in its own batch.

Test plan

  • Added tests for oversized first item (dense result) and count limit reachable after size reset
  • `jest` for `util` and `plugins` suites passes

🤖 Generated with Claude Code

Sunita Prajapati and others added 2 commits November 2, 2026 12:01
chunk() assigned into an index, so an oversized first item left a hole at
chunks[0] that made aggregateErrors throw on every flush. The rolling KB
accumulator was also never reset, so once exceeded every remaining item
became its own batch.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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