Skip to content

fix(core): resolve sparse array and rolling size accumulator regressions in event chunking (#1309) - #1319

Open
Mohitingale13 wants to merge 1 commit into
segmentio:masterfrom
Mohitingale13:fix/event-chunking-regressions-1309
Open

fix(core): resolve sparse array and rolling size accumulator regressions in event chunking (#1309)#1319
Mohitingale13 wants to merge 1 commit into
segmentio:masterfrom
Mohitingale13:fix/event-chunking-regressions-1309

Conversation

@Mohitingale13

Copy link
Copy Markdown

What does this PR change?

Fixes two batching regressions in chunk() that can stall event flushing and fragment event batches.

Changes

  • Prevents sparse array holes when an oversized event is the first item in a batch.
  • Resets the rolling payload-size accumulator when starting a new batch.
  • Adds regression coverage for oversized events, consecutive oversized events, oversized events between normal events, and exact maxKB boundaries.
  • Adds an integration regression test covering the SegmentDestination flush path when encountering an oversized initial event.

Verification

  • Targeted tests: 70 passed across util.test.ts and SegmentDestination.test.ts
  • Full test suite: 70 test suites / 510 tests passed
  • TypeScript typecheck: 0 errors
  • ESLint: 0 errors
  • Full build: passed

Closes #1309

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.

chunk() returns a sparse array when one event exceeds maxKB, stalling the event queue (regression in 2.23.0)

1 participant