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

Update healthcheck Method to Support First-Party Mode Filters for Tester Plugin Integration #9855

Closed
4 tasks
hussain-t opened this issue Dec 10, 2024 · 5 comments
Labels
P1 Medium priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature

Comments

@hussain-t
Copy link
Collaborator

hussain-t commented Dec 10, 2024

Feature Description

Update the healthcheck method in the First_Party_Mode class to support overrides for the health check logic. This enhancement will enable seamless integration with the Site Kit Tester Plugin, allowing developers and testers to simulate various server configurations and validate the behavior of the First-party mode feature.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The healthcheck method in the First_Party_Mode class should support dynamic overrides for FPFE and proxy script access checks.
  • The overrides should be implemented using filter hooks to allow testers to simulate different server configurations.
  • The default health check logic should remain intact and execute if no overrides are set.

Implementation Brief

In includes/Core/Tags/First_Party_Mode/First_Party_Mode.php:

  • Update the First_Party_Mode::healthcheck method to allow dynamic overrides for:
    • FPFE health check result.
    • Proxy script access check result.
  • Implement the following filter hooks to support the overrides:
    • googlesitekit_is_fpm_healthy
    • googlesitekit_is_fpm_script_access_enabled
  • Add the filter hooks to the respective health check conditions.
  • Finish and merge this PR.

Test Coverage

  • No new tests are required for this change.

QA Brief

  • Set up Site Kit with the firstPartyMode feature flag enabled.
  • Run the following snippet in the JS console. Verify that isFPMHealthy and isScriptAccessEnabled are true in the returned response:
await googlesitekit.data.dispatch( "core/site" ).fetchGetFPMServerRequirementStatus()
  • Create a PHP file in mu-plugins with the following content:
<?php

add_filter( 'googlesitekit_is_fpm_healthy', '__return_false' );
add_filter( 'googlesitekit_is_fpm_script_access_enabled', '__return_false' );
  • Run the JS snippet again. This time, the isFPMHealthy and isScriptAccessEnabled properties should be false.

Changelog entry

@hussain-t hussain-t added P0 High priority Type: Enhancement Improvement of an existing feature Team M Issues for Squad 2 labels Dec 10, 2024
@hussain-t hussain-t self-assigned this Dec 10, 2024
@hussain-t hussain-t assigned techanvil and unassigned hussain-t Dec 10, 2024
@techanvil
Copy link
Collaborator

Thanks @hussain-t, the IB LGTM. It needed an estimate which I've set to 7 to allow for testing.

IB ✅

@techanvil
Copy link
Collaborator

techanvil commented Dec 10, 2024

@hussain-t actually, on reflection - googlesitekit_is_script_access_enabled is quite a generic name for a filter which is tightly coupled to FPM. I'd suggest we name it googlesitekit_is_fpm_script_access_enabled. WDYT?

@hussain-t
Copy link
Collaborator Author

Sure. Go for it, @techanvil 👍

@techanvil
Copy link
Collaborator

Thanks @hussain-t. I've updated the IB and the PR accordingly.

@nfmohit nfmohit self-assigned this Dec 10, 2024
@techanvil techanvil added P1 Medium priority and removed P0 High priority labels Dec 10, 2024
@hussain-t
Copy link
Collaborator Author

Closing this ticket as the tester plugin implementation was updated to leverage the WordPress option_ filter for overriding the health check logic, instead of introducing custom filters.

@hussain-t hussain-t closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Medium priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants