Skip to content

ref(ai)!: Drop core's duplicate AI base copy - #22965

Draft
nicohrubec wants to merge 1 commit into
ref/move-ai-vercel-ai-2from
ref/move-ai-cleanup-2
Draft

ref(ai)!: Drop core's duplicate AI base copy#22965
nicohrubec wants to merge 1 commit into
ref/move-ai-vercel-ai-2from
ref/move-ai-cleanup-2

Conversation

@nicohrubec

@nicohrubec nicohrubec commented Aug 3, 2026

Copy link
Copy Markdown
Member

Final cleanup of the AI-integration move (last PR in the stack). Deletes core's duplicate tracing/ai/ base (gen-ai-attributes, mediaStripping, messageTruncation, utils) that was kept while the providers moved out one at a time. Every consumer already imports the copy under @sentry/server-utils/src/ai/core, so the core exports had no remaining consumers.

With this, @sentry/core contains no AI/gen-ai instrumentation code — the goal of the whole stack. The platform SDK public API is unchanged (AI symbols are re-exported from @sentry/server-utils). ~1000 lines removed from core.

Root cause of keeping providerSkip in core: providerSkip is intentionally not moved. It is a small, provider-agnostic skip registry (a module-global Set with add/has/clear), not provider instrumentation. Cloudflare's client.ts calls _INTERNAL_clearAiProviderSkips() in _setupIntegrations(), and client.ts sits in the wrapRequestHandler edge module graph (request.tsbaseSdk.tsclient.ts), which requestModuleGraph.test.ts guards against importing @sentry/server-utils. Keeping the registry in @sentry/core lets both the Node client and the edge request path reach it without crossing that boundary. The server-utils AI code imports the skip helpers from @sentry/core (allowed, since server-utils already depends on core). Fully evicting it would require relocating the per-init reset out of client.ts into a nodejs_compat-only module, or making the registry non-global (client/carrier-scoped) — left as a follow-up.

Also moves the two ai/core unit tests to server-utils and fixes a lint violation (forbidden import() type annotation) in the moved langchain-embeddings test.

🤖 Generated with Claude Code

@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% -5 B 🔽
@sentry/browser - with treeshaking flags 28.11 kB -0.02% -4 B 🔽
@sentry/browser (incl. Tracing) 47.35 kB -0.02% -5 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 47.36 kB -0.01% -4 B 🔽
@sentry/browser (incl. Tracing, Profiling) 52.13 kB -0.01% -5 B 🔽
@sentry/browser (incl. Tracing, Replay) 86.69 kB -0.01% -4 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.13 kB -0.01% -4 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 91.41 kB -0.01% -4 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 104.05 kB -0.01% -5 B 🔽
@sentry/browser (incl. Feedback) 47.22 kB -0.02% -5 B 🔽
@sentry/browser (incl. sendFeedback) 34.76 kB -0.02% -5 B 🔽
@sentry/browser (incl. FeedbackAsync) 39.86 kB -0.02% -6 B 🔽
@sentry/browser (incl. Metrics) 30.99 kB -0.02% -5 B 🔽
@sentry/browser (incl. Logs) 31.22 kB -0.02% -4 B 🔽
@sentry/browser (incl. Metrics & Logs) 31.89 kB -0.02% -4 B 🔽
@sentry/react 31.73 kB -0.02% -5 B 🔽
@sentry/react (incl. Tracing) 49.61 kB -0.01% -4 B 🔽
@sentry/vue 34.98 kB -0.03% -7 B 🔽
@sentry/vue (incl. Tracing) 49.34 kB -0.02% -5 B 🔽
@sentry/svelte 29.94 kB -0.02% -5 B 🔽
CDN Bundle 32 kB -0.02% -6 B 🔽
CDN Bundle (incl. Tracing) 47.72 kB -0.02% -6 B 🔽
CDN Bundle (incl. Logs, Metrics) 33.55 kB -0.02% -4 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 49.08 kB -0.02% -7 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 72.89 kB -0.01% -5 B 🔽
CDN Bundle (incl. Tracing, Replay) 85.35 kB -0.01% -7 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.65 kB -0.01% -7 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 91.14 kB -0.01% -5 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.45 kB -0.01% -7 B 🔽
CDN Bundle - uncompressed 95.5 kB -0.03% -24 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 143.08 kB -0.02% -24 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.21 kB -0.03% -24 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.06 kB -0.02% -24 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.97 kB -0.02% -24 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.34 kB -0.01% -24 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.3 kB -0.01% -24 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.04 kB -0.01% -24 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280 kB -0.01% -24 B 🔽
@sentry/nextjs (client) 52.2 kB -0.01% -4 B 🔽
@sentry/sveltekit (client) 47.8 kB -0.02% -8 B 🔽
@sentry/core/server 65.65 kB -17.96% -14.37 kB 🔽
@sentry/core/browser 51.96 kB -0.02% -9 B 🔽
@sentry/node 120.84 kB -0.04% -46 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 84.26 kB -0.01% -4 B 🔽
@sentry/aws-serverless 92.92 kB -0.02% -16 B 🔽
@sentry/cloudflare (withSentry) - minified 219.34 kB -0.02% -24 B 🔽
@sentry/cloudflare (withSentry) 540.48 kB +0.01% +10 B 🔺

View base workflow run

Final cleanup of the AI-integration move. Deletes core's duplicate `tracing/ai/` base
(`gen-ai-attributes`, `mediaStripping`, `messageTruncation`, `utils`) that was kept while
the providers moved one at a time. Every consumer already imports the copy under
`@sentry/server-utils/src/ai/core`, so the core exports had no remaining consumers.

`providerSkip` intentionally stays in `@sentry/core`: it is a small cross-cutting skip
registry (a module-global `Set`), not provider instrumentation, and cloudflare's
`client.ts` — which is in the `wrapRequestHandler` edge module graph — must not import
from `@sentry/server-utils` (guarded by `requestModuleGraph.test.ts`). Keeping it in core
lets both the node client and the edge request path reach it without crossing that
boundary. The server-utils AI code imports the skip helpers from `@sentry/core` (allowed,
since server-utils depends on core).

With this, `@sentry/core` contains no AI/gen-ai *instrumentation* code (only the
provider-agnostic skip registry remains). The platform SDK public API is unchanged.

Also moves the two `ai/core` unit tests to server-utils and fixes a lint violation
(`import()` type annotation) in the moved langchain-embeddings test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicohrubec
nicohrubec force-pushed the ref/move-ai-cleanup-2 branch from d32eaf4 to 99b7473 Compare August 3, 2026 15:37
@nicohrubec nicohrubec changed the title ref(ai)!: Move providerSkip to @sentry/server-utils and drop core's AI base copy ref(ai)!: Drop core's duplicate AI base copy Aug 3, 2026
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