feat: auto-tolerate version-only package.json edits in checkchange#7536
Closed
janechu wants to merge 1 commit into
Closed
feat: auto-tolerate version-only package.json edits in checkchange#7536janechu wants to merge 1 commit into
janechu wants to merge 1 commit into
Conversation
Add build/scripts/checkchange.mjs, a thin wrapper around 'beachball check' that scans the branch + staged diff for packages/*/package.json files whose only change is a single-line 'version' field bump (no other files in the package directory, no other package.json fields touched, no existing change file). For each such package the wrapper adds '--scope "!packages/<pkg>"' to the beachball invocation, so beachball treats the package as out of scope and does not demand a change file. Wire the wrapper into the existing 'checkchange' npm script and update CONTRIBUTING.md plus the shipping skill to document the carve-out for hotfix overrides, paired Rust/npm sync recovery, and automation-driven version pins. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
Author
|
Superseded by a follow-up that uses a branch-name + author allowlist instead of diff-content inspection. See discussion for context — closing in favor of the new, narrower PR. |
4 tasks
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.
Pull Request
📖 Description
Add
build/scripts/checkchange.mjs, a thin wrapper aroundbeachball checkthat auto-tolerates version-only hand edits topackages/*/package.json.Today
npm run checkchangefails for anypackage.jsonedit in a publishable workspace — including a single-lineversionbump — because beachball requires a corresponding change file. FAST does enough hand-bumping (hotfix overrides, paired Rust/npm sync recovery, automation-driven version pins) that requiring a no-op change file by hand each time is friction, and instructing maintainers to never editpackage.jsonversions by hand (the previousCONTRIBUTING.mdguidance) is brittle.The wrapper inspects the branch + staged diff and, for each
packages/<pkg>/package.jsonwhose only branch diff is a single-line"version"field bump (no other files in the package directory, no other fields inpackage.json, no existing change file for the package), adds--scope "!packages/<pkg>"to thebeachball checkinvocation. Beachball then treats that package as out of scope and does not demand a change file. Any other edit in the package directory re-enables the standard requirement.Documentation in
CONTRIBUTING.mdand.github/skills/shipping/SKILL.mdis updated to describe the carve-out, including the reminder that hand edits to a paired Rust crate'sCargo.toml/Cargo.lockstill have to be done manually (thepostbumphook only fires duringnpm run bump).👩💻 Reviewer Notes
git diff --diff-filter=Aagainst the target branch, so a generatedchange/*.jsononly counts if it's committed. A check wrapper mutating git state on every invocation would be unacceptable. Scope exclusion is purely in-process, leaves no artifacts, and is auditable through the verbose log the script prints before exec'ing beachball.package.json.package.jsondiff is exactly one removed line and one added line, both matching the"version": "..."field, old != new."private": true.change/.CHANGELOG.mdand frequently dependency versions inpackage.json, so they fail conditions 1 and 2 and are not auto-excluded by this wrapper. That keeps this PR's scope narrow.--scope "!sites/*"and--changehintexactly as the old script did, and forwards extra args viaprocess.argv.slice(2).📑 Test Plan
Verified locally against a fresh
npm ci:npm run checkchangeon a clean tree → no-op, exits 0.packages/fast-element/package.jsonversion only (staged) → wrapper logs[checkchange] Auto-excluding @microsoft/fast-element …, beachball check exits 0.packages/fast-element/src/index.ts) → wrapper does NOT exclude, beachball check fails withChange files are needed!and the original hint.package.json(with or without a version bump in the same diff) → wrapper does NOT exclude, beachball check fails as before.npx biome check build/scripts/checkchange.mjs beachball.config.js→ no issues.npm run format:check→ passes.✅ Checklist
General
$ npm run change⏭ Next Steps
A natural follow-up is to extend the wrapper (or write a sibling helper) to handle the bump-PR scenario itself — today the bump PR fails
npm run checkchangebecausegit diff --diff-filter=Adoes not surface the deleted, just-consumed change files (despite the current note inCONTRIBUTING.mdstep 5 claiming the bump PR passes). That fix is out of scope for this PR but should be tracked separately.