Skip to content

Abilities API: Add cached Site Health summary to core/get-environment-info#11834

Open
KarunyaChavan wants to merge 3 commits into
WordPress:trunkfrom
KarunyaChavan:feat/65232-add-a-fast-site-health-summary-to-core/get-environment-info
Open

Abilities API: Add cached Site Health summary to core/get-environment-info#11834
KarunyaChavan wants to merge 3 commits into
WordPress:trunkfrom
KarunyaChavan:feat/65232-add-a-fast-site-health-summary-to-core/get-environment-info

Conversation

@KarunyaChavan
Copy link
Copy Markdown

@KarunyaChavan KarunyaChavan commented May 14, 2026

Trac Ticket: https://core.trac.wordpress.org/ticket/65232


This PR extends core/get-environment-info with two additive changes:

  • Adds an optional fields input parameter, matching the response filtering behavior already used by core/get-site-info.
  • Adds a cached-only site_health output field with a high-level Site Health summary for agents and other consumers of the Abilities API.

The Site Health summary is read from the existing health-check-site-status-result transient. The ability does not run Site Health tests, call Site Health test discovery, or trigger synchronous evaluation. If cached data is missing or malformed, the ability returns status: "unknown" with empty counts and issues.

flowchart LR
    A[Site Health checks run from UI or scheduled check] --> B[Normalize counts and actionable issues]
    B --> C[Store health-check-site-status-result transient]
    D[core/get-environment-info] --> E[Read transient only]
    E --> F[Return site_health summary]
Loading

The site_health response includes:

  • status: unknown, good, recommended, or critical.
  • counts: cached Site Health result counts for good, recommended, and critical.
  • issues: up to 10 actionable recommended or critical issue summaries.
  • truncated: whether more than 10 actionable issues were available.
  • timestamp: Unix timestamp for when the cached Site Health data was collected, or 0 when no cached data exists.

Example:

{
  "site_health": {
    "status": "recommended",
    "counts": {
      "good": 12,
      "recommended": 3,
      "critical": 0
    },
    "issues": [
      {
        "test": "background_updates",
        "label": "Background updates are not working as expected.",
        "severity": "recommended",
        "recommendation": "Contact your hosting provider to ensure WP-Cron can run."
      }
    ],
    "truncated": false,
    "timestamp": 1715714399
  }
}

Cache Behavior

The Site Health transient is expanded to include normalized actionable issue summaries and a timestamp while preserving the existing aggregate counts used by the dashboard and admin menu.

flowchart TD
    A[Site Health result] --> B{Status}
    B -->|good| C[Increment good count]
    B -->|recommended| D[Increment recommended count]
    B -->|critical| E[Increment critical count]
    D --> F[Store normalized issue summary]
    E --> F
    C --> G[Do not include in issues array]
    F --> H[Save transient with timestamp]
    G --> H
Loading

Only actionable recommended and critical entries are stored in the issues list. Passing good checks remain represented in counts.good.

The Site Health screen AJAX persistence path also sanitizes incoming issue summaries and preserves previous issue details only when the new counts still indicate actionable issues. This avoids carrying stale issue details after the site becomes clean.

Schema Changes

The output schema now documents the site_health object and all nested properties with titles and descriptions. It also constrains known values with enums and disallows unexpected nested properties where appropriate.

This makes the response clearer for adapters by documenting:

  • The difference between unknown and good.
  • That issue severity is limited to recommended or critical.
  • That timestamp communicates the freshness of cached Site Health data.

Use of AI Tools

AI assistance: Yes

Tool(s): Codex

Model(s): GPT-5

Used for: refactoring and test coverage suggestions.


…alth summary.

- Abilities: Added optional `fields` input parameter to `core/get-environment-info` to allow for response filtering.
- Abilities: Introduced `site_health` output field providing status, issue counts, and a bounded list of actionable issues.
- Site Health: Modified `WP_Site_Health::wp_cron_scheduled_check` to store critical/recommended issue details in the `health-check-site-status-result` transient.
- Site Health: Updated `site-health.js` to ensure the issues list is transmitted during manual AJAX updates for cache parity.
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props karunyachavan84.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link
Copy Markdown

Hi @KarunyaChavan! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description.

Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making.

More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook.

Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook.

If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook.

The Developer Hub also documents the various coding standards that are followed:

Thank you,
The WordPress Project

@KarunyaChavan KarunyaChavan changed the title Abilities API: Extend core/get-environment-info with cached Site Health data Abilities API: Add cached Site Health summary to core/get-environment-info May 14, 2026
@github-actions
Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant