test(e2e): Add a cloudflare-flue end-to-end application - #24477
RulaKhaled wants to merge 3 commits into
Conversation
size-limit report 📦
|
59f88d8 to
1ce2d24
Compare
| // | ||
| // 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({ |
There was a problem hiding this comment.
would this not work with the cloudflare auto-instrumentation (so just having a instrument.server.mjs file)?
There was a problem hiding this comment.
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)
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>
7757e86 to
cafe644
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ 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.
Stacked on #24476 — review that first.
A
flue initCloudflare app with noinstrument()call anywhere: registration comes from the build, so anygen_aispan here is itself proof the auto-wiring worked. Covers AI spans, tool-error capture, a manual span nesting under its tool, and an orchestriondataloaderspan in the agent's trace.Secrets go through
.dev.varsrather than--varbecause Flue resolves the provider key insidepi-aiat runtime, leaving nothing for Vite to inline, andvite previewis what serves the worker with Flue's generated Durable Object config.Two Flue constraints the app works around, both commented in place:
agentsis 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
cloudflarefrom the agent module. Defining it elsewhere leaves the Durable Object unwrapped — the agent runs, turns settle, and nothing is traced.