Automattic / Automattic/wp-codebox
Execute bounded PHP commands through clean Playground processes
- Lingua principale
- TypeScript
- Stelle
- 17
- Fork
- 4
- Merge medio
- 59m
- PR unite (30g)
- 131
Descrizione
## 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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia dal percorso di esecuzione vincolato e dal punto di ingresso playground.runInFreshProcess(), quindi esamina i test di runner/bootstrap per l’iniezione dell’ambiente, il caricamento di WordPress di proprietà del progetto e bootstrap=none. Il lavoro è completato quando il supporto per i processi puliti fallisce chiaramente quando non è disponibile, gli ingressi vincolati concorrenti rimangono isolati, i comandi non vincolati restano invariati, i test mirati hanno esito positivo e la validazione della suite di 680 test non presenta errori, timeout o cancellazioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php, typescript
- Ambito
- backend, testing
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100