Repository navigation
Run every site as a local environment, so Application Passwords can be tested - #662
Merged
Merged
Conversation
…e tested Sites fell back to the "production" environment type, and Core offers Application Passwords only over HTTPS or on a "local" site, so on the dev server's plain HTTP the feature was missing and a ticket about it could not be tested. The contributor cannot fix it: Playground writes wp-config.php itself. Every site now gets WP_ENVIRONMENT_TYPE "local", as Core's own Docker environment does, and WP_DEVELOPMENT_MODE from what the site is: "core" for a Core checkout, "plugin" for Gutenberg. They are set in the serve plan, beside the Gutenberg file locks, rather than in the debug set, whose values are all booleans. Neither is a setting. Fixes #598. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every site the app sets up runs as a
productionenvironment, because nothing definesWP_ENVIRONMENT_TYPEand Core falls back to it. Core offers Application Passwords only over HTTPS or on alocalsite, and the dev server is plainhttp://127.0.0.1, so a contributor at WordCamp Rajasthan's Contributor Day could not test an Application Passwords ticket. They could not fix it either: Playground writeswp-config.phpitself, and there is no file to edit.What changes
Root cause: the only constants a site gets are the ones the app puts in the blueprint, and none of them said what kind of environment the site is.
WP_ENVIRONMENT_TYPE=local, as Core's own Docker environment does by default.WP_DEVELOPMENT_MODEthat follows from what it is:corefor a Core checkout,pluginfor Gutenberg, which is a plugin mounted into a stock WordPress.planServeConstants, beside the Gutenberg file locks, not inWP_DEBUG_CONSTANTS: they are strings, and that set is booleans only, by design and by test.productionbehaviour can use Core's filters from an mu-plugin.How to test this
Platforms: any. Nothing here touches paths, spawning or line endings.
Starting state: a Core site that has finished setup, with its dev server stopped, and a Gutenberg site if you have one.
trunkthere is none.What must not have happened:
localwould defaultWP_DEBUGto on, but the app always defines it, so the setting still wins.The tests that cover this are the two new cases in
tests/unit/playground-plan.test.cjsand the new assertions intests/unit/runner-wiring.test.cjs. All four fail ontrunk's code and pass here; I checked by restoring the old file and running them.Risks and limitations
productiontype changes more than Application Passwords. Pingbacks and trackbacks are off, in and out, and Site Health skips its page cache, object cache and HTTPS tests and rates errors shown to visitors as recommended. Core's Docker environment behaves the same way, and the docs table says so, but a ticket about one of these now needs a filter to reproduce.pluginmode has no effect today. Neither Core nor Gutenberg reads it. It is set because it describes the site, andcorewould describe a checkout the Gutenberg site does not have.Related
Fixes #598
Design decisions and alternatives considered
WP_DEBUG_CONSTANTS. I did not, because every value there is a boolean, and a test asserts it, to keep the string"false"out of a PHP constant. The serve plan is already where strategy-specific constants go, and the development mode depends on the strategy.plugininstead ofcore, since Core acceptscore,plugin,themeandall.Review outcome (required — see AGENTS.md)
2 [fix here] should-fix · 4 [fix here] nits · 1 [follow-up] — all 6 [fix here] fixed.
Fixed: the code comment and docs misdescribed what
coremode does. It only skips the cached list of Core block stylesheets, not block.json or theme.json caches.Fixed: the comment said
localchanges little else. It now names pings and Site Health, and the docs row does too.Fixed, nits: the runner's comment on the last spread, the header line of
planServeConstants, the docs sentence that introduces the table as debug constants, and a third test that only repeated the two exact-value tests.Deferred: the comment in
src/settings.cjssaying every other constant comes fromwp-debug-constants.js. It was already untrue ontrunk, because of the SMTP constants and the Gutenberg locks, so it is not this change's to fix.Review: completed — separate agent context (Explore subagent) given the diff and the review standard; reviewed the uncommitted working tree on base
6d5f334;npm test2083 pass, 0 fail;eslintandstylelintclean on this checkout. Outcome as above.Since review: the fixes listed above, committed as
1007778with no other changes; affected suites and the full suite re-run, green.Implementation notes
productionlocalcorelocalpluginLOCAL_WP_ENVIRONMENT_TYPE=localandLOCAL_WP_DEVELOPMENT_MODE=coreinwordpress-develop's.env.example, written intowp-config.phpbytools/local-env/scripts/install.js.@wp-playgroundor@php-wasmdefines either constant, so there is no clash with Playground's ownwp-config.php.Screenshots or recording
The app's own windows do not change. The visible difference is the Application Passwords section on WordPress's profile screen, which step 2 above shows.
🤖 Generated with Claude Code