test(e2e): Verify bundler plugins instrument a bundled graphql at runtime - #23670
Open
mydea wants to merge 2 commits into
Open
test(e2e): Verify bundler plugins instrument a bundled graphql at runtime#23670mydea wants to merge 2 commits into
mydea wants to merge 2 commits into
Conversation
mydea
force-pushed
the
fn/bundler-graphql-runtime
branch
from
August 27, 2026 08:26
28dc52a to
36b76fb
Compare
mydea
force-pushed
the
fn/bundler-graphql-runtime
branch
from
August 27, 2026 08:26
36b76fb to
04d550b
Compare
mydea
force-pushed
the
fn/bundler-graphql-runtime
branch
from
August 27, 2026 08:29
04d550b to
0e12cc0
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0e12cc0. Configure here.
Contributor
size-limit report 📦
|
…nstrumentation Extends the node webpack/vite/rollup/rolldown/esbuild bundler apps from a static banner-grep into a runtime test: each app bundles a real `graphql` workload (inlined, only node builtins external) twice — `plain` (no plugin) and `plugin` (Sentry bundler plugin) — then runs both built bundles and asserts the query still returns data and that only the `plugin` build emits `auto.graphql.diagnostic_channel` spans. The entry disables `enableRuntimeChannelInjection` and runs without `--import`, so the bundler plugin is the only possible injector, making the `plain` build a true negative. Spans are captured via the `spanEnd` hook (transport/lifecycle-independent). The entry body is an async function (not top-level await) so it bundles to both ESM and esbuild's CJS node output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n set Adds two more variants per bundler app that keep graphql external and run the built bundle with `node --import @sentry/node/import`, so the runtime diagnostics-channel hook instruments graphql at load time (the inlined variants exercise the build-time transform instead). Each app now runs four scenarios: - plain (inlined, no plugin, no --import): no graphql spans (control) - plugin (inlined, plugin, no --import): one set, build-time - plain-external (external, no plugin, --import): one set, runtime hook - plugin-external (external, plugin, --import): one set, runtime hook only The assert defines "one set" relative to the build-time run and checks every instrumented scenario emits exactly that count — never zero, never double. The plugin-external + --import case in particular proves the build-time plugin and the runtime hook don't both instrument the same module (the plugin can't touch an external dep, so the runtime hook is the sole injector). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mydea
force-pushed
the
fn/bundler-graphql-runtime
branch
from
August 27, 2026 09:36
e5bf0b9 to
07f694a
Compare
mydea
marked this pull request as ready for review
August 27, 2026 11:37
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.

Extends the five node bundler apps (
node-webpack,node-vite,node-rollup,node-rolldown,node-esbuild) from a static banner-grep into a real runtime test, in the spirit of orchestrion-treeshake-repro: actually run the bundled service against a real package and verify what gets injected.Each app now bundles a real
graphqlworkload (inlined; only node builtins external) twice —plain(no plugin) andplugin(Sentry bundler plugin) — then runs both built bundles and asserts:pluginbuild: graphql auto-spans appear with originauto.graphql.diagnostic_channel,plainbuild: they do not (negative control).This guards the fix beneath it (#23669) and catches the whole class of "bundle looks instrumented but emits no spans" regressions the static grep couldn't.
Decisions
enableRuntimeChannelInjection: falseand the bundles run with a plainnode(no--import), so the bundler plugin is the only possible injector — making theplainbuild a true negative rather than something the runtime hook could rescue.spanEndhook (+spanToJSON) rather thanbeforeSendSpan, so collection is independent of transport and trace lifecycle. Transport is a no-op and the DSN fake — nothing hits the network.require('node:async_hooks')that@sentry/server-utilsdoes once inlined (an esbuild CJS-in-ESM interop limit, the "separate bug" the repro noted); CJS output is the normal esbuild node target and sidesteps it. This also means esbuild resolves graphql's CJS build, so the suite covers both the.jsand.mjsorchestrion paths.new Set()formatting varies by bundler.