-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Context
WordPress 5.8 ‘Tatum’ Retrospective.
Gutenberg plugin historically offered the way to develop new features for WordPress core. For the PHP part, we can identify the following role of the code shipped in the plugin:
- experimental features in the active development that might or might not end up in WordPress core
- stable features that are ready to be included in the next WordPress major release
- compatibility layer for previous version of WordPress that the Gutenberg plugin still supports: shims for missing functions, classes, and hooks to bring the same experience in every supported WP version
The most popular strategy for the minimum version of WordPress core supported is the current and the previous version of WordPress. Now, it would be WordPress 5.8 and 5.7. In practice, we still keep logic that bridges WordPress 5.6, but it should change soon.
What problem does this address?
The process of backporting PHP code from the Gutenberg plugin to WordPress core is the most significant pain point at the moment. It needs substantial refinements. The current structure of the Gutenberg plugin makes it hard to locate the changes necessary to bring to WordPress core together with related JavaScript logic. Before anything else, we should make it more transparent in the plugin what's already in WordPress core, what's ready to be backported, and what's still an experiment.
In addition to the challenges with identifying PHP changes that should be moved to the WordPress core from the plugin, there were other related issues:
- the same functions/classes used in the plugin and WordPress core weren't guarded correctly in the plugin triggering redeclaration errors
- the name of the functions/methods were too general in the context of WP core – it's something that could be caught earlier in the PR review process
Relevant feedback (full comment) shared on the post by @youknowriad – the editor release lead for WordPress 5.8:
On the Gutenberg side, there’s a lot of work that is done before PRs get merged, reviews, discussions… with the objective of a feature being ready for Core once it’s made stable without big changes. That said, when back porting these PRs into Core, we sometimes receive late feedback about these features as a lot of people only care about Core commits and ignore any activity in Gutenberg itself (understandable as there’s a lot of activity there). That feedback is great but is share a bit late in the process. Often times, the person doing the backport don’t know anything about the backported changes creating blockers and a lot of unnecessary back and forth.
Some initial ideas
Relevant feedback (full comment) shared on the post by @youknowriad – the editor release lead for WordPress 5.8:
Ideally, the backporting should be automatic, meaning at that moment, everything is done and we should require more changes, this ideal means two things: Align practices more and more between core and Gutenberg and encouraging folks to monitor commits in Gutenberg the same way they monitor commits in Core and not wait until things get in Core.
In the WordPress 5.8 release cycle, we experimented with the lib/compat subfolder that contains code necessary to run features included in the 5.8 release in older versions of WordPress. The idea would be that we can safely delete the folder as soon as WordPress 5.8 becomes the minimum supported version in the Gutenberg plugin.
In the future, we could take it to another level:
- Move feature development to
lib/compat/experimentalto have one place to seek code that is still not ready to integrate with WordPress core. We could introduce a convention that all class names and function names would have to be prefixed with thegutenbergprefix to better distinguish their current role. - Introduce
lib/compat/stableto keep code that is considered ready to move to WP core, it would introduce a formal step where code would get moved from the experiments folder. One of the benefits would be a simple option to integrate with GitHub CODEOWNERS notification system. The review process could be optimized towards common pain points like:- ensuring that the names of functions/classes/hooks are updated to meet WP core guidelines –
gutenbergprefix removed or replaced with something else - functions/classes would be conditionally declared to account for their future presence in WP core
- ensuring that the names of functions/classes/hooks are updated to meet WP core guidelines –
- Move code backported to WordPress core to the subfolder for the currently planned major versions of WordPress. In the WP 5.9 release cycle, we would move stable features from
lib/compat/stabletolib/compat/wordpress-5/9as soon as the same code gets added totrunkin the core.
