Fix managed MySQL multisite PHPUnit composition#2107
Merged
Conversation
Collaborator
Author
|
Review blockers resolved in new commits through ca9dee5 (no amend): effective PHPUnit semantics now drive scoped dependency deferral; canonical preinstall excludes recipe-active, MU, and Composer loading; managed bootstrap reuses the seeded network schema; exact validated pluginFile/loadAs metadata controls dependency loading; and activated_plugin now receives Core's two-argument signature. Both contract runs and both workflow-lint runs are green, including the Docker-backed managed MySQL multisite E2E with MU/Composer guards and nonzero test/assertion evidence. |
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.
Summary
includes/install.phppath before the PHPUnit process boots WordPress with network constantsWP_PLUGIN_DIR, defer requested dependency activation until the network exists, and preserve declared activation orderFixes #2056.
Root cause
Managed PHPUnit previously defined
MULTISITEand current-network constants before requiring wp-phpunit's installer in the same PHP process. WordPress therefore entered multisite bootstrap whilewptests_blogsandwptests_sitemetadid not exist yet. The installer could not reach its canonicalinstall_network()/populate_network()phase from a valid bootstrap state.Recipe extra plugins were registered as runtime mounts, but Playground child executions require host inputs to be materialized into VFS. Extra-plugin mounts were omitted from the existing staged-input materialization pass, so declared local validation dependencies could be absent from
/wordpress/wp-content/plugins/<slug>. Setup also attempted requested activation before the managed network install.The Homeboy adapter already supplies the required shape: ordered
extra_pluginsentries withsource,slug, andactivate, plus matchingdependencyMounts. No adapter change or WP Codebox workaround for an adapter defect is needed.Lifecycle fix
/wordpress/wp-content/plugins/<slug>in child PHP executions.includes/install.phpwithrun_ms_tests, the managed MySQL credentials, and thewptests_prefix, but withoutMULTISITEor current-network constants.wp_install(),install_network(), andpopulate_network()to create and seedblogs,blogmeta,site,sitemeta,registration_log, andsignups.Single-site, SQLite, project/external bootstrap, and native database paths do not enter the new preinstall/deferred-activation branch.
Path and threat analysis
WP_PLUGIN_DIRrealpath()must resolve to a directory whose parent is the real plugin root, rejecting traversal, nested paths, missing sources, and symlink escapesPlugin Nameheader is required; malformed dependency metadata fails closedTests and evidence
npm run buildnpx tsx tests/phpunit-project-autoload.test.tsnpx tsx tests/recipe-runtime-setup-staged-materialization.test.tsnpm run smoke -- --group=packagetest:disposable-mysql-mysqli-e2ewas invoked locally but skipped because Docker is unavailable on the authoring host; CI should execute it with DockerThe disposable MySQL regression now asserts:
mysqliconnectivityupdate_network_option()/get_network_option()round-tripWP_PLUGIN_DIRConsumer rerun
For Extra-Chill/extrachill-events#355, rerun the existing Homeboy review test with
WP_CODEBOX_SOURCE_REF=fix-2056-managed-multisite-composition(or commitf5bca517) while retaining:{ "database_type": "mysql", "wp_codebox_multisite": true, "wp_codebox_phpunit_bootstrap_mode": "managed", "validation_dependencies": [ "<checkout>/.ci/data-machine", "<checkout>/.ci/data-machine-events" ] }Expected startup evidence is no missing
wptests_blogs/wptests_sitemetaerrors, both dependency directories present underWP_PLUGIN_DIR, requested dependencies network-active, and the consumer's real multisite groups executing against the seeded network schema. After merge, rerun againstWP_CODEBOX_SOURCE_REF=mainfor final consumer evidence.