Skip to content

test(examples/cloudflare-workers): real-workerd smoke for the WinterCG fetch transport (issue #15) - #81

Merged
devin-ai-integration[bot] merged 1 commit into
mainfrom
devin/1792348637-wintercg-fetch
Oct 18, 2026
Merged

devin-ai-integration[bot] merged 1 commit into
mainfrom
devin/1792348637-wintercg-fetch

Conversation

@espetro

@espetro espetro commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes the P7 gap in issue #15: the Cloudflare Workers recipe claimed "runs on Cloudflare Workers" while only an in-process Node smoke existed — nothing proved the app boots inside the actual WinterCG runtime. The first real boot surfaced a transport gap that the in-process test structurally could not see.

What changed

  • examples/integrations/cloudflare-workers/test/workerd.test.mjs — new real-workerd smoke: esbuild bundles src/main.ts (node:* kept external), a generated .capnp config serves it via workerd serve on a real socket, and plain HTTP requests assert GET /, GET /user/:id, POST /echo, and a 404. This is the no-bluff gate: the host supplies the Request, the app answers a Response.
  • wrangler.toml — adds enable_nodejs_fs_module to compatibility_flags. Real boot failed with No such module "node:fs": multipart.ts imports node:fs statically for DiskStorage, and nodejs_compat alone does not provide it. Under the flag, workerd mounts an in-memory fs (verified openSync/writeSync/mkdirSync/existsSync round-trip), so DiskStorage resolves and works — ephemeral per isolate.
  • package.json/pnpm-lock.yaml — workerd + esbuild as direct devDeps (the test resolves their binaries via createRequire), test script now runs both smokes.
  • README.md + docs/deploy.md — document the two-flag requirement and that the recipe is gated by a real-workerd smoke.

Verified

  • pnpm -r test — all 24 workspace projects green, including the new smoke (workerd 2026-10-12, ~55 ms).
  • wrangler dev with the updated toml — real boot, all routes curl-verified.
  • scripts/scriptc-gate.sh — 10/10 gates at 100% static.

Scope notes (remainder of #15)

  • The transport stays exactly what the runtime provides: app.fetch(req, env, ctx) consumed as the module-syntax ExportedHandler.fetch. new Request is unconstructible under scriptc 0.3.x, so no ELF-side Request fabrication is attempted — the ELF path remains app.fetchShim.
  • enable_nodejs_fs_module is needed because index.ts statically pulls multipart.ts's node:fs import even for fetch-only apps. A future fetch-only subpath that excludes DiskStorage from the import graph could drop that flag — left out of this PR as a package-graph change.
  • Generated dispatch (contracts/route-contract.md) still has no Web-Standards variant; app.fetch skips GenDispatch entirely (pre-existing "follow-up A" in code comments).

Link to Devin session: https://app.devin.ai/sessions/10c49bb9e0ce4c0f9dfad5e9910f0d3e
Open in Devin Desktop: https://app.devin.ai/desktop/session/10c49bb9e0ce4c0f9dfad5e9910f0d3e?variant=devin
Requested by: @espetro

…G fetch transport

The recipe claimed 'runs on Cloudflare Workers' while only an
in-process Node smoke existed. Boot the actual workerd binary
(esbuild bundle + .capnp config, real socket) and assert every
route over HTTP.

The first real boot surfaced a transport gap: nodejs_compat alone
does not provide node:fs, which multipart.ts imports statically
for DiskStorage. Add enable_nodejs_fs_module to wrangler.toml
(workerd mounts an in-memory fs, so DiskStorage resolves and
works, ephemeral per isolate) and document the flag in the
recipe README and deploy docs.

Refs #15
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying chttpjs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e3229c6
Status: ✅  Deploy successful!
Preview URL: https://0a4aa6a9.chttpjs.pages.dev
Branch Preview URL: https://devin-1792348637-wintercg-fe.chttpjs.pages.dev

View logs

@devin-ai-integration
devin-ai-integration Bot merged commit 51ffb56 into main Oct 18, 2026
3 checks passed
@devin-ai-integration
devin-ai-integration Bot deleted the devin/1792348637-wintercg-fetch branch October 18, 2026 18:45
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.

1 participant