Automattic / Automattic/wp-codebox

Execute bounded PHP commands through clean Playground processes

Offen
#1,937 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
17
Forks
4
Ø Merge
59 Min.
Gemergte PRs (30 T.)
131

Beschreibung

## 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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit dem begrenzten Ausführungspfad und dem Einstiegspunkt playground.runInFreshProcess() und überprüfe anschließend die Runner-/Bootstrap-Tests auf Umgebungsinjektion, das Laden des projek eigenen WordPress und bootstrap=none. Als abgeschlossen gilt die Unterstützung für saubere Prozesse, wenn sie bei Nichtverfügbarkeit eindeutig fehlschlägt, gleichzeitig ausgeführte begrenzte Einstiegspunkte isoliert bleiben, nicht begrenzte Befehle unverändert sind, die fokussierten Tests bestehen und die Validierung der 680-Test-Suite keine Fehler, Timeouts oder Abbrüche aufweist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php, typescript
Bereich
backend, testing
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.