fix(sync): cover plugin PHP and block-theme version stamps#284
Merged
Conversation
restore_release_artifacts only protected CHANGELOG, classic-theme theme-description.scss, and package.json name/version. A late legacy hotfix release also stamps a regressed version into files it missed, which a clean "legacy wins" merge then lands unchallenged: - every plugin's main PHP file Version: header (the version WordPress and publishers actually read) plus any *_VERSION constant kept in lockstep - the block theme's underscore-prefixed src/scss/_theme-description.scss (missed by the theme-description.scss regex) and functions.php Version: Broaden the wholesale restore to _?theme-description.scss, and add a surgical pass that resets only the Version: header and *_VERSION constants in the main plugin PHP file / theme functions.php to HEAD's value, leaving real source the hotfix carried intact. Node calls are now the `if` condition so one malformed file skips rather than aborting the sync under set -e. Test extended with plugin and block-theme fixtures.
Guard the surgical PHP version pin against an unmerged file: editing and `git add`-ing one would mark it resolved with conflict markers still inside, hiding it from the post-merge check that escalates. Skip it so the escalation fires. Add a conflict-path test that drives an actual `git merge --no-commit -Xtheirs` (the prior cases staged a post-merge state directly), plus a note that package.json passes through three sequential rewriters.
|
Hey @adekbadek, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
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.
Changes proposed in this Pull Request:
Follow-up to #282. A code review of that fix surfaced that
restore_release_artifactsonly protected a subset of release-stamped files, leaving the same downgrade-on-clean-merge bug open for:Version:header (the version WordPress and publishers actually read, e.g.newspack-popups.phpVersion: 3.12.1) plus any*_VERSIONconstant kept in lockstep with it (NEWSPACK_BLOCKS__VERSION,NEWSPACK_ADS_VERSION). Stamped viaconfig/release.jsfiles: [ phpFile ]. None were restored, so a legacy plugin hotfix would downgrade the WP-visible plugin version.src/scss/_theme-description.scss(the leading underscore slipped past thetheme-description.scssregex) andfunctions.php(Version:header), both committed by its release config'sgitCommitStep.Classic themes were already fully covered (they commit only
theme-description.scss+CHANGELOG.md).Fix:
_?theme-description.scss(covers the block theme).Version:header and*_VERSIONconstants in the main plugin PHP file / themefunctions.phpto HEAD's version - these are real source, so the rest of the file (the actual fix the hotfix carried) is preserved.nodecalls: each is now theifcondition, so a single malformed file is skipped instead of aborting the whole sync underset -e(also drops a redundantgit cat-file+git showdouble-fetch).How to test the changes in this Pull Request:
bash bin/migration/test-restore-release-artifacts.sh- 18/18 assertions across all three release-stamped shapes (classic theme, plugin with PHP header + version constant, block theme withfunctions.php+ underscore SCSS). Each shape asserts both "stamp restored to monorepo version" and "real source change kept".bash -n bin/migration/lib.sh- syntax check.Other information:
🤖 Generated with Claude Code