refactor: cleanup Main bootstrap class#404
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Refactors the plugin bootstrap by replacing the procedural includes/bootstrap.php flow with a Main singleton and a dedicated Requirements checker, while moving settings metadata helpers into Settings_Page and updating integration tests accordingly.
Changes:
- Introduces
includes/Main.phpas the new bootstrap entry (hooking intoplugins_loaded/init) and removesincludes/bootstrap.php. - Adds
includes/Requirements.phpand routes requirement failures through admin notices (incl. missingbuild/build.php). - Moves settings feature metadata generation into
includes/Settings/Settings_Page.phpand updates tests to use the new APIs/loader lifecycle.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
ai.php |
Defines plugin constants, loads autoloader, boots the new Main class. |
includes/Main.php |
New class-based bootstrap replacing procedural bootstrap logic. |
includes/Requirements.php |
Centralized runtime requirements checks + admin notice handling. |
includes/Settings/Settings_Page.php |
Colocates settings feature-group/metadata helpers into Settings_Page. |
includes/Features/Loader.php |
Adds init() and makes registration/initialization internals private; removes is_initialized(). |
includes/bootstrap.php |
Removed legacy bootstrap implementation. |
tests/bootstrap.php |
(Context) Activates plugin via ai.php, now gated by Requirements. |
tests/Integration/Includes/MainTest.php |
Adds integration coverage for new Main behaviors. |
tests/Integration/Includes/RequirementsTest.php |
Adds integration coverage for new Requirements behavior. |
tests/Integration/Includes/Settings/Settings_PageTest.php |
Renames/re-namespaces and updates tests for settings metadata now on Settings_Page. |
tests/Integration/Includes/Experiment_RegistryTest.php |
Updates to Loader::init() and reflection-based initialized assertions. |
tests/Integration/Includes/Experiment_LoaderTest.php |
Updates tests for new Loader API and private methods. |
tests/Integration/Includes/Experiments/*/*Test.php |
Updates experiment integration tests to use Loader::init() (or manual registration where needed). |
phpunit.xml.dist |
Removes ai.php from coverage include list. |
docs/ARCHITECTURE_OVERVIEW.md |
Updates architecture docs to reflect Main/Requirements and removal of bootstrap.php. |
docs/RELEASE_INSTRUCTIONS.md |
Updates version-bump instructions to reference ai.php as the constant source. |
Comments suppressed due to low confidence (1)
tests/Integration/Includes/Settings/Settings_PageTest.php:247
- This helper uses reflection to invoke a private method, but it never calls
$method->setAccessible( true ). Invoking a private method without setting it accessible will throw aReflectionException/fatal and fail the test run. AddsetAccessible(true)beforeinvoke()(or refactor the production code to expose this behavior via a public API that can be tested without reflection).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
edit: was the now-enforced dependency checks looking for the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #404 +/- ##
=============================================
+ Coverage 65.75% 68.15% +2.40%
- Complexity 763 808 +45
=============================================
Files 53 53
Lines 3863 3925 +62
=============================================
+ Hits 2540 2675 +135
+ Misses 1323 1250 -73
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
8a90df5 to
fa21ba6
Compare
dkotter
left a comment
There was a problem hiding this comment.
Looks good to me and tests well!

What?
Closes
This PR cleans up some of root-file tech debt. More specifically it:
ai.phpfileinc/bootstrap.phpfor aWordPress/AI/MainclassMainbootstrapper into aWordPress/AI/Requirementsclass.And then some cleanup resulting from that.
build/build.phpLoader::is_initialized()method, and apublic init()method.Why?
Pre-7.0 cleanup. The
Requirementsclass will likely also become the registry for per-specific features.How?
See diff.
Use of AI Tools
Opencode + GLM 5.1 to do a first pass of backfilling unit tests, followed by manual deslopping and backfilling cases it didn't get correctly.
Testing Instructions
npm run test:phpTesting Instructions for Keyboard
Screenshots or screencast