Skip to content

Port r65394 and r65395: Site Health moves to core's classes - #23

Merged
ericmann merged 2 commits into
mainfrom
core-r65394
Nov 10, 2026
Merged

ericmann merged 2 commits into
mainfrom
core-r65394

Conversation

@ericmann

Copy link
Copy Markdown
Owner

Ports the two core commits since 0.5.0 (r65394, r65395). One commit each.

Why this matters before tonight's nightly

r65394 deleted wp-admin/includes/secrets-site-health.php. On a core that ships the API, wp secret health requires that file, so on trunk it is a fatal error. The nightly smoke leg runs wp secret health, so it fails as soon as the nightly includes r65394. I reproduced the fatal with main's CLI on trunk code.

r65395: @access private on the internal helpers

Docblocks only. src/wp-includes/ is byte-identical to trunk.

r65394: Site Health checks move to WP_Site_Health and WP_Debug_Data

A plugin can't add methods to core's classes, so this isn't a straight copy:

  • Old file removed. src/wp-admin/includes/secrets-site-health.php is gone, as in core, and with it src/wp-admin/.

  • Copies for WordPress before 7.2. plugin/class-secrets-api-site-health.php registers copies of core's eight methods through site_status_tests and debug_information. It uses the same test IDs, labels and debug key (wp-secrets-api) as core.

    • The copies are byte-identical to core's. They pass no text domain, so phpcs excludes that warning for this file.
  • Parity tests. test-secrets-site-health-parity.php, in the stand-down group, compares each copy with core's on trunk. It also checks that every Secrets method on core's classes is copied. I confirmed it fails, and names the method to re-copy, when a copy drifts.

  • wp secret health now picks its source by WordPress version:

    • 7.2 with r65394 and later: WP_Site_Health's methods.
    • 7.2 betas before r65394 (Beta 5): the old functions.
    • Before 7.2: the plugin's copies.

    A stand-down test covers the trunk path.

  • PHPStan.

    • A stub file declares the 7.2 WP_Site_Health methods with @method tags, and another declares the beta functions. The WordPress stubs predate both.
    • One explained ignore covers core's untyped inner array in get_wp_secrets_api().
  • Tests. test-secrets-site-health.php is core's new siteHealth.php run against the plugin's copies. It also has tests for the filters, which take the place of core's get_tests().

  • Docs. scope.md, rotation.md, ADR 0014 and ci.md are updated for the new layout. docs/reference/ is regenerated.

Testing

Run Result
Single site, WP 7.1.4 575 tests pass
Multisite, WP 7.1.4 575 tests pass
make test-stand-down on wordpress-develop trunk 25 pass, including 8 parity comparisons and wp secret health
Smoke, today's nightly (r65392, still has the beta functions) 149/149
Smoke, today's nightly with trunk's PHP files on top (stands in for tonight's nightly) 149/149
phpcs, PHPCompatibility, PHPStan level 10, reference check clean

Props from core: ericmann, peterwilsoncc, mindctrl (r65394); wildworks (r65395).

Ports r65395 from core trunk. The eight underscore-prefixed functions in
wp-includes/secrets.php get @access private, so the code reference shows that
they are not meant for plugins or themes. Docblocks only.

https://core.trac.wordpress.org/changeset/65395
https://core.trac.wordpress.org/ticket/66187

Props wildworks.
Ports r65394 from core trunk. Core's Site Health checks for the Secrets API are
now methods of WP_Site_Health and WP_Debug_Data, and
wp-admin/includes/secrets-site-health.php is gone. The statuses, labels and
descriptions are unchanged. The debug section key is now wp-secrets-api, the
results use the blue Security badge, and they include an actions key.

A plugin can't add methods to core's classes, so this is not a straight copy:

- src/wp-admin/includes/secrets-site-health.php is removed, as in core, and
  src/ no longer has a wp-admin/ directory.
- plugin/class-secrets-api-site-health.php registers copies of core's eight
  methods for WordPress before 7.2, through the site_status_tests and
  debug_information filters, under the same test IDs, labels and debug key. The
  copies are identical to core's, so they pass no text domain; phpcs excludes
  that warning and the base64_encode() one for the file, and PHPStan ignores
  core's untyped inner array in get_wp_secrets_api().
- test-secrets-site-health-parity.php, in the stand-down group, compares each
  copy with core's on trunk and fails when core changes one.
- wp secret health required the deleted file on a core that ships the API,
  which is a fatal error on trunk. It now calls core's WP_Site_Health methods,
  falls back to the old functions on 7.2 betas before r65394, and uses the
  plugin's copies before 7.2. A stand-down test covers it on trunk.
- PHPStan stubs declare the 7.2 WP_Site_Health methods and the beta functions,
  which the WordPress stubs don't have.
- test-secrets-site-health.php is core's new siteHealth.php run against the
  plugin's copies, with tests for the filters in place of core's get_tests().
- docs/spec/scope.md, rotation.md, ADR 0014 and docs/reference/ci.md describe
  the new layout.

Checked on trunk with the nightly smoke suite (149/149), with trunk's PHP files
over today's nightly, and on that nightly as is, which still has the beta
functions (149/149).

https://core.trac.wordpress.org/changeset/65394
https://core.trac.wordpress.org/ticket/66187

Props ericmann, peterwilsoncc, mindctrl.
@ericmann
ericmann merged commit f523cb2 into main Nov 10, 2026
15 checks passed
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