Repository navigation
Conversation
`@sentry/cloudflare/vite` spliced an `@flue/runtime` import into `@sentry/server-utils`'s Flue integration. Every orchestrion-instrumented module imports `@sentry/server-utils`, so that import closes a cycle through any instrumented package Flue loads at module scope. Once pi-ai is instrumented, a worker that reaches pi-ai first runs Flue's module-level `createModels()` before pi-ai's `ModelsImpl` exists and fails at startup. Flue's entry is already transformed, so it now publishes its own namespace through a self-import, which adds no edge to the module graph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
size-limit report 📦Compared: bf5433a (PR test merge using develop at 365e761) Against: 365e761 (develop) · base run #64341 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 2 not successful, 53 successful. See the run.
Successful checks
|
…ig test The Cloudflare plugin test only echoed the option it passes. The transform tests and the cloudflare-flue-send-to-sentry e2e app cover the behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mydea
marked this pull request as ready for review
October 30, 2026 11:00
mydea
requested review from
andreiborza and
isaacs
and removed request for
a team
October 30, 2026 11:00
This branch has not been deployed
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.
Why:
flueIntegrationneeds Flue's owninstrument(), which a bundled worker can't resolve at runtime.@sentry/cloudflare/viteused to splice an@flue/runtimeimport into@sentry/server-utils's Flue integration for that. Every orchestrion-instrumented module imports@sentry/server-utils, so that import closes a cycle through any instrumented package Flue loads at module scope. With pi-ai instrumented (the upcoming pi-ai integration, split out of #25869), a worker that reaches pi-ai first runs Flue's module-levelcreateModels()before pi-ai'sModelsImplexists. I reproduced it locally withcloudflare-flue-send-to-sentry: the worker fails at startup withCannot access 'ModelsImpl' before initialization.Flue's entry is already transformed at build time, so it now publishes its own namespace through a self-import.
There are now two ways to hand a package to an integration in a bundled worker. Which one to use depends on whether the app already imports the package:
selfProvidedModules, new)@flue/runtime@mastra/observabilityimport * as ns from './index.mjs'import * as ns from '@mastra/observability'Mastra can't switch to the self-provided path: apps don't import
@mastra/observability(Mastra's observability is zero-config), so nothing would load it and it would never publish itself. Its splice has the same cycle shape (@mastra/observabilityimports@mastra/core, which is instrumented). That is harmless today because it only imports core subpaths that aren't transformed. If that changes, the splice can move into@sentry/cloudflare's own module, out of@sentry/server-utils.selfProvidedModulesis Cloudflare-only on purpose. On other bundlers,flueIntegrationwould then register Flue itself and clash with apps that callinstrument(Sentry.createFlueInstrumentation()), as our Node docs say. The webpack loader doesn't pass the option.How to review: Start with
selfProvidedSnippetinmoduleInjectedTransform.ts; its comment shows the generated output. The rest is wiring, removing Flue's provided-module plugin, and comments.Unsure about: Whether the Mastra splice should move out of
@sentry/server-utilsnow, before it can hit the same kind of cycle. I'd leave it until something actually triggers it.🤖 Generated with Claude Code