test(e2e): Group collectStreamedSpans by trace - #23912
Merged
Merged
Conversation
It accumulated every span envelope into a single array, so a test asserting on one request's children could mix in spans from an earlier page load's trace, or have its wait satisfied by them. Spans are bucketed per trace now and the predicate sees one trace at a time, so it resolves with a coherent set. Every trace is evaluated as a candidate, so a leftover trace that never satisfies the predicate cannot hold up the one that does. Note this scopes a result to a single trace, it does not identify which trace: when several tests exercise the same route, the predicate still has to name something unique to the request under test. Also re-exports `SerializedStreamedSpan`, which specs need to type their span helpers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
size-limit report 📦
|
chargome
approved these changes
Sep 2, 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.
What
Groups the spans
collectStreamedSpansaccumulates by trace, so its predicate sees one trace at a time instead of a flat pile, and it resolves with only that trace's spans. Also re-exportsSerializedStreamedSpanso specs can type their span helpers.Why
Spans are buffered per trace and flushed on a timer, so a previous test's spans can still be arriving when the next one starts collecting. A test asserting on one request's children could therefore mix in an earlier page load's spans, or have its wait satisfied by them before its own spans arrived. Every trace is evaluated as a candidate, so a leftover trace that never satisfies the predicate cannot hold up the one that does.
Note this scopes a result to a single trace, it does not identify which trace: when several tests exercise the same route, the predicate still has to name something unique to the request under test.
Split out of the React Router porting stack because it is useful on its own, and other span streaming ports can drop their hand-rolled
trace_idfiltering once it lands.