Skip to content

feat(core)!: Return StreamedSpanJSON from spanToJSON - #22968

Draft
Lms24 wants to merge 3 commits into
developfrom
lms/ref-spanToJson
Draft

feat(core)!: Return StreamedSpanJSON from spanToJSON#22968
Lms24 wants to merge 3 commits into
developfrom
lms/ref-spanToJson

Conversation

@Lms24

@Lms24 Lms24 commented Aug 3, 2026

Copy link
Copy Markdown
Member
  • feat(core)!: Return StreamedSpanJSON from spanToJSON
  • .
  • fix all usage

@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 4 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 54994d4. Configure here.

debug.log(`[Tracing] Finishing current active span with op: ${activeSpanJson?.attributes[SENTRY_OP]}`);
// If there's an open active span, we need to finish it before creating an new one.
activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, 'cancelled');
activeSpan.setAttribute(SENTRY_IDLE_SPAN_FINISH_REASON, 'cancelled');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Broken open-span end checks

High Severity

spanToJSON now returns StreamedSpanJSON, where end_timestamp is always set (_endTime ?? _startTime). Call sites still treat it like the old optional timestamp, so open-span checks such as !end_timestamp never succeed. That can leave idle spans unfinished, skip lazy-route name updates, and mis-detect whether a navigation span has ended. In updateNavigationSpan, the condition is also inverted from the previous !timestamp check.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 54994d4. Configure here.


if (this._mountSpan && includeRender) {
const startTime = spanToJSON(this._mountSpan).timestamp;
const startTime = spanToJSON(this._mountSpan).start_timestamp;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong render span start time

Medium Severity

The profiler render span previously started from the mount span’s end time (timestamp). It now reads start_timestamp, so the render span incorrectly includes mount duration instead of measuring time on screen from mount completion to unmount.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 54994d4. Configure here.

const { op, description } = spanToJSON(rootSpan);
if (op === 'navigation' && description === '-1') {
const { attributes, name } = spanToJSON(rootSpan);
if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'navigation' && name === '-1') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shadowed back-navigation name

Medium Severity

Destructuring name from spanToJSON shadows the outer name (location.pathname). For back-button navigations where the span name is -1, updateName now reassigns -1 instead of the real pathname, so those spans keep an unusable name.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 54994d4. Configure here.

* Convert a span to the intermediate {@link StreamedSpanJSON} representation.
*/
export function spanToStreamedSpanJSON(span: Span): StreamedSpanJSON {
export function spanToJSON(span: Span): StreamedSpanJSON {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Feat PR lacks integration tests

Low Severity

This is a feat PR, but the diff only updates unit tests and does not add an integration or E2E test covering the new spanToJSONStreamedSpanJSON behavior across packages. Flagged because the review rules require at least one integration or E2E test for feat PRs.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 54994d4. Configure here.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.91 kB +0.02% +3 B 🔺
@sentry/browser - with treeshaking flags 28.12 kB +0.02% +4 B 🔺
@sentry/browser (incl. Tracing) 47.39 kB +0.08% +34 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 47.41 kB +0.11% +48 B 🔺
@sentry/browser (incl. Tracing, Profiling) 52.17 kB +0.08% +40 B 🔺
@sentry/browser (incl. Tracing, Replay) 86.76 kB +0.08% +61 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.17 kB +0.06% +41 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 91.48 kB +0.08% +66 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 104.13 kB +0.08% +77 B 🔺
@sentry/browser (incl. Feedback) 47.23 kB +0.01% +3 B 🔺
@sentry/browser (incl. sendFeedback) 34.76 kB +0.01% +2 B 🔺
@sentry/browser (incl. FeedbackAsync) 39.87 kB +0.02% +4 B 🔺
@sentry/browser (incl. Metrics) 31 kB +0.01% +3 B 🔺
@sentry/browser (incl. Logs) 31.23 kB +0.02% +4 B 🔺
@sentry/browser (incl. Metrics & Logs) 31.9 kB +0.01% +3 B 🔺
@sentry/react 31.73 kB +0.01% +1 B 🔺
@sentry/react (incl. Tracing) 49.65 kB +0.08% +37 B 🔺
@sentry/vue 34.99 kB +0.01% +3 B 🔺
@sentry/vue (incl. Tracing) 49.39 kB +0.1% +49 B 🔺
@sentry/svelte 29.95 kB +0.02% +3 B 🔺
CDN Bundle 32.01 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing) 47.77 kB +0.11% +49 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.56 kB +0.01% +3 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.13 kB +0.1% +45 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 72.9 kB +0.01% +3 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.39 kB +0.04% +33 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.69 kB +0.05% +39 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.19 kB +0.06% +52 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.5 kB +0.05% +42 B 🔺
CDN Bundle - uncompressed 95.53 kB +0.02% +14 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 143.27 kB +0.12% +166 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.25 kB +0.02% +14 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.25 kB +0.12% +166 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225 kB +0.01% +15 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.53 kB +0.07% +167 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.49 kB +0.07% +167 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.23 kB +0.07% +167 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.19 kB +0.06% +167 B 🔺
@sentry/nextjs (client) 52.24 kB +0.07% +35 B 🔺
@sentry/sveltekit (client) 47.85 kB +0.1% +45 B 🔺
@sentry/core/server 80.02 kB +0.01% +4 B 🔺
@sentry/core/browser 51.98 kB +0.02% +6 B 🔺
@sentry/node 120.88 kB -0.01% -12 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 84.27 kB +0.02% +11 B 🔺
@sentry/aws-serverless 92.94 kB +0.01% +8 B 🔺
@sentry/cloudflare (withSentry) - minified 219.39 kB +0.02% +26 B 🔺
@sentry/cloudflare (withSentry) 540.53 kB +0.02% +64 B 🔺

View base workflow run

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.

1 participant