Skip to content

Automate HTML API regression harness (CI + composer test)#24

Closed
sirreal wants to merge 1 commit into
mainfrom
followup/automate-regression-harness
Closed

Automate HTML API regression harness (CI + composer test)#24
sirreal wants to merge 1 commit into
mainfrom
followup/automate-regression-harness

Conversation

@sirreal

@sirreal sirreal commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

The regression harness at tests/html-api-integration-regression.php was the only test in the repo and nothing ran it (no CI, no composer scripts). This wires it into automation.

  • composer test — new scripts block runs the regression harness, then phpcs, in one command. Composer stops on the first non-zero exit, so a failed harness assertion (or phpcs violation) makes composer test fail loudly. Sub-scripts test:harness and test:phpcs are also exposed.
  • .github/workflows/ci.yml — runs composer test on push to main and on every pull_request, across a PHP matrix (fail-fast: false). WordPress core sources for the harness come from a shallow checkout of WordPress/wordpress-develop pinned to a tag, with WP_CORE_DIR exported to its src/.
  • Bootstrap hardening in the harness — it now checks that every required HTML API file exists before requiring any of them, and bails with a clear STDERR message + exit(2) if WP_HTML_Processor or the plugin's get_tree() is still undefined after bootstrap, instead of fataling on the first require.

Pinned WordPress ref

WordPress/wordpress-develop @ 7.0.0 (latest stable as of 2026-06; latest 6.x is 6.9.4). The pin is commented in the workflow with a note to bump it deliberately, not via automation. I verified the harness passes against a real 7.0.0 checkout locally (not just trunk), so the pin is known-green.

PHP matrix

['8.2', '8.3', '8.4', '8.5'] via shivammathur/setup-php. Floor 8.2 is the lowest PHP still in security support as of 2026-06; 8.5 is current latest. (Requires PHP: 8.2 header is a separate PR.)

phpcs scoping decision

No new ruleset was needed — a phpcs.xml already exists in the repo (targets ./html-api-debugger, builds on WordPress-Extra + WordPress-Docs with a handful of project-specific exclusions). The plugin's 4 PHP source files already pass it clean, so composer test is green without any style cleanup. The harness itself is phpcs:disabled and out of the checked path, so the bootstrap changes don't affect phpcs. I reused the existing ruleset as-is rather than introducing a phpcs.xml.dist.

Verification (local)

  • WP_CORE_DIR=<wp 7.0.0 src> composer test → green (10 ok - lines, phpcs clean, exit 0).
  • Broke one expected assertion → composer test printed not ok and exited 1; reverted.
  • Bad/missing WP_CORE_DIR and a partial WP tree → clear STDERR message + exit(2).

https://claude.ai/code/session_014CpRWL5jrDEGKzzJkQdNyL

Wire the standalone regression harness into automation so it actually
runs on every push and PR.

- composer.json: add a `test` script that runs the regression harness
  then phpcs in one command, stopping (non-zero) on the first failure.
  Reuses the existing phpcs.xml ruleset, which the plugin source already
  passes clean.
- .github/workflows/ci.yml: run `composer test` on push to main and on
  pull_request, across PHP 8.2-8.5 via shivammathur/setup-php. WordPress
  core sources are provided by a shallow checkout of
  WordPress/wordpress-develop pinned to tag 7.0.0 (bump deliberately).
- tests/html-api-integration-regression.php: harden the bootstrap. Check
  every required HTML API file exists before requiring any of them, and
  bail with a clear STDERR message + exit(2) if the API class or the
  plugin integration function is still missing after bootstrap, instead
  of fataling on the first require.

Claude-Session: https://claude.ai/code/session_014CpRWL5jrDEGKzzJkQdNyL
@sirreal sirreal closed this Jun 29, 2026
@sirreal sirreal deleted the followup/automate-regression-harness branch June 29, 2026 11:05
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