Improve Site Health check for plans without Redis - #96
Merged
Conversation
Previously, the Site Health check for the Redis Object Cache would show a 'critical' error if the `CACHE_HOST` was not defined. This was confusing for users on Basic plans where Redis is intentionally unavailable. This change checks the service level. If the plan is one where Redis is not available (e.g., 'basic'), the Site Health tool now displays a 'good' status with an informational message. This message explains that Redis is not included in their plan and suggests upgrading. This provides a better user experience and avoids unnecessary critical warnings for users on these plans.
Adds a new test case to verify that the object cache health check correctly reports a 'good' status for plans (e.g., Basic) that do not include Redis. Existing tests are updated to explicitly run under a 'performance' plan context to ensure they test for Redis availability as intended, isolating the new test case.
Use `unset()` instead of setting the environment variable to `null` to more accurately reflect a missing `CACHE_HOST` variable. The `assertContains()` method is less brittle when messages change
jazzsequence
commented
Jul 23, 2025
Introduces the `_pantheon_get_request_headers` function to retrieve and normalize HTTP request headers from the `$_SERVER` superglobal. This utility standardizes header keys from the `HTTP_*` format (e.g., `HTTP_USER_AGENT`) to the standard HTTP header format (e.g., `User-Agent`), making them easier to work with in subsequent code.
This commit introduces the `_pantheon_get_header` function to provide a convenient way to access a single request header value.
The Redis object cache test previously displayed a "good" status on plans where Redis is not available (e.g. Basic plans). This was confusing as it reported on a feature that could not be used. This change modifies the test to return early and not register itself in this scenario. This prevents the test from appearing in the Site Health screen, providing a cleaner and more accurate user experience.
we no longer report good or bad if we're on basic or headers are missing entirely
jazzsequence
commented
Aug 5, 2025
AnaisPantheor
approved these changes
Aug 5, 2025
pwtyler
reviewed
Aug 5, 2025
Co-authored-by: Phil Tyler <phil.tyler@pantheon.io>
pwtyler
approved these changes
Aug 8, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance the Site Health page to not display any report if user is on a Basic plan where Redis is unavailable, reducing confusion for users.
This implementation relies on headers sent by GCDN. If the headers are not present at all, the tests fail gracefully and do not run sit health tests at all.
Included in this implementation is some code that originally was written for Edge Integrations that allows us to pull the HTTP headers out of the
$_SERVERsuperglobal and pluck the value of specific headers. Providing this function in the mu-plugin can be helpful for our future selves or customers building things similar to EI.Tests have been added to verify this behavior and refine existing tests for compatibility with the new checks.
This PR also bumps the version of the Pantheon WP Coding Standards and applies fixes for the new rules added in 3.0.
fixes #95