ref(ai)!: Drop core's duplicate AI base copy - #22965
Draft
nicohrubec wants to merge 1 commit into
Draft
Conversation
Contributor
size-limit report 📦
|
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
force-pushed
the
ref/move-ai-cleanup-2
branch
from
August 3, 2026 15:37
d32eaf4 to
99b7473
Compare
@sentry/server-utils and drop core's AI base copy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/corecontains 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
providerSkipin core:providerSkipis intentionally not moved. It is a small, provider-agnostic skip registry (a module-globalSetwith add/has/clear), not provider instrumentation. Cloudflare'sclient.tscalls_INTERNAL_clearAiProviderSkips()in_setupIntegrations(), andclient.tssits in thewrapRequestHandleredge module graph (request.ts→baseSdk.ts→client.ts), whichrequestModuleGraph.test.tsguards against importing@sentry/server-utils. Keeping the registry in@sentry/corelets 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 ofclient.tsinto anodejs_compat-only module, or making the registry non-global (client/carrier-scoped) — left as a follow-up.Also moves the two
ai/coreunit tests to server-utils and fixes a lint violation (forbiddenimport()type annotation) in the moved langchain-embeddings test.🤖 Generated with Claude Code