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

Fixes the overall score for related keyphrase and collection assessors #21941

Merged
merged 18 commits into from
Feb 3, 2025

Conversation

mykola
Copy link
Contributor

@mykola mykola commented Jan 2, 2025

Context

  • Fix the related keyphrase status from orange to green when all the assessment results are good.

Summary

This PR can be summarized in the following changelog entry:

  • [wordpress-seo-premium] Fixes a bug where the overall score for the Related keyphrase analysis would still be orange when all the individual assessment results were green.
  • [yoastseo] Adds a score aggregator that only counts valid results.
  • [yoastseo] Removes unused code related to the tree parser.
  • [shopify-seo] Fixes a bug where the overall score for the Related keyphrase analysis would still be orange when all the individual assessment results were green.
  • [shopify-seo] Fixes a bug where the overall SEO score for collections would still be orange when all the individual assessment results were green.

Relevant technical choices:

  • New ValidOnlyResultsScoreAggregator was added before the aggregate filter assessments without a score. A similar approach is used in ReadabilityScoreAggregator. Also score aggregator is introduced as a field for Accessor classes By default is SEOScoreAggregator and redefined for accessor were valid only results should counted.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Create a post with content (this article can be used).
  • Click Add related keyphrase -> Keyphrase: insights
  • Make sure that scores are green for every assessment by taking the advice from each individual assessment.
  • Make sure that the score of the Related keyphrase emote is happy/green (one in the header of Related keyphrase)
  • Repeat the above, but set the content as cornerstone content.
  • Run the above steps in both WordPress and in Shopify.
    • In Shopify, also repeat the above steps for collections and confirm the overall score is green when all individual results are green.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • For solution separate a separate score aggregator was introduced that should impact only Related Keyword but please do a smoke test for Premium SEO analysis.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #4475

@coveralls
Copy link

coveralls commented Jan 2, 2025

Pull Request Test Coverage Report for Build 715b067bb4b8d73ce9cab66dd533378afdeee6eb

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 47 of 47 (100.0%) changed or added relevant lines in 10 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.008%) to 54.523%

Totals Coverage Status
Change from base Build 50c07b20a701a0eafca8bdf7a7e17f890ba58ecc: -0.008%
Covered Lines: 30144
Relevant Lines: 55708

💛 - Coveralls

@mykola mykola added changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog Shopify This PR impacts Shopify. changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog and removed changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog labels Jan 2, 2025
@mykola mykola marked this pull request as ready for review January 2, 2025 11:18
@Jordi-PV Jordi-PV modified the milestones: 24.3, 24.4 Jan 8, 2025
mykola added 3 commits January 9, 2025 15:05
…ll the results are good

#4475
Remove related keyword score aggregator and move filter into base SEOScoreAggregator
@mhkuu mhkuu removed this from the 24.4 milestone Jan 16, 2025
Copy link
Contributor

@mhkuu mhkuu left a comment

Choose a reason for hiding this comment

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

Nice work, but please do take the opportunity to refactor and reduce this code further now that we are touching it 👍

... otherwise we would need to do it anyway as part of resolving technical debt later on 😅

In terms of solving the bug, this PR solves the case for related keyphrase analysis, but specifically for the SEO analysis in collections in Shopify, we decided we would use the same aggregation strategy. So, we can add a custom score aggregator for those assessors (packages/yoastseo/src/scoring/assessors/collectionPages/seoAssessor.js and packages/yoastseo/src/scoring/assessors/collectionPages/cornerstone/seoAssessor.js) as well 👍

@mhkuu
Copy link
Contributor

mhkuu commented Feb 3, 2025

This PR needed some work:

CR:

  • In 2e06b9a, I made the unit tests more specific, as they were basically a copy of the super class.
  • In e6e1d6e, I made it so that no default score aggregator is set for an assessor. I also set the aggregator at the right places, e.g. for the cornerstone assessor for collections, not the default cornerstone assessor.
  • In d95b5ef, I improved the JSDoc for the score aggregators
  • In a056131, I cleaned up the AnalysisWebWorker even further.

ACC:

I’ve tested the assessors and they work as advertised. There are however some problems that require a better look in the long term. My observations are as follows:

  • With the new aggregator, if there are only a few assessments (such as with related keywords),
  • After Extract the feedback strings for the non-Free assessments out of the assessments #21567, some product assessments are now inadvertently available for all assessors in Shopify. This was the main reason why the overall score for collections seemed off. This needs to be resolved in a separate issue.
  • I've corrected the changelog items.
  • I've adapted the test instructions to cover collections and cornerstone content as well.

@mhkuu mhkuu changed the title 4475 fix related keyphrase status Fixes the overall score for related keyphrase and collection assessors Feb 3, 2025
@mhkuu mhkuu added this to the 24.5 milestone Feb 3, 2025
@mhkuu mhkuu merged commit e337c62 into trunk Feb 3, 2025
17 checks passed
@mhkuu mhkuu deleted the 4475-fix-related-keyphrase-status branch February 3, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog Shopify This PR impacts Shopify.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants