[rush] Add stricter changefile validation to ensure changefiles target extant, correct projects.#5715
Open
iclanton wants to merge 8 commits intomicrosoft:mainfrom
Open
[rush] Add stricter changefile validation to ensure changefiles target extant, correct projects.#5715iclanton wants to merge 8 commits intomicrosoft:mainfrom
iclanton wants to merge 8 commits intomicrosoft:mainfrom
Conversation
…efiles for nonexistent projects.
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
AI coding agents occasionally create change files with incorrect project names — for example, targeting
@microsoft/rush-libinstead of the lockstep driving project@microsoft/rush, or referencing a misspelled/nonexistent package. These mistakes can slip throughrush change --verifyundetected.This PR adds stricter validation for change files, gated behind a new
strictChangefileValidationexperiment. When enabled,rush change --verifywill report errors if change files reference projects that don't exist in the Rush configuration, or if they target a non-main project in a lockstepped version policy. A new--verify-allflag is also added to retroactively validate all change files in the repository.Details
New experiment:
strictChangefileValidationWhen enabled in
experiments.json,ChangeFiles.validateAsync()performs two additional checks on each package name found in change files:packageNamedoesn't match any project inrush.jsonmainProjectset, but the change file targets a different (non-driving) project in that policyError messages include the specific file path(s) that contain the problematic references.
New flag:
rush change --verify-allWhile
--verifyonly checks change files that are new on the current branch (via git diff),--verify-allloads every change file fromcommon/changes/and runs the same validation. This is useful for retroactively catching stale or incorrect change files that were merged before the experiment was enabled.The validation is gated behind the experiment flag so this is a fully opt-in, non-breaking change.
How it was tested
ChangeFiles.test.ts:mainProjectsrc/logic/test/strictValidation/--verify-allparameterImpacted documentation
strictChangefileValidationexperiment)--verify-allflag)