Use correct scope for aliases and dependencies in submodules #2810
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.
#2632 introduced a bug whereby running an alias pointing to a recipe in a submodule would not create or use the correct scope. #2672 created another way to hit the bug, this time by running a dependency in a submodule.
Both
just a
andjust b
cause a runtime error when trying to evaluatex
, which isn't defined.Depending on a recipe in a submodule hasn't made it into a release yet, but aliasing a recipe in a submodule has, and I'm surprised the bug hasn't been reported.
This PR evaluates the assignment scope of all submodules, and runs recipes with the scope of the submodule that contains it.
One thing I'm not sure about, which is why it's still a draft, is whether or not we should only evaluate scopes of modules containing recipes that we're actually going to run.
We could go through all directly invoked recipes and all transitive dependencies, collect the set of their submodules, and then only evaluate assignments for those submodules.