Repository navigation
Build: Add CI check for workspace peer dependency version ranges - #85386
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 8.64 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Actions are reachable via RIGHT/LEFT arrow keys in
|
b5ac869 to
c23728e
Compare
adbcefd to
a86b1cc
Compare
a86b1cc to
e495637
Compare
|
With #85388 now merged and
|
| @@ -0,0 +1,173 @@ | |||
| #!/usr/bin/env node | |||
| /* | |||
There was a problem hiding this comment.
Could syncpack cover this? lint:deps already runs in static checks, and this group (first in versionGroups) flags a peer range that excludes the workspace version:
{
label: 'Peer ranges on workspace packages must admit the workspace version.',
dependencies: [ '@wordpress/**' ],
dependencyTypes: [ 'peer', 'local' ],
policy: 'sameRange',
},I tried it with syncpack 15.3.1: it passes on this branch, and narrowing the @wordpress/theme peer of @wordpress/build to ^3.0.0 fails with SameRangeMismatch.
Syncpack does not read changelogs, so the lookahead to the next release version is the only part it cannot do. Is that worth a custom script and a dependency on the release tool internals?
There was a problem hiding this comment.
Thanks! I'm not really familiar with Syncpack as a tool yet; testing it in another PR:
Looks promising!
Syncpack does not read changelogs, so the lookahead to the next release version is the only part it cannot do. Is that worth a custom script and a dependency on the release tool internals?
I actually don't have experience with the official GB release process beyond rolling out next package releases, to tell exactly if the Syncpack thing would be enough. Probably? I'm assuming this will now add the work to package release manager, rather than anyone opening/merging breaking-change PRs between releases.
There was a problem hiding this comment.
The proposed syncpack rule covers the current-version check. This script also catches a pending breaking release in the PR that adds its changelog entry, so replacing it means giving up that earlier check. I'd keep the script if we want peer updates in those breaking-change PRs.
There was a problem hiding this comment.
Sounds good!
One option is also do both and just leave the changelog reading to the script but at that point I think it's easier to keep everything in one place; less mysterious.
There was a problem hiding this comment.
Sounds good.
IMHO we should seriously consider the better approaches out there for changelog management, which then affects the released versions. Changesets is probably the best candidate for us. We could use its updateInternalDependencies option to ensure that any dependent packages get bumped automatically. It also gets rid of the changelog conflicts we often have to deal with.
There was a problem hiding this comment.
IMHO we should seriously consider the better approaches out there for changelog management
@talldan has been trying out an approach in #85369
One option is also do both
Agreed, I'd keep both checks together here. Catching stale peer ranges in the breaking-change PR makes the extra script worthwhile.
22a564c to
f6f4f6f
Compare
Fails when a workspace peer range excludes the peer's current version, or the next breaking version once its changelog announces breaking changes.
Also adds @types/semver and cites the PR in the touched changelogs.
… on wp/next Prerelease versions such as 2.1.2-next.v.… are checked as the stable version they lead to. The step is also skipped on wp/next.
f6f4f6f to
7f20f22
Compare
ciampo
left a comment
There was a problem hiding this comment.
I don't have additional feedback on my end 🚀 Thank you for working on this!
|
I noticed failure on trunk - https://github.com/WordPress/gutenberg/actions/runs/43180585746/job/131055283331 |
|
FYI I followed up with fix to above in now merged #86720 Mamaduka you were a minute faster than when I noticed it. :-D |
Depends on
#85383#85388Follow-up to manual range-widening changes:
What?
Fails when a workspace peer range excludes the peer's current version, or the next breaking version once its changelog announces breaking changes.
Why?
The major version of
@wordpress/themegets bumped via tooling, but the peer dependency range of@wordpress/wp-buildkept the old range. That causes issues with plugins using the build tool package.Packages where peer deps need updating accordingly:
To avoid missing updates, we should automate or lint it. I resorted in linting to leave bumping up to folks doing the updates for now.
How?
New step in static checks compares each published package’s peer ranges on workspace packages with the target’s current version and the version its Unreleased changelog will release as.
Testing Instructions
Not much more beyond
npm run lint:peer-rangesandnpm run test:unit -- tools/validation/check-peer-version-ranges.test.tsTesting Instructions for Keyboard
Use of AI Tools
Claude