fix(js): detect pnpm snapshot dependency redirects in affected (#36929) - #36930
Open
jdpt0 wants to merge 2 commits into
Open
fix(js): detect pnpm snapshot dependency redirects in affected (#36929)#36930jdpt0 wants to merge 2 commits into
jdpt0 wants to merge 2 commits into
Conversation
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
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.
Current Behavior
With
projectsAffectedByDependencyUpdates: "auto", changing a pnpm snapshot dependency from one already-present version to another can leave every package version/integrity fingerprint unchanged. Nx then returns no affected projects even though the consumer's transitive dependencies changed.For example,
consumer → host@1.0.0 → dep@1.0.0becomesconsumer → host@1.0.0 → dep@2.0.0, while independent projects keep both dep versions in both lockfiles.Expected Behavior
The package owning the changed snapshot is marked touched, allowing the existing reverse graph traversal to select its consumers. In the reproduction this selects only
consumer.This change supplements pnpm affected fingerprints with snapshot keys and sorted resolved
dependencies/optionalDependencies. It reuses the existing pnpm normalizer and parser key map, preserving the association between snapshot peer contexts and dependency edges. It does not change external-node hashes used elsewhere in Nx or the other package managers' comparison paths.Regression coverage includes both pnpm lockfile filenames, normal and optional redirects, edge additions/removals, ordering-only changes, mixed integrity changes, peer-context edge swaps, and v6 snapshots.
Validation
pnpm exec vitest run --config packages/nx/vitest.config.mts packages/nx/src/plugins/js/project-graph/affected packages/nx/src/plugins/js/lock-file/pnpm-parser.spec.tspnpm exec tsc -p packages/nx/tsconfig.lib.json --noEmit --tsBuildInfoFile /tmp/nx-36929.tsbuildinfogit diff --checkpassed.["consumer"]after transpiling this changed module into the installed Nx 23.2.0 package, versus[]without it. This was a module-level smoke test, not a full Nx package build.Remaining validation
The full checkout's install lifecycle requires Rust, and the normal Nx task runner /
nx prepushcannot construct the workspace graph without Java and .NET in this environment. The focused suite therefore ran directly through the repository's Vitest config. Full build, prepush and affected e2e validation remain outstanding.The pnpm path performs an additional normalization pass to read snapshot dependencies. Sharing the parser's normalized data could avoid that extra pass.
Related Issue(s)
Fixes #36929