rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] preferredVersions in common-versions not respected in subspace scenario

Open 2772788276 opened this issue 4 months ago • 2 comments

Summary

I am trying to configure subspace-specific dependency versions using the common-versions.json file located in the subspace-specific configuration directory (common/config/subspaces//common-versions.json). Despite setting preferredVersions in this subspace-specific file, the specified versions are not being respected when installing dependencies for that subspace. Instead, the dependencies use versions from either the root common-versions.json or default resolutions.

Repro steps

  1. Set up a Rush monorepo with at least one subspace configured
  2. Create a subspace-specific common-versions.json file at: common/config/subspaces//common-versions.json
  3. Add preferredVersions entries to this subspace-specific file (e.g., "react": "18.2.0")
  4. Run rush update --subspace <subspace-name> targeting the specific subspace
  5. Check the installed dependency versions in the subspace's node_modules

Expected result: The subspace should use the dependency versions specified in its own common/config/subspaces//common-versions.json file

Actual result: The subspace ignores its specific common-versions.json and uses either root configuration or other version resolutions. No errors are logged regarding the subspace-specific configuration file.

Details

It seems that Rush is not properly loading or applying the common-versions.json files located in subspace-specific configuration directories. The subspace isolation mechanism may not be correctly resolving the path to these subspace-specific configuration files, or there may be a missing step in the configuration aggregation process that should prioritize subspace-specific settings.

A potential fix would involve updating the configuration loading logic to check for and apply subspace-specific common-versions.json files, ensuring they take precedence over root configurations for their respective subspaces.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? @microsoft/[email protected]
rushVersion from rush.json? 5.122.0
useWorkspaces from rush.json? Yes
Operating system? Mac
Would you consider contributing a PR? No
Node.js version (node -v)? 19.9.0

2772788276 avatar Sep 01 '25 08:09 2772788276

According to the issue template you are on a very old version of Rush (as configured in rush.json); does this still repro for you on latest 5.157.0?

dmichon-msft avatar Sep 03 '25 18:09 dmichon-msft

Thank you for your suggestion. I've tried updating to the latest version 5.157.0, but unfortunately, the issue still persists. The problem remains unchanged after the update. Could you please provide further guidance on how to resolve this?

2772788276 avatar Sep 03 '25 18:09 2772788276