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

Support changing autoload value for largest autoloaded options in Site Health check #1048

Merged
merged 20 commits into from Mar 21, 2024

Conversation

mukeshpanchal27
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 commented Mar 12, 2024

Summary

Fixes #889

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

@mukeshpanchal27 mukeshpanchal27 added [Type] Enhancement A suggestion for improvement of an existing feature [Module] Audit Autoloaded Options Issues for the Audit Autoloaded Options Health Check module [Focus] Database Optimization Issues related to the Database Optimization focus area labels Mar 12, 2024
@mukeshpanchal27 mukeshpanchal27 self-assigned this Mar 12, 2024
@mukeshpanchal27 mukeshpanchal27 added the no milestone PRs that do not have a defined milestone for release label Mar 12, 2024
@mukeshpanchal27 mukeshpanchal27 marked this pull request as ready for review March 12, 2024 09:41
Copy link

github-actions bot commented Mar 12, 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: mukeshpanchal27 <mukesh27@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>

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

modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/hooks.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/hooks.php Outdated Show resolved Hide resolved
@mukeshpanchal27
Copy link
Member Author

@westonruter, I have addressed the review feedback. The PR is ready for another round of review. Thank you!

modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/hooks.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/hooks.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/hooks.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/hooks.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@mukeshpanchal27 I don't have much to add to the existing feedback. Most importantly from my perspective though, we either need to do the AJAX + JS approach the right way, or alternatively go with the much simpler alternative of using a page reload and a regular WP Admin callback via "action URL".

modules/database/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
modules/database/audit-autoloaded-options/hooks.php Outdated Show resolved Hide resolved
@mukeshpanchal27
Copy link
Member Author

Thanks, @felixarntz, @westonruter, and @swissspidy for the feedback. Per the discussion in #1048 (comment), I also believe that the action URL approach is the right choice. Additionally, I've added an admin notice when the option is updated.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@mukeshpanchal27 This looks very close now. I only have one broader suggestion on how to handle the option size to display to the user more dynamically.

@mukeshpanchal27
Copy link
Member Author

Thank you, @felixarntz and @westonruter, for your feedback. The PR is now ready for the final review and merge.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@mukeshpanchal27 Two small last things, otherwise this is good to go IMO. Great stuff!

includes/site-health/audit-autoloaded-options/hooks.php Outdated Show resolved Hide resolved
includes/site-health/audit-autoloaded-options/helper.php Outdated Show resolved Hide resolved
@felixarntz felixarntz added this to the performance-lab 3.0.0 milestone Mar 20, 2024
@felixarntz felixarntz removed the no milestone PRs that do not have a defined milestone for release label Mar 20, 2024
@felixarntz felixarntz changed the title Support changing autoload value for largest autoloaded options Support changing autoload value for largest autoloaded options in Site Health check Mar 20, 2024
@westonruter
Copy link
Member

Will there be tests added for this?

Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
@swissspidy
Copy link
Member

Will there be tests added for this?

This would be a good candidate for an e2e test. Makes me wonder why we don't have any 🤔

@mukeshpanchal27
Copy link
Member Author

Will there be tests added for this?

This would be a good candidate for an e2e test. Makes me wonder why we don't have any 🤔

We don't currently have e2e tests set up in the PL repository. I'm exploring how we can add tests for these changes. 😅

@swissspidy
Copy link
Member

I saw that, hence the wondering why :)

here, some php unit tests should be possible

@mukeshpanchal27
Copy link
Member Author

@swissspidy @westonruter I've added unit tests. It appears that the unit tests are failing in WP 6.3 due to the introduction of wp_set_option_autoload in 6.4. We'll need to update the workflow accordingly.

@swissspidy
Copy link
Member

I thought #1062 updated the workflows? Why are we still testing 6.3? Let's just fix that here.

@@ -46,7 +46,7 @@ jobs:
wp: [ 'latest' ]
include:
- php: '7.4'
wp: '6.3'
wp: '6.4'
Copy link
Member

Choose a reason for hiding this comment

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

@mukeshpanchal27 @swissspidy Strange that this is not failing in trunk 🤔

But anyway, great to fix here.

@felixarntz
Copy link
Member

@westonruter Which kinds of tests are you envisioning? In terms of PHPUnit, maybe a test of the "action function" to update the autoload values would be useful. I'm not sure it's worth adding tests for the Site Health UI bits as that's relatively trivial and IMO more difficult to test than it provides value.

@westonruter westonruter merged commit 5e2bdb5 into trunk Mar 21, 2024
28 checks passed
@westonruter westonruter deleted the fix/889-update-autoload branch March 21, 2024 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Database Optimization Issues related to the Database Optimization focus area [Module] Audit Autoloaded Options Issues for the Audit Autoloaded Options Health Check module [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support changing autoload value for largest autoloaded options
4 participants