New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge Optimization Detective into trunk #1079
Conversation
Rely on server-side breadcrumbs for detection and optimization
…ge-loading-optimization * origin/trunk: (149 commits) Manually fix remaining phpcs issues Run php-format Discontinue excluding all WordPress-Extra from tests so phpcbf can format Add @joemcgill to images and measurement focuses. Update codeowners, removing inactive contributors. Introduce perflab-plugin-management.js Load migration script in settings page Update function name Apply suggestions from code review Address slow query feedbacks Revise migration pointer un-dismissal to work for all admins Rename variable. improve code Require Node v20 un-dismiss the migration pointer Minor update to return doc. Move inline script in to JS Fix PHP Documentation Standards Remove duplicate admin notice call Address review feedback ...
… merge/trunk-into-image-loading-optimization * 'trunk' of https://github.com/WordPress/performance: Remove scheduler from globals since not yet used Fix or ignore eslint rules Remove modules/images/webp-uploads/fallback.js from ignorePatterns Run format-js on JS files Cherry pick fixes to JS linting from feature/image-loading-optimization Prevent sending header during test
…-optimization Merge trunk into feature/image-loading-optimization
…om/WordPress/performance into add/ilo-tests * 'feature/image-loading-optimization' of https://github.com/WordPress/performance: (155 commits) Remove scheduler from globals since not yet used Fix or ignore eslint rules Remove modules/images/webp-uploads/fallback.js from ignorePatterns Run format-js on JS files Cherry pick fixes to JS linting from feature/image-loading-optimization Prevent sending header during test Manually fix remaining phpcs issues Run php-format Discontinue excluding all WordPress-Extra from tests so phpcbf can format Add @joemcgill to images and measurement focuses. Update codeowners, removing inactive contributors. Introduce perflab-plugin-management.js Load migration script in settings page Update function name Apply suggestions from code review Address slow query feedbacks Revise migration pointer un-dismissal to work for all admins Rename variable. improve code Require Node v20 ...
… add/ilo-tests * 'trunk' of https://github.com/WordPress/performance: Re-run composer update with PHP 8.1 Run composer update Fix PHPStan errors in tests
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
This reverts commit 4656cbf.
This reverts commit 767c895.
Update Optimization Detective plugin build process Co-authored-by: thelovekesh <thelovekesh@git.wordpress.org> Co-authored-by: westonruter <westonruter@git.wordpress.org> Co-authored-by: felixarntz <flixos90@git.wordpress.org>
…ation-detective-readme
…-readme Update readme and phpdoc for initial Optimization Detective release Co-authored-by: westonruter <westonruter@git.wordpress.org> Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org> Co-authored-by: felixarntz <flixos90@git.wordpress.org>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@westonruter Almost looks good, a few points of feedback. Please take a look, though we could also consider addressing some of them afterwards.
@@ -32,6 +33,7 @@ build-cs/composer.lock | |||
|
|||
node_modules/ | |||
vendor/ | |||
plugins/optimization-detective/detection/web-vitals* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be a good idea to use build
directories within the individual standalone plugins for things like this. If we want to exclude built resources, it shouldn't be necessary to add exclusions for every individual one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Let's do that in another PR to trunk
.
/* | ||
* This settings section technically includes a field, however it is directly rendered as part of the section | ||
* callback due to requiring custom markup. | ||
*/ | ||
add_settings_section( | ||
'output-buffering', | ||
__( 'Output Buffering', 'performance-lab' ), | ||
'perflab_render_server_timing_page_output_buffering_section', | ||
PERFLAB_SERVER_TIMING_SCREEN | ||
); | ||
if ( ! has_filter( 'template_include', 'od_buffer_output' ) ) { | ||
/* | ||
* This settings section technically includes a field, however it is directly rendered as part of the section | ||
* callback due to requiring custom markup. | ||
*/ | ||
add_settings_section( | ||
'output-buffering', | ||
__( 'Output Buffering', 'performance-lab' ), | ||
'perflab_render_server_timing_page_output_buffering_section', | ||
PERFLAB_SERVER_TIMING_SCREEN | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change really needed? Is it harmful to have both output buffers active?
I'm asking since I don't like the idea of excluding PL specific logic because of another standalone plugin. There are lots of WordPress plugins that have output buffers, so it's a bit random we would cater for the one from Optimization Detective here just because it's also our plugin. What would be the problem of having the Server-Timing output buffering active in combination with the one from Optimization Detective?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thinking was that if Optimization Detective introduces an official way to do output buffering (for Core-43258), that this can be reused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And that if a PL standalone plugin is already doing output buffering, it's kinda unnecessary to do yet more output buffering on top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words, it's the Performance Lab plugin taking advantage of the capabilities of one of its own feature plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there was a standard way to do this, that would be great indeed. However, I'm not sure there's good value in connecting the plugins in this way. It comes with its own set of questions, such as:
- Which of the two plugins should be the "source of truth" for output buffering when both are active?
- If PL uses OD's output buffering capabilities, how do we deal with the somewhat confusing implications of that for the Server-Timing screen? It's strange to just hide the control without any explanation.
I'm not sure it's worth discussing those questions given the two plugins could just work independently. And again, it's somewhat arbitrary anyway. If any other plugin can have its own output buffering, I don't think it's important that these two plugins don't both add their own.
For those reasons I'd prefer to either remove this integration to simplify things, or alternatively to polish it. Could be done in a follow up PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it doesn't impact the Optimization Detective plugin's codebase, let's do in another PR.
@@ -93,7 +95,7 @@ static function () { | |||
); | |||
?> | |||
</p> | |||
<?php if ( ! perflab_server_timing_use_output_buffer() ) : ?> | |||
<?php if ( ! perflab_server_timing_use_output_buffer() && ! has_filter( 'template_include', 'od_buffer_output' ) ) : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
// Skip doing anything with output buffering if it is already enabled via Optimization Detective. | ||
if ( has_filter( 'template_include', 'od_buffer_output' ) ) { | ||
// It feels better if this could rather be replaced with add_action( 'shutdown', [ $this, 'send_header' ] ) | ||
// However, this does not work because the buffer is sent before the shutdown callback is executed. | ||
add_filter( | ||
'od_template_output_buffer', | ||
function ( $buffer ) { | ||
$this->send_header(); | ||
return $buffer; | ||
}, | ||
PHP_INT_MAX | ||
); | ||
return $passthrough; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
@@ -23,6 +23,7 @@ nbproject/ | |||
|
|||
build | |||
.wp-env.override.json | |||
*.asset.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other comment below, if we used a build
directory, we wouldn't need to explicitly exclude this from here and a few other places.
<file>.</file> | ||
<exclude-pattern>./build/*</exclude-pattern> | ||
<exclude-pattern>./node_modules/*</exclude-pattern> | ||
<exclude-pattern>./plugins/*</exclude-pattern> | ||
<exclude-pattern>./vendor/*</exclude-pattern> | ||
<exclude-pattern>*.asset.php</exclude-pattern> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, Gutenberg does this as well: https://github.com/WordPress/gutenberg/blob/4056660341852e2b627127d2dacbbedd38cb6e3a/phpcs.xml.dist#L80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, maybe we can address additional feedback in separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to merge, though let's address the two points from my previous review separately.
See #1082 |
Since Optimization Detective has been approved by the Plugin Review team, it is ready to be committed to WordPress.org. Therefore, it should be merged into
trunk
and the feature branch should be retired.Blocked by: