Repository navigation
meta(changelog): Update changelog for 11.20.0 - #26954
Conversation
[Gitflow] Merge master into develop
## What `SentryModule.forRoot()` no longer registers `SentryTracingInterceptor` a second time, so it runs once per request instead of twice. ## Why The interceptor is already a provider in the static `@Module()` metadata, and Nest merges that with what `forRoot()` returns. Split out from #26768 since it affects all apps. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… fingerprint (#26898) Router hooks like `useEffect` passed to integrations split the SDK config hash whenever the library build or the engine changed, fixed by letting integrations name those options in `defineIntegration` so they're reported as `[Function]`. Such changes should be picked up if we decide to report the framework version, so for the meanwhile this is not useful for us for any of our use-cases and is mostly noise. It works like so: ```ts export const reactRouterV6BrowserTracingIntegration = defineIntegration(_reactRouterV6BrowserTracingIntegration, { // these fields will NOT be fingerprinted for serialization. libraryOptions: ['useEffect', 'useLocation', 'useNavigationType', 'createRoutesFromChildren', 'matchRoutes'], }); ``` The reason for that API is instead of a global list everyone pays for in bytes, each SDK pays for it's own list which is much smaller. I added a test that two different `useLocation` functions report the same payload while a user callback keeps its fingerprint.
## What Adds a checklist of the tasks we repeat for each new major, from planning to the follow-ups after the release. ## Why Today we have to look through old majors in Linear and GitHub to find out what to do, and we missed steps before (e.g. npm tags on the maintenance branch). --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Cloudflare, SvelteKit and TanStack Start each rewrite user modules at build time, each with its own parser and its own export handling, so a fix for one export form reaches only one SDK. This adds one core under `@sentry/bundler-plugins/rewriter` for them to share; the next PRs in this stack move the three SDKs onto it, and no SDK uses it in this PR. It parses with oxc, so raw TypeScript parses too, and it keeps all edits in one MagicString, so every rewrite returns a source map. Under Rolldown it parses with `this.parse`. Rollup's parser cannot read TypeScript, so other bundlers parse with oxc. oxc loads with a dynamic `import()`. This goes against the lazy-loading rule in AGENTS.md, but if a platform has no oxc native binary, the build logs one warning and leaves modules unchanged instead of failing. The component-annotation code loads oxc the same way. **How to review:** Start with `rewriter.ts` for the host and the rule model, then `exports.ts`, which holds the export forms that come from Cloudflare. There is one test file per module. **Unsure about:** The dynamic import. Also, every SDK plugin still parses each file on its own. A follow-up PR will make `sentryVitePlugin` the host, so all rules share one parse per file. Ref #25776
…pans (#26904) ## What Vercel AI `invoke_agent` spans now report the sum of their model calls' token counts (input, output, total, cache and reasoning), on every `ai` version from v4 to v7, for `generateText` and `streamText`. - Each model call's counts are derived once, from its usage corrected by its own `providerMetadata`. Model-call spans record them, and parents sum them over their steps, the v7 streamed parent included. - v4–v6 `streamText` parents now get their steps and `providerMetadata`, which the streamed path used to drop. - Model calls read reasoning from the SDK's usage. That covers every provider on v6+, and OpenAI on v5, where `@ai-sdk/openai` 2.x reports it only there. - Zero reasoning is recorded, like the other AI integrations. ## Why `providerMetadata` describes one step, and steps can use different providers. Before this, a parent mixed the SDK's aggregate usage with the last step's corrections, so multi-step parents undercounted output and reasoning, and total could disagree with output. Google's output on `@ai-sdk/google` 2.x and v4 excludes reasoning, and v4 has reasoning only in each step's metadata. Summing per-call counts that are already final keeps a parent equal to its children. From v6 on, the SDK's output includes reasoning, which matches the conventions' subset rule. On v5, its flat `reasoningTokens` is read only for OpenAI, because other providers don't say whether their output includes it. The `v10` branch still has the old static/streamed accumulation and isn't covered here. Refs: #23993 <!-- junior-request-attribution:start --> via **Rola Abuhasna**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0C848BQ509%3A1795631065.014619 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AD0C848BQ509%3A1795631065.014619) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0C848BQ509%3A1795631065.014619/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Rola Abuhasna <rola.abuhasna@sentry.io>
…26928) ## What With Nuxt's `tracingChannel` option on (Nitro v3), each server middleware and each storage call now gets one span instead of two. The response also has no `Server-Timing` header. - `nitroIntegration` has a new option `middleware`. With `false`, it makes no span for h3 middleware. - `@sentry/nuxt` now uses `nitroIntegration({ middleware: false, storage: false, serverTiming: false })`. ## Why The Nuxt SDK has its own spans for server middleware and storage, and it sends the trace to the browser with `<meta>` tags. The default `nitroIntegration` made a second span from the Nitro channels for the same operation. We keep the SDK spans and not the channel spans, because Nitro v2 has no channels and the h3 channel does not tell which middleware ran. The `handler` span of the h3 channel stays, because the SDK has no span for it. With the channel on, it is the parent of the storage, cache and db spans. Follow-up of #26885.
… Cloudflare Vite plugin (#26925) part of #24839 ## Description This makes `@sentry/tanstackstart-react` report `sentry.javascript.tanstackstart-react` when the app uses `sentryCloudflareVitePlugin()` from `@sentry/cloudflare/vite`. `wrapFetchWithSentry` sets the name on the client and keeps `@sentry/cloudflare` in the SDK packages. ## Why With that plugin, `@sentry/cloudflare` inits the client, so events had the SDK name `sentry.javascript.cloudflare`. On Node, events already have the TanStack Start name. ## SDK name decisions `wrapFetchWithSentry` sets the name at request time, the same as the `@sentry/astro` middleware does (#26848). The alternative is a build-time change that gives the metadata to the `withSentry` wrap of `@sentry/cloudflare/vite`. Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…on` (#26937) Following up on ensuring future integrations are created properly using `defineIntegration` so that their options can be captured, this PR adds a best-effort linting rule that covers most of the integration declaration patterns. It works by matching the object shape, since we cannot use type information in a lint rule at the moment. It found several cases where we missed calling `defineIntegration` so I fixed those as well. ### Illegal Patterns ```ts // object returned directly export const fooIntegration = () => ({ name: 'Foo', setup() {} }); // function declaration export function fooIntegration(): Integration { return { name: 'Foo', setupOnce() {} }; } // built separately, exported without wrapping (alias or cast) const _fooIntegration = (() => ({ name: 'Foo', processEvent: e => e })) satisfies IntegrationFn; export const fooIntegration = _fooIntegration as () => Integration; // another integration in the file is wrapped, this one is not export const barIntegration = defineIntegration(_barIntegration); export const fooIntegration = _fooIntegration; // top-level object export const foo = { name: 'Foo', afterAllSetup() {} }; ``` ### Edge cases ```ts // class instance class Foo { name = 'Foo'; setup() {} } export const fooIntegration = () => new Foo(); // no literal `name` next to a hook: spread, Object.assign, later assignment, computed key export const fooIntegration = () => ({ ...base, setup() {} }); export const fooIntegration = () => Object.assign({ name: 'Foo' }, hooks); export const fooIntegration = () => ({ [NAME_KEY]: 'Foo', setup() {} }); // name only, no hook export const fooIntegration = () => ({ name: 'Foo' }); // same name appears inside any defineIntegration call, even if not called defineIntegration(() => { debug.log(_fooIntegration); return other(); }); export const fooIntegration = _fooIntegration; ``` ### False Positives ```ts // factory whose result is wrapped in a different file export function createFooIntegration() { return (() => ({ name: 'Foo', setup() {} })) satisfies IntegrationFn; } // a new bundler plugin outside the skipped paths export const plugin = () => ({ name: 'sentry-plugin', setup(build) {} }); ```
A finished idle span stayed in memory until its final timeout fired because its timers were never cancelled, this PR clears the timer along with child span timers. The original issue isn't too severe as these timers eventually time out and the memory would be cleared, the behavior change here is that all child timers are also cancelled along with it. It's not a big behavior change since the child spans were force-ended anyways, so this cleans up their memory presence. In other words, I don't see a case where a child span outlived its parent and relied on the timeout to end naturally. Overall seems like a safe change. I added tests that check no timer is left pending after an idle span ends by itself or is ended externally. closes #26936
## What On Nest 12+, the tracing interceptor creates a `websocket` span per WebSocket message, named `WS <namespace> <pattern>`, each in its own trace. ## Why Takes over #24862 from @faizansaiyed123 (commits kept). Nest only applies global interceptors to gateways from v12 on, so the e2e app moved to Nest 12. Stacked on #26775. Closes: #13810 --------- Co-authored-by: Faizan Saiyed <fai1ggj@gmail.com> Co-authored-by: OpenAI/ChatGPT GPT-6 <codex@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…print (#26840) Minifiers rename whatever a function references from outside, this means an SDK config can report changes in callbacks that never actually changed. ### Why the hash changes The SDK config report serializes each function option as a hash of `Function.prototype.toString()`. That text is not stable in a minified bundle. ```ts beforeSendLog: log => (isFilteredLog(log) ? null : log) ``` ships as `e=>T(e)?null:e` in one build and `e=>q(e)?null:e` in the next. The name given to `isFilteredLog` depends on the rest of the chunk, how often other bindings are referenced, the order they are declared in, and which modules end up sharing a scope. So an unrelated change somewhere else in the app changes the callback's text and its hash. I confirmed this on the Sentry frontend. Across 8 production releases, 4 of the 5 function options had two different hashes, and every diff in the shipped text was a single renamed outside reference. I also reproduced it in a small Vite app with Oxc, esbuild and Terser, they all exhibit the same behavior. ### What the fingerprint does It scans the function text and replaces every name a minifier can rename with `_`, then hashes the result. Keywords, property names (`e.message`), object keys, string, template, regex and number literals, and all punctuation are kept, so real edits still change the fingerprint. Whitespace and comments are dropped. ``` e=>T(e.message)?null:e -> _ = > _ ( _ .message ) ? null : _ e=>q(e.message)?null:e -> _ = > _ ( _ .message ) ? null : _ ``` One regex does the lexing. A short loop around it tracks the two things a regex can't: open `${` substitutions in templates, and whether a `/` is a division or the start of a regex literal. ### What it does not do It only aims to be stable across builds made with the same minifier. Projects rarely switch minifiers, and a switch costs one changed fingerprint per callback, once. An earlier version on this branch was a hand-written tokenizer that also treated different quote styles, number spellings, `void 0`, `!0`, `===` versus `==`, and shorthand keys as equal. It was about 1.3KB minified and gzipped, which was too much for what it bought. This version is about 0.7KB. In my Vite test the larger one still gave different fingerprints for the same callback across Oxc, esbuild and Terser (they differ in `const` versus `let` and operand order), so those extra rules did not deliver cross-minifier stability either. ### Results On the Sentry frontend bundles, all 5 function options now give one fingerprint across the 8 releases. It also absorbs a browser difference I found along the way: Safari 16.6 and older print anonymous functions as `function (` with a space, which gave those clients their own hashes. ### Known limits - When a minifier inlines a helper into the callback, the callback's text really is different, and the fingerprint changes. Nothing that only sees the function at runtime can undo that. - Webpack and Rspack mangle export names, so `w.AD` in `w.AD.some(...)` is a bundler-assigned name that looks like a real property. It is kept, and it can change. - Method names and shorthand keys are blanked like any other name, so renaming a method inside a callback goes unnoticed. - A label at the start of a block is kept as if it were an object key. - All bound functions look the same, so swapping one bound callback for another goes unnoticed.
size-limit report 📦Compared: d554a5f (PR test merge using master at 6ecb468) Against: a84235e (master) · base run #68152
|
Optional E2E testsAll optional checks were successful. 65 successful. See the run. Successful checks
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 65a0606. Configure here.
| if (include.basename && !include.basename.test(basename(id))) return false; | ||
| if (include.contains && !include.contains.every(substring => code.includes(substring))) return false; | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Rewriter matching ignores Vite query ids
Medium Severity
matches() tests include.id and include.basename against the raw module id. Vite dev appends ?v=<hash> (and similar queries), so patterns like /\.ts$/ and /^\+page\.ts$/ miss those modules. langFromId already strips the query with stripUrlQueryAndFragment, but include matching does not, so auto-instrumentation would not run in Vite dev.
Additional Locations (1)
Triggered by learned rule: Strip Vite query before matching orchestrion IDs
Reviewed by Cursor Bugbot for commit 65a0606. Configure here.


This adds the changelog entry for 11.20.0, so merging it into master kicks off the release.