Skip to content

test(e2e): Add a cloudflare-flue end-to-end application - #24477

Open
RulaKhaled wants to merge 3 commits into
feat/flue-cloudflare-autoinstrumentfrom
feat/flue-cloudflare-e2e
Open

RulaKhaled wants to merge 3 commits into
feat/flue-cloudflare-autoinstrumentfrom
feat/flue-cloudflare-e2e

Conversation

@RulaKhaled

@RulaKhaled RulaKhaled commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #24476 — review that first.

A flue init Cloudflare app with no instrument() call anywhere: registration comes from the build, so any gen_ai span here is itself proof the auto-wiring worked. Covers AI spans, tool-error capture, a manual span nesting under its tool, and an orchestrion dataloader span in the agent's trace.

Secrets go through .dev.vars rather than --var because Flue resolves the provider key inside pi-ai at runtime, leaving nothing for Vite to inline, and vite preview is what serves the worker with Flue's generated Durable Object config.

Two Flue constraints the app works around, both commented in place: agents is imported by Flue's generated worker entry without being declared, so it only resolves under npm's hoisting and needs declaring for pnpm; and the 'use agent' scan parses every source file as plain JavaScript, so generics and return types fail the build.

Worth a docs note: the Sentry wrapper has to be re-exported as cloudflare from the agent module. Defining it elsewhere leaves the Durable Object unwrapped — the agent runs, turns settle, and nothing is traced.

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.09 kB - -
@sentry/browser - with treeshaking flags 27.35 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.26 kB - -
@sentry/browser (incl. Tracing) 50.6 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 50.62 kB - -
@sentry/browser (incl. Tracing, Profiling) 53.61 kB - -
@sentry/browser (incl. Tracing, Replay) 90.15 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.25 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 94.85 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 107.83 kB - -
@sentry/browser (incl. Feedback) 46.62 kB - -
@sentry/browser (incl. sendFeedback) 34.15 kB - -
@sentry/browser (incl. FeedbackAsync) 39.26 kB - -
@sentry/browser (incl. Metrics) 30.1 kB - -
@sentry/browser (incl. Logs) 30.35 kB - -
@sentry/browser (incl. Metrics & Logs) 31.02 kB - -
@sentry/react 30.84 kB - -
@sentry/react (incl. Tracing) 52.94 kB - -
@sentry/vue 36.34 kB - -
@sentry/vue (incl. Tracing) 52.91 kB - -
@sentry/svelte 29.11 kB - -
CDN Bundle 30.8 kB - -
CDN Bundle (incl. Tracing) 51.15 kB - -
CDN Bundle (incl. Logs, Metrics) 33.06 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.14 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.75 kB - -
CDN Bundle (incl. Tracing, Replay) 88.69 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 90.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 94.73 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 96.78 kB - -
CDN Bundle - uncompressed 91.16 kB - -
CDN Bundle (incl. Tracing) - uncompressed 152.66 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.73 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 158.61 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.14 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 272.23 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 278.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 285.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 291.86 kB - -
@sentry/nextjs (client) 55.27 kB - -
@sentry/sveltekit (client) 51.05 kB - -
@sentry/core/server 39.63 kB - -
@sentry/core/browser 13.66 kB - -
@sentry/node 133.33 kB +0.05% +60 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.14 kB +0.04% +27 B 🔺
@sentry/node - without tracing 89.92 kB +0.06% +53 B 🔺
@sentry/node - without channel injection 112.15 kB +0.02% +15 B 🔺
@sentry/aws-serverless 98.19 kB +0.06% +55 B 🔺
@sentry/cloudflare (withSentry) - minified 204.69 kB - -
@sentry/cloudflare (withSentry) 509.25 kB - -

View base workflow run

@RulaKhaled
RulaKhaled added this pull request to stack #24478 September 17, 2026 14:18
@RulaKhaled
RulaKhaled force-pushed the feat/flue-cloudflare-e2e branch from 59f88d8 to 1ce2d24 Compare September 18, 2026 07:46
//
// There is deliberately no `instrument()` call in this app: registering the Flue instrumentation is
// what `@sentry/cloudflare/vite` does at build time, and these tests exist to prove it.
export const cloudflare = extend({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this not work with the cloudflare auto-instrumentation (so just having a instrument.server.mjs file)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it doesn't, tried it, it just silently does nothing

auto instrumentation only picks that file up when wrangler has main set, which flue doesn't, flue generates both the worker entry and the DO class, so there's nothing for us to transform. extend({ wrap }) is basically the hook flue provides for this (we need it even with a manual instrument)

RulaKhaled and others added 3 commits September 18, 2026 11:55
A `flue init` Cloudflare app with no `instrument()` call anywhere: registration
comes from the build, so any `gen_ai` span here is itself proof the auto-wiring
worked. Covers AI spans, tool-error capture, a manual span nesting under its
tool, and an orchestrion `dataloader` span in the agent's trace.

Secrets go through `.dev.vars` rather than `--var`: Flue resolves the provider
key inside `pi-ai` at runtime, so unlike Mastra there is nothing for Vite to
inline, and `vite preview` is what serves the worker with Flue's generated
Durable Object config.

`agents` is declared explicitly — Flue's generated worker entry imports it
without declaring it, which only resolves under npm's hoisting, not pnpm. The
agent and loader modules avoid TypeScript generics and return types because
Flue's `'use agent'` scan parses every source file as plain JavaScript.
`vite preview` serves the worker that wrangler builds, which is the artifact the build-time
registration this app exists to prove actually ships in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`@flue/runtime` depends on `hono@^4.8.3`, so a `~4.7.0` pin here cannot share it — pnpm
installs a second copy and the app's router runs on 4.7.11 while Flue runs 4.13.8. That
older copy also carries five high-severity advisories, which fails dependency review.

Widening the range collapses both copies onto one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@RulaKhaled
RulaKhaled force-pushed the feat/flue-cloudflare-e2e branch from 7757e86 to cafe644 Compare September 18, 2026 08:56
@RulaKhaled RulaKhaled changed the title test(e2e): Add a cloudflare-flue end-to-end application (WIP) test(e2e): Add a cloudflare-flue end-to-end application Sep 18, 2026
@RulaKhaled

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit cafe644. Configure here.

@RulaKhaled
RulaKhaled marked this pull request as ready for review September 18, 2026 10:17
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.

2 participants