Add corpus regeneration diff CI - #284
Open
sirreal wants to merge 4 commits into
Open
Conversation
7.0.4 is the latest WordPress release. Pinning the point release rather than the 7.0 major tag tracks the patches to wp-includes, so the corpus matches what is shipped. WordPress 7.0 raised core's minimum PHP to 7.4, which is exactly this job's PHP floor. Verified against wp-includes@7.0.4: 1039 PHP files, all of them present in the export, no parse errors, ~49 MB of JSON. Both of the job's guards (>= 500 files, >= 1 MB of JSON) still hold.
Records what the corpus-diff check is, how to run it by hand with the repo's own tools/export-corpus.php and prep-diff.php, and the policy the workflow already states: the head checkout's tooling drives both sides.
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.
Implements the corpus-diff check that the #262 and #270 review rounds relied on manually: parse a pinned corpus of WordPress core source (
wp-includesfrom the WordPress 6.8 tag) with the parser at the PR's merge base and at its head, normalize both JSON outputs withprep-diff.php, and diff. Every hunk in the diff is a behavior change the PR makes — intended and explained, or a regression. This check has repeatedly caught regressions no unit test covered.Decisions taken (also documented in the workflow header):
0 hunks). Make it blocking with an escape hatch (label or committed expected diff) once the signal has proven trustworthy.tools/export-corpus.phptakes the parser root as a parameter, so one copy exports through the base checkout and the head checkout;prep-diff.phpfrom head normalizes both. Tooling changes therefore never masquerade as parser changes; a change toprep-diff.phpitself shows its normalization effect in the diff and is reviewed like any other change.wp-includesonly for now (~1000 files, a few minutes to parse).wp-admin/includescan be added later for hook/uses coverage at the cost of runtime.Determinism: pinned corpus tag (cached by tag), sorted file list via the existing
get_wp_files(),LC_ALL=C, the same PHP binary for both sides,JSON_PRETTY_PRINTon both. The export script routes PHP diagnostics to stderr so stdout stays pure JSON (vendored code emits deprecation notices on newer PHP).Smoke-tested locally: exporting
tests/sourcethroughtools/export-corpus.phpand piping throughprep-diff.phpproduces clean normalized JSON.Design doc and manual procedure this implements were written during the #262/#270 review work.
Update
Corpus pinned to WordPress 7.0.4. 7.0.4 is the latest WordPress release; pinning the point release rather than the
7.0major tag tracks the patches that land inwp-includes, so the corpus matches what is shipped. WordPress 7.0 also raised core's minimum PHP to 7.4, exactly this job's PHP floor. Verified locally againstwp-includes@7.0.4: 1039 PHP files, all present in the export, no parse errors, ~49 MB of JSON — both of the job's guards (>= 500 files, >= 1 MB of JSON) still hold.Manual procedure documented in the README. A new "Corpus diff" section records what the check is, how to run it locally with the repo's own
tools/export-corpus.phpandprep-diff.php(merge-base worktree, export both sides over the same corpus, normalize, diff), and the tooling policy the workflow header already states: the head checkout's tooling drives both sides.🤖 Generated with Claude Code