diff --git a/common/changes/@microsoft/rush/bugfix-no-unnecessary-condition_2025-01-03-10-05.json b/common/changes/@microsoft/rush/bugfix-no-unnecessary-condition_2025-01-03-10-05.json new file mode 100644 index 00000000000..1592b5ffbf9 --- /dev/null +++ b/common/changes/@microsoft/rush/bugfix-no-unnecessary-condition_2025-01-03-10-05.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Fix an issue with evaluation of `shouldEnsureConsistentVersions` when the value is not constant across subspaces or variants.", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/libraries/rush-lib/src/cli/actions/VersionAction.ts b/libraries/rush-lib/src/cli/actions/VersionAction.ts index 54070750902..b9300c30871 100644 --- a/libraries/rush-lib/src/cli/actions/VersionAction.ts +++ b/libraries/rush-lib/src/cli/actions/VersionAction.ts @@ -216,8 +216,8 @@ export class VersionAction extends BaseRushAction { // Validate result of all subspaces for (const subspace of rushConfig.subspaces) { // Respect the `ensureConsistentVersions` field in rush.json - if (!subspace.shouldEnsureConsistentVersions) { - return; + if (!subspace.shouldEnsureConsistentVersions(variant)) { + continue; } const mismatchFinder: VersionMismatchFinder = VersionMismatchFinder.getMismatches(rushConfig, {