Skip to content

fix(analytics): report errors from every request batch in track_batch/import_batch - #296

Open
RaphaelFakhri wants to merge 1 commit into
mixpanel:masterfrom
RaphaelFakhri:fix/batch-errors-across-request-batches
Open

RaphaelFakhri wants to merge 1 commit into
mixpanel:masterfrom
RaphaelFakhri:fix/batch-errors-across-request-batches

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Summary

track_batch and import_batch split the events into request batches when max_concurrent_requests is set, or when max_batch_size is greater than 50. Each request batch reported its errors to the next step, but only the last request batch's errors reached the user callback. A failure in an earlier request batch was dropped, and the callback could receive null even though events were rejected.

This change collects the errors from every request batch and passes the combined list to the callback. The callback still receives null when every request succeeds, so the existing contract is unchanged.

The results argument still comes from the last request batch, as before. Its entries are always undefined, so this change leaves it alone to keep the diff small.

Testing

  • Added passes errors from every request batch to callback to test/track.js (max_concurrent_requests: 1) and test/import.js (max_batch_size: 100). In each test the first request fails and the rest succeed.
  • Without the fix, both tests fail because the callback receives null. With the fix, both pass.
  • npm test: 489 + 56 tests pass. npm run lint and npm run check-format are clean (the one existing lint warning is in the openfeature package tests).

Fixes #295

@RaphaelFakhri
RaphaelFakhri requested review from a team and rahul-mixpanel October 22, 2026 12:12

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.

track_batch and import_batch drop errors from earlier request batches

1 participant