diff --git a/packages/runtime-cloudflare/README.md b/packages/runtime-cloudflare/README.md index a7ad67f7..b7690d32 100644 --- a/packages/runtime-cloudflare/README.md +++ b/packages/runtime-cloudflare/README.md @@ -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 diff --git a/packages/runtime-cloudflare/wrangler.jsonc b/packages/runtime-cloudflare/wrangler.jsonc index 29593a5e..1af2c80e 100644 --- a/packages/runtime-cloudflare/wrangler.jsonc +++ b/packages/runtime-cloudflare/wrangler.jsonc @@ -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 }] } diff --git a/tests/cloudflare-runtime.test.ts b/tests/cloudflare-runtime.test.ts index 9b89c29e..8177cf97 100644 --- a/tests/cloudflare-runtime.test.ts +++ b/tests/cloudflare-runtime.test.ts @@ -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" @@ -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) +})