Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/runtime-cloudflare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This additive integration is the first acceptance gate for [wp-codebox#1838](https://github.com/Automattic/wp-codebox/issues/1838). It compiles the current PHP 8.5 Asyncify Wasm asset for workerd, boots WordPress through Playground with the current SQLite integration release, executes PHP, and returns a Codebox runtime-command-result envelope containing the stable `wp-codebox/cloudflare-runtime-health/v1` health payload.

The Worker owns Cloudflare transport and isolate lifecycle. This gate uses one Playground PHP instance per isolate; Durable Objects will serialize site mutation in a later gate. The response identifies the generic `wordpress-playground` backend and `wordpress` environment; callers do not receive Cloudflare binding or limit details. Runtime snapshots, restore, R2, serialization, and cold restoration are deferred to later gates.
The Worker owns Cloudflare transport and isolate lifecycle. Full WordPress initialization requires the paid-plan five-minute CPU allowance, declared as `limits.cpu_ms: 300000`; Cloudflare's fixed 128 MB isolate memory limit remains unchanged. This gate uses one Playground PHP instance per isolate; Durable Objects will serialize site mutation in a later gate. The response identifies the generic `wordpress-playground` backend and `wordpress` environment; callers do not receive Cloudflare binding or limit details. Runtime snapshots, restore, R2, serialization, and cold restoration are deferred to later gates.

## Verification

Expand Down
1 change: 1 addition & 0 deletions packages/runtime-cloudflare/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"main": "src/worker.ts",
"compatibility_date": "2026-07-18",
"compatibility_flags": ["nodejs_compat"],
"limits": { "cpu_ms": 300000 },
"rules": [{ "type": "CompiledWasm", "globs": ["**/*.wasm"], "fallthrough": false }]
}
6 changes: 6 additions & 0 deletions tests/cloudflare-runtime.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from "node:assert/strict"
import { readFile } from "node:fs/promises"
import test from "node:test"
import { RUNTIME_COMMAND_RESULT_SCHEMA } from "../packages/runtime-core/src/runtime-contracts.js"
import { CLOUDFLARE_RUNTIME_HEALTH_MARKER, CLOUDFLARE_RUNTIME_HEALTH_SCHEMA, cloudflareRuntimeHealthResponse } from "../packages/runtime-cloudflare/src/health-envelope.js"
Expand All @@ -22,3 +23,8 @@ test("Cloudflare health response preserves the Codebox execution envelope", asyn
assert.equal(payload.execution.status, "ok")
assert.deepEqual(payload.execution.json, health)
})

test("Cloudflare runtime declares the paid-plan WordPress boot CPU budget", async () => {
const config = JSON.parse(await readFile(new URL("../packages/runtime-cloudflare/wrangler.jsonc", import.meta.url), "utf8")) as { limits?: { cpu_ms?: number } }
assert.equal(config.limits?.cpu_ms, 300_000)
})