Skip to content

Add Cloudflare Worker PHP-WASM and remote ZIP gates - #4111

Draft
chubes4 wants to merge 11 commits into
WordPress:trunkfrom
chubes4:spike/cloudflare-workers
Draft

Add Cloudflare Worker PHP-WASM and remote ZIP gates#4111
chubes4 wants to merge 11 commits into
WordPress:trunkfrom
chubes4:spike/cloudflare-workers

Conversation

@chubes4

@chubes4 chubes4 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What?

Add an experimental Cloudflare Worker runtime gate for PHP-WASM and filtered remote ZIP ranges.

The Worker proves two independently addressable prerequisites for running WordPress under Cloudflare's 128 MB isolate limit:

  • PHP 8.5 Asyncify boots and executes in a deployed Worker.
  • decodeRemoteZip() traverses the current WordPress archive's 4,401 central-directory entries and emits only wp-includes/version.php through HTTP Range requests.
  • Cloudflare invocation telemetry provides authoritative CPU and wall time while response correlation identifies cold and warm isolate execution.

Stack

This draft is stacked on #4110, which repairs generic filtered Range decoding. Once #4110 lands, its commits drop out of this diff.

Downstream consumer: Automattic/wp-codebox#1838

Remote evidence

Deployed Worker: https://playground-php-wasm-memory-gate.chubes.workers.dev

  1. Request / and expect HTTP 200 with PHP 8.5.8 and marker cloudflare-php-wasm-memory-gate.
  2. Request /?probe=remote-zip and expect HTTP 200 with marker cloudflare-remote-zip-range-gate, predicateEntries: 4401, predicateMatches: 1, and path wordpress/wp-includes/version.php.

Verified deployment version: 44c379ba-4d9a-42b8-94cb-c0ddc7140434. This deployment predates the latest telemetry correction; the telemetry workflow is documented and covered locally, but requires a separately authorized deployment for new remote evidence.

Testing Instructions

  1. Run npx nx typecheck playground-cloudflare-worker-memory-gate.
  2. Run npx nx test playground-cloudflare-worker-memory-gate.
  3. Run npx nx lint playground-cloudflare-worker-memory-gate.
  4. Run npm exec -- wrangler deploy --dry-run --config packages/playground/cloudflare-worker/wrangler.jsonc.
  5. With an explicit Cloudflare account and deployment authorization, deploy the Worker, stream wrangler tail --format json, and correlate unique run query parameters with invocation CPUTimeMs and WallTimeMs.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenAI GPT-5.6 Sol via OpenCode
  • Used for: Cloudflare runtime investigation, implementation, workerd compatibility diagnosis, telemetry correction, regression testing, and evidence documentation in collaboration with Chris Huber.

@chubes4

chubes4 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

Stack verification after downstream integration:

The downstream disposable Worker proof restored canonical R2 state, advanced sequentially, serialized concurrent mutations, and reported sqlitePersisted: false. This stack remains the test/integration surface while #4110 goes through upstream review.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode and Homeboy
  • Model: OpenAI GPT-5.6 Sol
  • Used for: Stack verification, cross-repository integration, and evidence capture with Chris reviewing and owning the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package][@php-wasm] Stream Compression [Type] Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant