test(node-core): Fix minute-boundary race in session-aggregate tests#20437
Merged
nicohrubec merged 1 commit intodevelopfrom Apr 22, 2026
Merged
test(node-core): Fix minute-boundary race in session-aggregate tests#20437nicohrubec merged 1 commit intodevelopfrom
nicohrubec merged 1 commit intodevelopfrom
Conversation
The SDK buckets session counts by minute-rounded timestamp (see
`packages/node-core/src/integrations/http/httpServerIntegration.ts`
lines 290-292). When the test's sequential requests straddle a minute
boundary, the emitted payload splits across two aggregate buckets and
the existing `aggregates: [{...}]` assertion fails — a pure timing
race, not a code bug.
Replace the hard-coded single-bucket assertion with an inline reduce
that sums `exited`/`errored`/`crashed` across all returned buckets
and asserts on the totals, matching the SDK's real behaviour.
Applies to all 5 session-aggregate integration tests (2 in node-core,
3 in node). Two of them already flake (#20283, #20436); the other
three share the same pattern and are preventively fixed.
Closes #20283
Closes #20436
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
size-limit report 📦
|
s1gr1d
approved these changes
Apr 22, 2026
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.
The SDK buckets sessions by minute-rounded timestamp. When a test's sequential requests run across a minute boundary, the payload splits across two
aggregatesbuckets and the existing single-bucket assertion fails. To resolve this, this PR replaces the single bucket check with a sum across all returned buckets to ensure the total count is correct even if events are split across buckets.The same pattern exists in our
node-coreandnodeintegration tests.Closes #20283
Closes #20436