Skip to content

feat(runtime): add native PHP backend - #2475

Open
chubes4 wants to merge 9 commits into
mainfrom
fix/2473-native-php-backend
Open

feat(runtime): add native PHP backend#2475
chubes4 wants to merge 9 commits into
mainfrom
fix/2473-native-php-backend

Conversation

@chubes4

@chubes4 chubes4 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #2473

Summary

  • add an opt-in wordpress-native backend with a built-in contained Docker driver, alongside optional backendPackage driver injection
  • keep recipes backend-neutral: the same wordpress.run-php, wordpress.browser-actions, and wordpress.bench commands select Playground or native execution
  • run a digest-pinned linux/amd64 WordPress/PHP 8.4 Apache container with persistent OPcache and two prefork workers, plus a disposable tmpfs MariaDB sidecar
  • keep the database on an internal Docker network while the app publishes on loopback only, so the database is never externally reachable
  • install WordPress through its own API with generated fixture-only credentials, then execute validated steps-json browser interactions with a real form login
  • emit machine-readable provenance and benchmark evidence explicitly marked as local representative measurements, not production RUM
  • deterministic teardown removes both containers and both networks, including after partial startup

Live verification on a Docker runner

npm run test:native-docker-runtime passed against real containers (runs wp-codebox-2473-native-docker-live-3e41c332 and wp-codebox-2473-native-live-evidence-563f7d52).

Captured evidence:

  • browser steps: navigate and expect #wpadminbar both passed after an authenticated wp-login.php submission
  • network: WordPress 7.1 admin assets served over the published loopback port
  • page errors: none
  • benchmark: coldStartupMs: 3785, warmNoopPhpMs: 54, dynamicWordPressRequestMs: 32

For reference, #2473 measured Playground at 34.8 s cold and 0.5–0.7 s warm for stock WordPress, so this backend provides the intended performance lane.

Other verification

  • npm run build
  • npm run test:native-runtime
  • npm run test:runtime-services
  • npm run check
  • git diff --check

Known limitations

  • Live containment requires Docker; without it the integration lane skips explicitly as trusted-containment-tools-unavailable rather than falling back to host PHP.
  • Readonly directory mounts are one-time source snapshots copied into the container, not live Docker bind mounts; unsupported mount modes fail explicitly.
  • A matched Playground-vs-native benchmark table still needs to be collected in one Docker-capable environment; only the native side is measured here.
  • npm run check also exercises tests/agent-runtime-components.test.ts, which is sensitive to locally discovered components outside this change.

AI assistance: OpenCode with openai/gpt-5.6-terra and openai/gpt-5.6-sol was used to inspect the runtime architecture, implement the backend, and run live containerized verification.

@chubes4
chubes4 marked this pull request as ready for review September 3, 2026 19:13
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.

Add a native PHP runtime backend for representative performance testing

1 participant