fix(core): mark all projects affected when a global package is not in the graph - #36485
Open
gaurav0107 wants to merge 1 commit into
Open
gaurav0107 wants to merge 1 commit into
gaurav0107 wants to merge 1 commit into
Conversation
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
… the graph `getTouchedNpmPackages` only consults `globalPackages` after resolving the changed dependency to a node in the project graph. When the lookup misses, it records the name in `missingTouchedNpmPackages` and continues, so the check that returns every project is unreachable for a global package with no node. `nx` is always a global package and is frequently absent from the graph, so bumping its own version logged "The package(s) nx were not found" and marked nothing affected instead of invalidating the workspace. Consult `globalPackages` with the changed key before falling through to the warning. The sibling `overrides` branch already treats an unresolvable package as "affects everything"; this makes the dependencies branch consistent with it. Genuinely unknown packages still warn as before.
gaurav0107
force-pushed
the
fix/36415-gettouchednpmpackages-global-package-fal
branch
from
July 27, 2026 22:25
eb4920a to
96cc69a
Compare
gaurav0107
marked this pull request as ready for review
July 27, 2026 22:25
Member
|
Thanks for the PR, and sorry it sat this long. It needs a push from you to move, because its CI runs have gone stale in a way that cannot be restarted from our side. Rebasing on master and pushing creates a fresh run.
|
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
getTouchedNpmPackagesonly consultsglobalPackagesafter resolving the changed dependency to a node in the project graph. When neitherprojectGraph.externalNodesnorprojectGraph.nodeshas a match, it records the name inmissingTouchedNpmPackagesandcontinues — so the check that returns every project is unreachable for a global package that has no node:getGlobalPackagesunconditionally appends'nx', so bumping nx's own version inpackage.jsonis the common way to hit this: the run logsThe affected projects might have not been identified properly. The package(s) nx were not found.and marks nothing affected, instead of invalidating the whole workspace.Expected Behavior
A change to a global package (an
nx.jsonplugin package, ornxitself) marks every project affected regardless of whether that package happens to have a node in the graph, and does not emit the "not found" warning for it. Packages that are genuinely unknown still warn exactly as before.The fix consults
globalPackageswith the changed key before falling through to the warning. This also makes thedependencies/devDependenciesbranch consistent with theoverrides/resolutions/pnpm.overridesbranch in the same function, which already treats an unresolvable package as "affects everything".Verification
Full disclosure on what was and wasn't verified locally: this machine cannot host an nx install (the pnpm install does not fit in the available disk), so
nx run-many -t test -p nxandnx affected -t lintcould not be run — CI is the first place the real jest suite executes. To avoid shipping unverified code, the two changed files were checked directly:tsc --noEmit(TS 5.9,tsconfig.base.jsonsettings) over both changed files: zero errors in them, and a before/after diff of the full error output is byte-identical, so the change introduces no new type errors.getTouchedNpmPackageswas compiled to CJS and executed against the exact inputs and expectations of the two new tests. Both fail onmaster(they return[]) and pass with this change; the two pre-existing tests covering "unknown package still warns" and "resolvable package returns just that package" pass in both.prettier --checkclean with the repo's.prettierrcoptions.node ./scripts/validate-pr-title.jsexits 0.Related Issue(s)
Fixes #36415