Skip to content

fix(browser): Attribute long animation frame spans to the longest script - #25990

Merged
mydea merged 1 commit into
developfrom
fix/browser-loaf-longest-script
Nov 4, 2026
Merged

mydea merged 1 commit into
developfrom
fix/browser-loaf-longest-script

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Why: long-tasks-and-animation-frame-enabled-static › "should capture long animation frame for event listener" failed in 3 develop runs last week (weekly report). In the Playwright trace from one failure, the click frame's span was there, but its invoker was DOMWindow.onmousedown, in sentryWrapped in the SDK bundle. That's the SDK's own capture-phase INP listener, not BUTTON#clickme.onclick, which blocks for 105ms. The span takes its attributes from entry.scripts[0]. The browser only lists scripts that run longer than 5ms, so on a loaded runner the SDK's mousedown listener sometimes crosses that bar and becomes the first entry.

The same thing can happen in production: a frame blocked by app code gets blamed on our own listener. This change uses the script with the longest duration instead. That's also how web-vitals' INP attribution picks longestScript. The new unit test fails on develop and passes with the fix. The long task and LoAF browser suites pass locally on Chromium.

Unsure about: this changes which script the browser.script.* / code.* attributes describe, so it's a small behavior change rather than a test-only fix. If you'd rather keep scripts[0], the alternative is to loosen the browser test. I kept it in fix scope for that reason.

via automation sched_91b21536e9d59370f48bbec448287393 · Run ID sched_91b21536e9d59370f48bbec448287393:1793610000000.

--

View Session [Sentry]

The span took its invoker and source attributes from the first script of
the frame. When a short listener ran first, such as the SDK's own INP
listener on `mousedown`, the frame was attributed to that listener
instead of the script that blocked it. This also made the
long-tasks-and-animation-frame event listener browser test flaky.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 62edddc (PR test merge using develop at 34dfa4d)

Against: 34dfa4d (develop) · base run #64564

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.39 kB - -
@sentry/browser - with treeshaking flags 28.54 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.42 kB - -
@sentry/browser (incl. Tracing) 52.72 kB +0.03% +12 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 52.73 kB +0.02% +10 B 🔺
@sentry/browser (incl. Tracing, Profiling) 55.7 kB +0.02% +11 B 🔺
@sentry/browser (incl. Tracing, Replay) 93.03 kB +0.02% +13 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.62 kB +0.02% +11 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 97.77 kB +0.02% +14 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 110.76 kB +0.02% +14 B 🔺
@sentry/browser (incl. Feedback) 47.98 kB - -
@sentry/browser (incl. sendFeedback) 35.5 kB - -
@sentry/browser (incl. FeedbackAsync) 40.6 kB - -
@sentry/browser (incl. Metrics) 31.43 kB - -
@sentry/browser (incl. Logs) 31.72 kB - -
@sentry/browser (incl. Metrics & Logs) 32.44 kB - -
@sentry/react 32.28 kB - -
@sentry/react (incl. Tracing) 55.09 kB +0.03% +13 B 🔺
@sentry/vue 38.66 kB - -
@sentry/vue (incl. Tracing) 55.74 kB +0.03% +13 B 🔺
@sentry/svelte 30.42 kB - -
@sentry/remix (Remix 3 client bundle) 57.8 kB +0.03% +13 B 🔺
CDN Bundle 32.18 kB - -
CDN Bundle (incl. Tracing) 53.25 kB +0.03% +11 B 🔺
CDN Bundle (incl. Logs, Metrics) 34.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.19 kB +0.03% +12 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 75.87 kB - -
CDN Bundle (incl. Tracing, Replay) 91.46 kB +0.02% +15 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.39 kB +0.02% +13 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 97.56 kB +0.02% +12 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.57 kB +0.02% +12 B 🔺
CDN Bundle - uncompressed 94.64 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.64 kB +0.03% +38 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.11 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.38 kB +0.03% +38 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.68 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 279.33 kB +0.02% +38 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.05 kB +0.02% +38 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 293.03 kB +0.02% +38 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 298.75 kB +0.02% +38 B 🔺
@sentry/nextjs (client) 58.04 kB +0.03% +13 B 🔺
@sentry/sveltekit (client) 53.24 kB +0.03% +13 B 🔺
@sentry/core/server 44.24 kB - -
@sentry/core/browser 13.93 kB - -
@sentry/node 155.65 kB +0.02% +28 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.16 kB - -
@sentry/node - without tracing 96.79 kB +0.03% +22 B 🔺
@sentry/node - without channel injection 136.02 kB +0.02% +25 B 🔺
@sentry/aws-serverless 104.99 kB +0.02% +20 B 🔺
@sentry/cloudflare (withSentry) - minified 200.64 kB - -
@sentry/cloudflare (withSentry) 499 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 221.18 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 1 not successful, 22 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Failing after 2m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 26s Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 18s Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 17s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 57s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 19s Details

@mydea
mydea marked this pull request as ready for review November 4, 2026 16:44
@mydea
mydea requested a review from a team as a code owner November 4, 2026 16:44
@mydea
mydea requested review from Lms24 and logaretm and removed request for a team November 4, 2026 16:44
@mydea mydea self-assigned this Nov 4, 2026
@mydea
mydea merged commit e4eff2c into develop Nov 4, 2026
505 of 508 checks passed
@mydea
mydea deleted the fix/browser-loaf-longest-script branch November 4, 2026 16:48
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