Automattic / Automattic/wp-codebox
Execute bounded PHP commands through clean Playground processes
- Dominant language
- TypeScript
- Stars
- 16
- Forks
- 4
- Avg merge
- 59m
- Merged PRs (30d)
- 131
Description
## Problem
Bounded runtime entries with `processIdentity` require isolated PHP state while reusing one Playground server, its mounted filesystem, extensions, and runtime services.
The current HTTP request-worker approach does not provide that isolation: the request worker may already have loaded the managed WordPress installation. A project-owned PHPUnit bootstrap that loads its own WordPress tree then fails on inherited symbols such as `add_filter()`. Generic `proc_open()` spawning remains inside the same PHP-WASM environment and does not solve the collision.
Project bootstrap mode also currently prepends the managed `/wordpress/wp-load.php`, which violates project ownership, while PHPUnit configurations without a bootstrap are rejected even though native PHPUnit accepts them.
## Upstream dependency
WordPress Playground issue: https://github.com/WordPress/wordpress-playground/issues/4145
WordPress Playground PR: https://github.com/WordPress/wordpress-playground/pull/4146
The Playground PR exposes `runInFreshProcess()` with preserved mounts/configuration and collision-free concurrent code execution.
## Required changes
- Route bounded code executions with a process identity through `playground.runInFreshProcess()`.
- Remove the HTTP request-worker endpoint and payload-file transport.
- Preserve per-entry runtime environment injection, including `bootstrap=none`.
- Let project bootstrap mode own WordPress loading instead of prepending managed `wp-load.php`.
- Permit project-mode PHPUnit configurations that declare no bootstrap.
- Fail clearly when the selected Playground backend lacks clean-process support.
## Acceptance criteria
- A project bootstrap may define `add_filter()` without colliding with managed WordPress symbols.
- Concurrent bounded entries retain isolated PHP state and their own service environment.
- Existing non-bounded Playground commands retain current behavior.
- Focused runner/bootstrap tests pass.
- Downstream TeamCity-equivalent validation passes all 680 PHPUnit suites with zero failures, timeouts, or cancellations.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the bounded execution path and the playground.runInFreshProcess() entry point, then review the runner/bootstrap tests for environment injection, project-owned WordPress loading, and bootstrap=none. Done means clean-process support fails clearly when unavailable, concurrent bounded entries remain isolated, non-bounded commands are unchanged, focused tests pass, and the 680-suite validation has no failures, timeouts, or cancellations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, typescript
- Domain
- backend, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100