fix: filter missing addon plugins in e2e wp-env setup#339
Conversation
The .wp-env.json includes addon paths (e.g. domain-seller) that only exist in the local monorepo but not in CI where only the core plugin is checked out. This caused wp-env start to fail with "plugin could not be found". Now the override step checks each plugin path exists before including it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe e2e.yml workflow replaces a basic echo command for PHP version configuration with a Node.js script that dynamically reads wp-env.json, applies matrix-based PHP versions, filters plugins by file existence across environments, and writes a generated override configuration file. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/e2e.yml:
- Line 65: The override object currently nests phpVersion under config which
makes it a wp-config constant; instead set phpVersion as a top-level property on
the override object. Update the override variable (named override) so it has
phpVersion: '${{ matrix.php }}' alongside env rather than inside config, and
keep config only for wp-config constants; ensure the resulting object shape
matches the wp-env override schema (top-level phpVersion, config, env).
🧹 Nitpick comments (1)
.github/workflows/e2e.yml (1)
34-34:actions/checkout@v2is deprecated (runs on Node.js 12).This is pre-existing, but
v2was sunset by GitHub. Consider bumping tov4(along withsetup-nodeandcachetov4) in a follow-up.
| const fs = require('fs'); | ||
| const path = require('path'); | ||
| const config = JSON.parse(fs.readFileSync('.wp-env.json', 'utf8')); | ||
| const override = { config: { phpVersion: '${{ matrix.php }}' }, env: {} }; |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
wp-env.override.json phpVersion schema documentation
💡 Result:
Where is the wp-env JSON schema documented?
WordPress publishes a JSON Schema for wp-env config files (.wp-env.json / .wp-env.override.json). You can reference it via $schema:
- Trunk schema URL:
https://schemas.wp.org/trunk/wp-env.json(note: tagged versions may not be available there). [2] - Pinned to a specific
@wordpress/envversion:
https://raw.githubusercontent.com/WordPress/gutenberg/@wordpress/env@x.y.z/schemas/json/wp-env.json[2]
Note: version 10.1.0 used a filename with a leading dot (.wp-env.json) in the schema name; later versions don’t. [2]
Example:
{
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"phpVersion": "8.2"
}What’s the phpVersion field (including in .wp-env.override.json)?
phpVersionis supported in.wp-env.jsonwith typestring | nulland sets the PHP version used bywp-env. Ifnull,wp-envuses its default. [1].wp-env.override.jsonuses the same shape; any fields you set there take precedence over.wp-env.json(with onlyconfigandmappingsbeing merged). [1]- Example value:
"phpVersion": "8.2"is shown in WordPress’swp-envdocs/posts and is expected to work. [3]
Sources: [1] [2] [3]
phpVersion must be a top-level property, not nested under config.
In the wp-env override schema, phpVersion sets the actual PHP version used by the environment and belongs at the top level of the override object. The config key is reserved for wp-config.php constants. As currently written, this code would add a PHP constant instead of changing the runtime version.
Fix
- const override = { config: { phpVersion: '${{ matrix.php }}' }, env: {} };
+ const override = { phpVersion: '${{ matrix.php }}', env: {} };📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const override = { config: { phpVersion: '${{ matrix.php }}' }, env: {} }; | |
| const override = { phpVersion: '${{ matrix.php }}', env: {} }; |
🤖 Prompt for AI Agents
In @.github/workflows/e2e.yml at line 65, The override object currently nests
phpVersion under config which makes it a wp-config constant; instead set
phpVersion as a top-level property on the override object. Update the override
variable (named override) so it has phpVersion: '${{ matrix.php }}' alongside
env rather than inside config, and keep config only for wp-config constants;
ensure the resulting object shape matches the wp-env override schema (top-level
phpVersion, config, env).
Summary
.wp-env.jsonincludes addon plugin paths (e.g.../addons/ultimate-multisite-domain-seller) that exist in the local monorepo but not in CI where only the core plugin is checked outwp-env startto fail with "The 'ultimate-multisite-domain-seller' plugin could not be found".wp-env.json, checks each plugin path withfs.existsSync(), and only includes plugins that are actually present on diskTest plan
npm run env:start:teststill works with addons present🤖 Generated with Claude Code
Summary by CodeRabbit