Skip to content
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

Add support for autoloading enhancements in WordPress 6.6 trunk to autoloaded options Site Health check #1112

Merged
merged 9 commits into from
Apr 4, 2024

Conversation

felixarntz
Copy link
Member

@felixarntz felixarntz commented Apr 4, 2024

Summary

This PR fixes the test failures seen in https://github.com/WordPress/performance/actions/runs/8547642712/job/23420147133?pr=1111, which are unrelated to the PR they're reported on. The next time we'll make a PHP change against trunk, we should see the same failures too.

Relevant technical choices

The failures happen due to https://core.trac.wordpress.org/changeset/57920 which makes an intentional change regarding large autoloaded options, to no longer autoload them unless $autoload = true is explicitly provided. Additionally, there are now more database values than yes that should trigger autoloading. All of this is expected. Plugins that perform low-level optimizations around autoloaded options are likely to run into similar failures - all of which is straightforward to fix though. This is why the underlying Trac ticket is annotated with needs-dev-note.

So we need to do two things:

  • In the production code, update our low-level database queries to take into account the new values that should result in options being autoloaded, via the new core function wp_autoload_values_to_autoload() that exists for this purpose.
  • In the tests, explicitly force the excessively large options in the tests to be autoloaded, otherwise they obviously won't get picked up as autoloaded options.

Copy link

github-actions bot commented Apr 4, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: thelovekesh <thelovekesh@git.wordpress.org>
Co-authored-by: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>
Co-authored-by: joemcgill <joemcgill@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@felixarntz felixarntz added [Type] Bug An existing feature is broken Infrastructure Issues for the overall performance plugin infrastructure skip changelog PRs that should not be mentioned in changelogs labels Apr 4, 2024
@felixarntz felixarntz added this to the performance-lab 3.0.0 milestone Apr 4, 2024
@felixarntz
Copy link
Member Author

felixarntz commented Apr 4, 2024

Once this fix is merged into release/3.0.0, we should also merge it into trunk to avoid failures in that branch.

@felixarntz felixarntz added the [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only label Apr 4, 2024
@felixarntz felixarntz changed the title Fix PHPUnit test failures in trunk due to large option autoload optimization in core Add support for autoloading enhancements in WordPress 6.6 trunk to autoloaded options Site Health check Apr 4, 2024
@felixarntz felixarntz added [Type] Enhancement A suggestion for improvement of an existing feature and removed [Type] Bug An existing feature is broken skip changelog PRs that should not be mentioned in changelogs labels Apr 4, 2024
@felixarntz felixarntz changed the base branch from trunk to release/3.0.0 April 4, 2024 01:51
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall look good to me. Left some nit-pick

Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one suggestion but not a blocker.

Comment on lines 105 to 109
if ( function_exists( 'wp_autoload_values_to_autoload' ) ) {
$autoload_values = wp_autoload_values_to_autoload();
} else {
$autoload_values = array( 'yes' );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than repeating this several times, how about consolidating it to our own perflab_aao_get_autoload_values() helper?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joemcgill Great idea, done in 0316586

@felixarntz felixarntz merged commit 5b9d0ba into release/3.0.0 Apr 4, 2024
17 checks passed
@felixarntz felixarntz deleted the fix/trunk-phpunit-test-failures branch April 4, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall performance plugin infrastructure [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants