Skip to content

test(browser): migrate trace lifecycle and span API tests to streaming - #24881

Open
msonnb wants to merge 5 commits into
developfrom
ms/browser-tests-trace-semantics
Open

msonnb wants to merge 5 commits into
developfrom
ms/browser-tests-trace-semantics

Conversation

@msonnb

@msonnb msonnb commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Run the browser trace lifecycle and public span API tests with default span streaming, asserting across envelopes as roots and children are sent independently. Retain the existing transaction counterparts as explicitly pinned *-static suites so both lifecycles keep regression coverage for sampling, propagation, linking, and span APIs.

Cover circular attributes in both lifecycles: streamed spans drop unsupported objects while preserving primitive attributes, and static transactions retain circular-reference normalization. Filter feedback waits by envelope type so unrelated span envelopes cannot satisfy them.

Keep public-api/startSpan/setMeasurement on the static lifecycle because the legacy measurement API has no span v2 representation.

Fixes #24144

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.8 kB - -
@sentry/browser - with treeshaking flags 27.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.84 kB - -
@sentry/browser (incl. Tracing) 51.85 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.87 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.8 kB - -
@sentry/browser (incl. Tracing, Replay) 91.58 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.45 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.29 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.27 kB - -
@sentry/browser (incl. Feedback) 47.32 kB - -
@sentry/browser (incl. sendFeedback) 34.84 kB - -
@sentry/browser (incl. FeedbackAsync) 39.95 kB - -
@sentry/browser (incl. Metrics) 30.82 kB - -
@sentry/browser (incl. Logs) 31.11 kB - -
@sentry/browser (incl. Metrics & Logs) 31.75 kB - -
@sentry/react 31.63 kB - -
@sentry/react (incl. Tracing) 54.17 kB - -
@sentry/vue 37.84 kB - -
@sentry/vue (incl. Tracing) 54.78 kB - -
@sentry/svelte 29.83 kB - -
@sentry/remix (Remix 3 client bundle) 56.83 kB - -
CDN Bundle 31.53 kB - -
CDN Bundle (incl. Tracing) 52.34 kB - -
CDN Bundle (incl. Logs, Metrics) 33.72 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.3 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.65 kB - -
CDN Bundle (incl. Tracing, Replay) 90.01 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.15 kB - -
CDN Bundle - uncompressed 92.92 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.46 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.41 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.5 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.63 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.57 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.26 kB - -
@sentry/nextjs (client) 56.53 kB - -
@sentry/sveltekit (client) 52.23 kB - -
@sentry/core/server 40.86 kB - -
@sentry/core/browser 13.71 kB - -
@sentry/node 150.99 kB +0.01% +7 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.59 kB - -
@sentry/node - without tracing 94.01 kB +0.01% +5 B 🔺
@sentry/node - without channel injection 129.16 kB +0.02% +13 B 🔺
@sentry/aws-serverless 102.17 kB +0.01% +7 B 🔺
@sentry/cloudflare (withSentry) - minified 209.81 kB - -
@sentry/cloudflare (withSentry) 520.23 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 227.48 kB - -

View base workflow run

@msonnb
msonnb added this pull request to stack #24891 September 30, 2026 12:22
@msonnb
msonnb force-pushed the ms/browser-tests-trace-semantics branch 2 times, most recently from f68643a to 9a5304f Compare October 5, 2026 09:10
@msonnb msonnb changed the title test(browser): port trace semantics to span streaming test(browser): migrate trace lifecycle and span API tests to streaming Oct 5, 2026
@msonnb
msonnb force-pushed the ms/browser-tests-trace-semantics branch 2 times, most recently from f69e94d to 3ac6356 Compare October 7, 2026 11:27
@msonnb
msonnb marked this pull request as ready for review October 7, 2026 12:30
@msonnb
msonnb requested a review from a team as a code owner October 7, 2026 12:30
@msonnb
msonnb requested review from Lms24 and logaretm and removed request for a team October 7, 2026 12:30

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@logaretm logaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust your judgement and the passing tests 😆

@@ -1,121 +1,68 @@
sentryTest('creates a new trace for a navigation after the initial pageload', async ({ getLocalTestUrl, page }) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: should be placed beneath the import statements

shouldSkipTracingTest,
} from '../../../../utils/helpers';

sentryTest('creates a new trace and sample_rand on each navigation', async ({ getLocalTestUrl, page }) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: should be placed beneath the import statements


const pageloadSpan = await pageloadSpanPromise;

page.goto(`${url}#foo`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l/m: should this be awaited?

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
integrations: [Sentry.spanStreamingIntegration()],
integrations: [],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-l: we can just delete this instead of passing the empty array

traceLifecycle: 'static',
dsn: 'https://public@dsn.ingest.sentry.io/1337',
integrations: [Sentry.spanStreamingIntegration()],
integrations: [],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-l: here as well

`${url}#foo`,
eventAndTraceHeaderRequestParser,
);
const [pageloadEvent, pageloadTraceHeader] = await waitForStreamedSpanAndTraceHeaderOnUrl(page, url);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-l: the "event" in the variable name here doesn't make much sense anymore. We should probably just call the spans we get here pageloadSpan (and so on)

edit: looks like these naming patterns should be adusted in all the trace-lifetime tests

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: why was this test removed? this should still be reported in static trace lifecycle mode, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, must have slipped through when restoring the -static tests. i put it back.

Comment on lines +31 to +32
const pageloadTraceContext = pageloadEvent;
const navigationTraceContext = navigationEvent;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: once renamed, we can also get rid of this, since we just assert on the span here.

import { shouldSkipTracingTest } from '../../../utils/helpers';
import { collectStreamedSpans, waitForStreamedSpan } from '../../../utils/spanUtils';

sentryTest('streams all children without the static 1000-span limit', async ({ getLocalTestUrl, page }) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: I think we miss the counterpart for transactions here where we should still check for the 1k limit

msonnb and others added 5 commits October 9, 2026 10:44
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
@msonnb
msonnb force-pushed the ms/browser-tests-trace-semantics branch from 8501cd6 to d474bba Compare October 9, 2026 08:49

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d474bba. Configure here.

expect(childSpan_4_1.links).toBe(undefined);

expect(childSpan_4_2.description).toBe('childSpan4.2');
expect(childSpan_4_2.name).toBe('childSpan4.2');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Child span checks race envelopes

Medium Severity

linking-addLinks and linking-spanOptions only wait for root spans, then read children from collectStreamedSpans. Roots and children leave in separate envelopes, so childSpan4.1, childSpan4.2, and childSpan3.1 can still be missing, and the empty-child checks can pass before later envelopes arrive. This was flagged because the testing-conventions rule calls out this kind of multi-request race.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit d474bba. Configure here.

expect(spans.some(span => span.description === 'take-me')).toBe(true);
expect(spans.some(span => span.description?.includes('ignore-me'))).toBe(false);
expect(spans.some(span => span.name === 'take-me')).toBe(true);
expect(spans.some(span => span.name?.includes('ignore-me'))).toBe(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignored spans checked before they end

Medium Severity

The streaming ignoreSpans test treats a missing ignore-me name in collectStreamedSpans as proof the span was dropped. ignore-me and ignore-me-too are still open when the shortened pageload span is emitted, so the absence check can pass before those spans end and get sent. This was flagged because the testing-conventions rule calls out waits that are not tied to the telemetry under assertion.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit d474bba. Configure here.

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.

browser-integration-tests: port trace semantics suites to span streaming

3 participants