Repository navigation
test(examples/cloudflare-workers): real-workerd smoke for the WinterCG fetch transport (issue #15) - #81
Merged
Conversation
…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
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Deploying chttpjs with
|
| Latest commit: |
e3229c6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0a4aa6a9.chttpjs.pages.dev |
| Branch Preview URL: | https://devin-1792348637-wintercg-fe.chttpjs.pages.dev |
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.
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 bundlessrc/main.ts(node:*kept external), a generated.capnpconfig serves it viaworkerd serveon a real socket, and plain HTTP requests assertGET /,GET /user/:id,POST /echo, and a 404. This is the no-bluff gate: the host supplies theRequest, the app answers aResponse.wrangler.toml— addsenable_nodejs_fs_moduletocompatibility_flags. Real boot failed withNo such module "node:fs":multipart.tsimportsnode:fsstatically forDiskStorage, andnodejs_compatalone does not provide it. Under the flag, workerd mounts an in-memory fs (verifiedopenSync/writeSync/mkdirSync/existsSyncround-trip), soDiskStorageresolves and works — ephemeral per isolate.package.json/pnpm-lock.yaml—workerd+esbuildas direct devDeps (the test resolves their binaries viacreateRequire),testscript 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 devwith the updated toml — real boot, all routes curl-verified.scripts/scriptc-gate.sh— 10/10 gates at 100% static.Scope notes (remainder of #15)
app.fetch(req, env, ctx)consumed as the module-syntaxExportedHandler.fetch.new Requestis unconstructible under scriptc 0.3.x, so no ELF-side Request fabrication is attempted — the ELF path remainsapp.fetchShim.enable_nodejs_fs_moduleis needed becauseindex.tsstatically pullsmultipart.ts'snode:fsimport even for fetch-only apps. A future fetch-only subpath that excludesDiskStoragefrom the import graph could drop that flag — left out of this PR as a package-graph change.contracts/route-contract.md) still has no Web-Standards variant;app.fetchskipsGenDispatchentirely (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