Automate HTML API regression harness (CI + composer test)#24
Closed
sirreal wants to merge 1 commit into
Closed
Conversation
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
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.
Summary
The regression harness at
tests/html-api-integration-regression.phpwas the only test in the repo and nothing ran it (no CI, no composer scripts). This wires it into automation.composer test— newscriptsblock 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) makescomposer testfail loudly. Sub-scriptstest:harnessandtest:phpcsare also exposed..github/workflows/ci.yml— runscomposer testonpushtomainand on everypull_request, across a PHP matrix (fail-fast: false). WordPress core sources for the harness come from a shallow checkout ofWordPress/wordpress-developpinned to a tag, withWP_CORE_DIRexported to itssrc/.exit(2)ifWP_HTML_Processoror the plugin'sget_tree()is still undefined after bootstrap, instead of fataling on the firstrequire.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 real7.0.0checkout locally (not just trunk), so the pin is known-green.PHP matrix
['8.2', '8.3', '8.4', '8.5']viashivammathur/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.2header is a separate PR.)phpcs scoping decision
No new ruleset was needed — a
phpcs.xmlalready exists in the repo (targets./html-api-debugger, builds onWordPress-Extra+WordPress-Docswith a handful of project-specific exclusions). The plugin's 4 PHP source files already pass it clean, socomposer testis green without any style cleanup. The harness itself isphpcs: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 aphpcs.xml.dist.Verification (local)
WP_CORE_DIR=<wp 7.0.0 src> composer test→ green (10ok -lines, phpcs clean, exit 0).composer testprintednot okand exited 1; reverted.WP_CORE_DIRand a partial WP tree → clear STDERR message +exit(2).https://claude.ai/code/session_014CpRWL5jrDEGKzzJkQdNyL