Skip to content

fix(cloudflare-pages): stage Wrangler module output - #40

Merged
hseshadr merged 1 commit into
mainfrom
fix/cloudflare-pages-outdir-20260829
Aug 30, 2026
Merged

fix(cloudflare-pages): stage Wrangler module output#40
hseshadr merged 1 commit into
mainfrom
fix/cloudflare-pages-outdir-20260829

Conversation

@hseshadr

Copy link
Copy Markdown
Owner

TL;DR

Wrangler 4.103 serializes a multipart upload when pages functions build --outfile is used. The provider was staging that upload body as dist/_worker.js, so Cloudflare rejected the single deployment upload.

This switches the Functions build to the official --outdir module output and stages a valid advanced-mode _worker.js/ tree.

What changed

  • build Pages Functions into _worker.js/ with Wrangler --outdir
  • reject multipart output, unsafe module paths, output conflicts, tampering, and unauthenticated auxiliary modules before provider transport
  • authenticate auxiliary module bytes against the exact closed dist/** and functions/** inputs with content-only, bounded digest queries
  • preserve _routes.json, default static deployments, one provider mutation, and the existing TypeScript API
  • document the advanced-mode staging and provenance contract

Regression coverage

  • pinned Wrangler 4.103 real-runtime proof of runnable, non-multipart module output
  • real executable input mode normalization (0755 input to 0644 output)
  • toolchain Wasm escape rejection even when Wrangler omits source provenance from the metafile
  • multipart, path escape, conflict, tamper, and pre-transport rejection cases

Verification

  • provider: 175 passed, 93.91% coverage
  • root: 219 passed, 96.38% coverage
  • strict mypy, Ruff, Xenon A, per-core branch floor, schema, and dependency audits passed
  • fresh dagger develop and dagger functions passed
  • Python and TypeScript generated-client module fixtures passed
  • independent review: Ready Yes; no Critical or Important findings

No Cloudflare credentials were used and no provider mutation was made during verification.

Use Wrangler's official outdir output for Pages Functions and enforce authenticated module provenance before staging an advanced-mode worker tree.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01WhrjTokoEF6Zax8EASdGsv
@hseshadr
hseshadr merged commit cd28585 into main Aug 30, 2026
3 checks passed
@hseshadr
hseshadr deleted the fix/cloudflare-pages-outdir-20260829 branch August 30, 2026 04:22
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