Skip to content

Conversation

@LPegasus
Copy link
Contributor

@LPegasus LPegasus commented Dec 3, 2025

Summary

Fixes #5480

Details

Q: How did you solve the problem?
A: Following the current logic of how to analyze default subspace pnpm-lock.yaml changes. Refactor the logic to run for all subspaces.

Q: Mention any alternate approaches you considered.
A: I couldn't come up with a better alternative.

Q: Did you completely solve the problem, or are some cases not handled yet?
A: Yes. I think so.

Q: Does this change break backwards compatibility?
A: Yes.

Q: Could any aspects of your change impact performance?
A: For monorepo with many subspaces projects, it will take more time to check the pnpm-lock.yaml impact.

How it was tested

  1. Added a new repo in libraries/rush-lib/src/logic/test/repoWithSubspaces to test.
  2. Init a new Rush monorepo to test non-subspaces case with local built rush-lib:
  • commit something
  • update some dependencies
  • run rush list -t git:main to check the listed projects

Impacted documentation

None

});
});

describe.skip(ProjectChangeAnalyzer.prototype.getChangedProjectsAsync.name, () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is currently disabled


const subspaces: ReadonlySet<Subspace> = rushConfiguration.subspacesFeatureEnabled
? new Set(rushConfiguration.subspaces)
: new Set([rushConfiguration.defaultSubspace]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If rushConfiguration.subspacesFeatureEnabled is false, it seems that rushConfiguration.subspaces will contain only the defaultSubspace?

const subspaceNames: string[] = [];
let splitWorkspaceCompatibility: boolean = false;
if (this.subspacesConfiguration?.subspacesEnabled) {
splitWorkspaceCompatibility = this.subspacesConfiguration.splitWorkspaceCompatibility;
subspaceNames.push(...this.subspacesConfiguration.subspaceNames);
}
if (subspaceNames.indexOf(RushConstants.defaultSubspaceName) < 0) {
subspaceNames.push(RushConstants.defaultSubspaceName);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code below seems to use subspaces only for iteration (Async.forEachAsync(subspaces, ...), so maybe it is not necessary to construct a Set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Here a Set is not needed. I'll change to use Array.

If rushConfiguration.subspacesFeatureEnabled is false, according to the code in https://github.com/LPegasus/rushstack/blob/1627a8386debc01fe198a2efcac0b8fa09fa5384/libraries/rush-lib/src/api/RushConfiguration.ts#L902
I think there's only one default subspace. Please let me know if I've overlooked any other possibilities that has other subspaces.

@octogonz
Copy link
Collaborator

octogonz commented Dec 3, 2025

I added some stylistic feedback but otherwise LGTM.

Thanks for adding tests! 🏅

@iclanton iclanton moved this from Needs triage to In Progress in Bug Triage Dec 3, 2025
expect(changedProjects.has(rushConfiguration.getProjectByName(projectName)!)).toBe(true);
});

// e depends on d via workspace:*, but its own package.json didn't change, so it's not included. e will be included by expandConsumers if needed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify that e is not included because the calculated lockfile footprint, i.e. .rush/temp/shrinkwrap-deps.json, for e did not change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Let me update the comment.


module.exports = {
hooks: {
readPackage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would seem to be invalid code? I don't see a definition of readPackage in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes. Let me fix it.

LPegasus and others added 4 commits December 4, 2025 09:48
…default-subspace-pnpmlock-check_2025-12-03-13-27.json

Co-authored-by: Pete Gonzalez <4673363+octogonz@users.noreply.github.com>
Co-authored-by: Pete Gonzalez <4673363+octogonz@users.noreply.github.com>
1. Fix `.pnpmfile.cjs` `readPackage` function is not defined.
2. Fix the comment of why 'e' is not in changedProjects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

[rush] Changes to the pnpm-lock.yaml file in non-default subspaces do not calculate the scope of affected projects

3 participants