Skip to content

Fix feature flag#22187

Merged
igorschoester merged 10 commits intotrunkfrom
fix-feature-flag
Apr 14, 2025
Merged

Fix feature flag#22187
igorschoester merged 10 commits intotrunkfrom
fix-feature-flag

Conversation

@pls78
Copy link
Copy Markdown
Member

@pls78 pls78 commented Apr 10, 2025

Context

  • We want to make sure no Site Kit-related logic is run when the feature flag is false.

Summary

This PR can be summarized in the following changelog entry:

  • Avoids running Site Kit-related logic by checking the feature flag conditional as soon as possible.

Relevant technical choices:

  • I left the isFeatureEnabled attribute in the Site Kit configuration to keep frontend code untouched.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Enable the feature flag and smoke-test our Site Kit widgets in the dashboard

  • Edit src/dashboard/infrastructure/integrations/site-kit.php by changing lines 131-132 from:

    $shared_roles       = ( isset( $dashboard_sharing[ $key ]['sharedRoles'] ) ) ? $dashboard_sharing[ $key ]['sharedRoles'] : [];
    $has_viewing_rights = ( \is_array( $shared_roles ) ) ? \array_intersect( $current_user->roles, $shared_roles ) : false;
    

    to:

     $shared_roles       = isset( $dashboard_sharing[ $key ] ) ? $dashboard_sharing[ $key ]['sharedRoles'] : [];
     $has_viewing_rights = \array_intersect( $current_user->roles, $shared_roles );
    

    (this basically reverts our hotfix)

  • Follow the steps here to trigger the fatal error

    • Verify the fatal error is not triggered anymore

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.

Impact check

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

  • N/A

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 #506

@github-actions
Copy link
Copy Markdown

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 10, 2025

Pull Request Test Coverage Report for Build 73a34e5037d7de5d5e6a76a8522d9c19c0336148

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

  • 8 of 8 (100.0%) changed or added relevant lines in 2 files are covered.
  • 64 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.003%) to 54.556%

Files with Coverage Reduction New Missed Lines %
src/dashboard/domain/traffic/comparison-traffic-data.php 10 0.0%
src/dashboard/infrastructure/analytics-4/site-kit-analytics-4-adapter.php 54 0.0%
Totals Coverage Status
Change from base Build ed0dc6361bbe589063ae3212cc72e40816030f5f: -0.003%
Covered Lines: 29737
Relevant Lines: 54958

💛 - Coveralls

@pls78 pls78 added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Apr 10, 2025
@pls78 pls78 marked this pull request as ready for review April 10, 2025 14:09
Copy link
Copy Markdown
Contributor

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

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

CR && AT ✅

Some other related data is still passed from backend to frontend (endpoints/tracking options), but should be our own at least.

@igorschoester igorschoester added this to the 25.0 milestone Apr 14, 2025
@igorschoester igorschoester merged commit 924d36d into trunk Apr 14, 2025
40 checks passed
@igorschoester igorschoester deleted the fix-feature-flag branch April 14, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants