Automattic / Automattic/wp-codebox
Playground PHPUnit bootstrap fails when Composer platform check writes to undefined STDERR
- Dominant language
- TypeScript
- Stars
- 16
- Forks
- 4
- Avg merge
- 59m
- Merged PRs (30d)
- 131
Description
## Problem
A Homeboy-scoped WordPress PHPUnit run using WP Codebox Playground fails before any tests execute when a staged plugin's Composer `platform_check.php` reports a platform mismatch. The generated check calls `fwrite(STDERR, ...)`, but `STDERR` is undefined in the Playground eval context.
## Reproduction
Run a WordPress PHPUnit recipe against a Composer-backed plugin whose staged dependency platform check fails. Current observed command:
```sh
homeboy review test extrachill-api --path /var/lib/datamachine/workspace/extrachill-api@feat-227-concert-privacy --placement local --skip-lint -- --filter 'Concert_Tracking_RoutesTest|User_Settings_Privacy_RoutesTest|UserLocalSceneAdaptersTest'
```
Bootstrap fails in `load_component`:
```text
Error: Undefined constant "STDERR" at /wordpress/wp-content/plugins/extrachill-api/vendor/composer/platform_check.php:17
```
The trace reaches the plugin Composer autoloader from the Playground internal evaluator, before PHPUnit can run.
## Expected
The test environment should expose CLI stream constants when executing CLI-style PHPUnit workloads, or capture/report the underlying Composer platform mismatch without replacing it with an undefined-constant fatal.
## Impact
No test assertions execute, and the actual dependency/platform diagnostic is obscured by the missing runtime constant.
Observed with WP Codebox 0.12.14, `@automattic/wp-codebox-core` 0.12.14, `@automattic/wp-codebox-playground` 0.12.14, WordPress Playground latest.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with the Homeboy review command and trace the Playground internal evaluator into load_component and the staged plugin's Composer platform_check.php. Check how CLI-style PHPUnit workloads expose stream constants and how the platform mismatch is reported; done means the underlying Composer diagnostic is preserved without an undefined-constant fatal before PHPUnit runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, typescript, wordpress
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100