Skip to content

Conversation

@mukeshpanchal27
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 commented Oct 21, 2022

Summary

PR that updates focus areas in the codebase

  • Update perflab_get_focus_areas() to return the latest focus areas
  • Rename javascript focus area to css-and-js (CSS & JS), including the directory in modules
  • Move site-health modules into their new focus area directories
  • Implement logic in perflab_get_module_settings() to migrate all old ("legacy") module slugs to the new ones (e.g. if you have site-health/audit-autoloaded-options in the DB, it should become database/audit-autoloaded-options)

Fixes #554

Relevant technical choices

To fix the unit test you have to update default-enabled-modules.php using https://make.wordpress.org/performance/handbook/performance-lab/releasing-the-plugin/#update-list-of-default-enabled-modules.

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 Infrastructure Issues for the overall performance plugin infrastructure labels Oct 21, 2022
@mukeshpanchal27 mukeshpanchal27 added this to the 1.7.0 milestone Oct 21, 2022
@mukeshpanchal27
Copy link
Member Author

To fix the unit test related to default-enabled-modules.php I needs to update 7bdda84 file manually. You can update it using https://make.wordpress.org/performance/handbook/performance-lab/releasing-the-plugin/#update-list-of-default-enabled-modules.

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 solid overall, I mostly have minor feedback on updating the css-and-js focus area to js-and-css, and a few things to improve. The most important thing missing would be to add test coverage for the module settings migration logic.

@felixarntz felixarntz changed the title Updates focus areas in the codebase Introduce database focus area, rename JavaScript focus area to JS & CSS, and phase out Site Health focus area Oct 25, 2022
Comment on lines +113 to +114
$this->assertArrayNotHasKey( $legacy_module_slug, $settings, 'The settings do not contain the old legacy module slug in the database' );
$this->assertArrayHasKey( $current_module_slug, $settings, 'The settings contain an updated module slug in the database' );
Copy link
Member Author

Choose a reason for hiding this comment

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

As good habit like WP core,

Test methods with multiple assertions need a message parameter for each assertion, per Core Handbook - Writing PHPUnit Tests - Using Assertions.

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 Looks great! I'll LGTM this already, but please address the two minor remaining quirks (there strictly not a blocker though).

mukeshpanchal27 and others added 3 commits November 2, 2022 09:45
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
@mukeshpanchal27
Copy link
Member Author

@felixarntz I have addressed the feedback. Github shows the unit test related error for Fatal error: Uncaught Error: Class 'WP_Image_Editor_Imagick' not found in /var/www/html/wp-content/plugins/performance/tests/testdata/modules/images/webp-uploads/class-wp-image-doesnt-support-webp.php:14 https://github.com/WordPress/performance/actions/runs/3374928930/jobs/5601071400 I think it was introduce because of latest WP update. I think all new PR changes fails now.

@adamsilverstein Do we needs to open new issue?

@felixarntz
Copy link
Member

@mukeshpanchal27 Thanks! Looks like there's already #572, let's prioritize getting that through so that then we can refresh this PR here to make tests pass again.

Copy link
Member

@mehulkaklotar mehulkaklotar left a comment

Choose a reason for hiding this comment

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

@mukeshpanchal27 LGTM! 🚀

@felixarntz felixarntz merged commit 5ca3283 into trunk Nov 7, 2022
@felixarntz felixarntz deleted the fix/554-update-focus-areas-codebase branch November 7, 2022 19:03
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 [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revamp available focus areas

5 participants