Fix missing git dependencies when building monorepos #1161
Merged
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.
Our build at work uncovered a bug that seems to trigger only in very specific condition.
This PR contains:
I suspect the bug was likely introduced as a side effect of #1018 and exposed by the work in #1138, and it's due to improper glob handling during the build: we are constructing the globs for the whole build when querying the graph, and reusing the same globs for the build. However, since #1138 we do not fetch all the dependencies prior to building, so when building a single package in a monorepo, we could stumble on dependencies that have not been fetched yet (because the fetch step will only fetch the dependencies that we need at the moment).
This could in principle happen with any kind of dependency that we fetch from the internet, but doesn't reliably happen with Registry packages, because we heavily cache them. Fetching a git repo provides a reliable repro instead.
The fix in this patch prepares two sets of globs, one for
purs graph
and one forpurs compile
. This seems to fix things, but I'm not entirely convinced it's the most sensible thing we could do. Maybe we should always fetch all dependencies instead, even when building a single package in a monorepo? Something to ponder, I think the current fix works fine for now.