Skip to content

test(e2e): Port the create-remix-app-express E2E app to span streaming - #24061

Merged
andreiborza merged 5 commits into
developfrom
ab/e2e-create-remix-app-express-streaming
Sep 4, 2026
Merged

test(e2e): Port the create-remix-app-express E2E app to span streaming#24061
andreiborza merged 5 commits into
developfrom
ab/e2e-create-remix-app-express-streaming

Conversation

@andreiborza

Copy link
Copy Markdown
Member

What

Removes the traceLifecycle: 'static' pin from the client entry and the server instrument file, and rewrites the transaction specs as streamed span specs.

Two tests could no longer be written the way they were, because scope tags do not reach streamed spans:

  • The server/client link is now proven through the sentry-trace meta tag, or through a unique URL path where the ErrorBoundary replaces the document and there is no meta tag.
  • The scope-bleed route now emits a message so its isolation scope's tags stay observable.

Why

Span streaming is the default, so the default E2E suite should exercise it.

Ref: #23807

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 28.69 kB - -
@sentry/browser - with treeshaking flags 26.99 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.89 kB - -
@sentry/browser (incl. Tracing) 49.07 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 49.07 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.98 kB - -
@sentry/browser (incl. Tracing, Replay) 88.62 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.85 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.3 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106.24 kB - -
@sentry/browser (incl. Feedback) 46.17 kB - -
@sentry/browser (incl. sendFeedback) 33.75 kB - -
@sentry/browser (incl. FeedbackAsync) 38.85 kB - -
@sentry/browser (incl. Metrics) 29.66 kB - -
@sentry/browser (incl. Logs) 29.94 kB - -
@sentry/browser (incl. Metrics & Logs) 30.59 kB - -
@sentry/react 30.45 kB - -
@sentry/react (incl. Tracing) 51.28 kB - -
@sentry/vue 35.91 kB - -
@sentry/vue (incl. Tracing) 51.34 kB - -
@sentry/svelte 28.71 kB - -
CDN Bundle 30.43 kB - -
CDN Bundle (incl. Tracing) 49.6 kB - -
CDN Bundle (incl. Logs, Metrics) 32.66 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.53 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.31 kB - -
CDN Bundle (incl. Tracing, Replay) 87.15 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.02 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 93.08 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.03 kB - -
CDN Bundle - uncompressed 90.13 kB - -
CDN Bundle (incl. Tracing) - uncompressed 147.81 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.52 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.59 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.82 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.44 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.21 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.15 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.9 kB - -
@sentry/nextjs (client) 53.89 kB - -
@sentry/sveltekit (client) 49.51 kB - -
@sentry/core/server 40.96 kB - -
@sentry/core/browser 13.53 kB - -
@sentry/node 124.76 kB +0.02% +20 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.51 kB - -
@sentry/node - without tracing 88.5 kB +0.03% +23 B 🔺
@sentry/node - without channel injection 104.08 kB +0.02% +17 B 🔺
@sentry/aws-serverless 96.87 kB +0.03% +24 B 🔺
@sentry/cloudflare (withSentry) - minified 201.56 kB - -
@sentry/cloudflare (withSentry) 501.37 kB - -

View base workflow run

@andreiborza
andreiborza marked this pull request as ready for review September 4, 2026 11:13
@andreiborza
andreiborza requested review from msonnb and s1gr1d September 4, 2026 11:13
@andreiborza
andreiborza force-pushed the ab/e2e-create-remix-app-express-streaming branch from e527fb1 to 7f70cc4 Compare September 4, 2026 12:06

@Lms24 Lms24 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.

two suggestions but not blocjers

Comment on lines +78 to +99
// Streamed spans are buffered before they flush, so spans from an earlier page load can still be
// arriving here.
const streamedSpans: SerializedStreamedSpan[] = [];
void waitForStreamedSpans(APP_NAME, spans => {
streamedSpans.push(...spans);
return false;
});

const pageLoadTransactionPromise = waitForTransaction('create-remix-app-express', transactionEvent => {
return transactionEvent.contexts?.trace?.op === 'pageload' && transactionEvent.tags?.['sentry_test'] === testTag;
});

page.goto(`/client-error?tag=${testTag}`);

const pageloadTransaction = await pageLoadTransactionPromise;
const httpServerTransaction = await httpServerTransactionPromise;

expect(pageloadTransaction).toBeDefined();
expect(httpServerTransaction).toBeDefined();

const httpServerTraceId = httpServerTransaction.contexts?.trace?.trace_id;
const httpServerSpanId = httpServerTransaction.contexts?.trace?.span_id;
const loaderSpanId = httpServerTransaction?.spans?.find(
span => span.data && span.data['code.function.name'] === 'loader',
)?.span_id;

const pageLoadTraceId = pageloadTransaction.contexts?.trace?.trace_id;
const pageLoadSpanId = pageloadTransaction.contexts?.trace?.span_id;
const pageLoadParentSpanId = pageloadTransaction.contexts?.trace?.parent_span_id;

expect(httpServerTransaction.transaction).toBe('GET client-error');
expect(pageloadTransaction.transaction).toBe('/client-error');

expect(httpServerTraceId).toBeDefined();
expect(httpServerSpanId).toBeDefined();

expect(pageLoadTraceId).toEqual(httpServerTraceId);
expect(pageLoadParentSpanId).toEqual(loaderSpanId);
expect(pageLoadSpanId).not.toEqual(httpServerSpanId);
// The ErrorBoundary replaces the document, so there is no `sentry-trace` meta tag to read this
// page load's trace off. A unique path identifies its server segment instead.
const id = crypto.randomUUID();
await page.goto(`/error-boundary-capture/${id}`);
await expect(page.locator('#event-id')).not.toBeEmpty();

const findServerSegmentSpan = () =>
streamedSpans.find(
span =>
getSpanOp(span) === 'http.server' &&
span.is_segment &&
span.attributes['url.path']?.value === `/error-boundary-capture/${id}`,
);
await expect.poll(findServerSegmentSpan).toBeDefined();

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.

hmm should we rewrite this with a waitForStreamedSpan condition?

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.

Yep, updated in e0e8e7d

Comment on lines +8 to +10
// Scope tags only reach Sentry on events, so the request emits one to make the tags of its own
// isolation scope observable.
Sentry.captureMessage(`scope-bleed-${id}`);

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.

we can set an attribute (Sentry.setAttribute) for less of a test change?

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.

Yea, I like that idea. Updated in 9c09f40

@andreiborza
andreiborza merged commit a112273 into develop Sep 4, 2026
302 checks passed
@andreiborza
andreiborza deleted the ab/e2e-create-remix-app-express-streaming branch September 4, 2026 13:00
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.

2 participants