Repository navigation
fix: insert Module.withDependencies in correct order - #9052
Merged
Merged
Conversation
Contributor
|
Looks like there's some legit test failures here, also this is worth it's own test coverage too |
jedevc
force-pushed
the
install-correct-order
branch
2 times, most recently
from
December 4, 2024 17:11
8f82e6b to
15ed238
Compare
Contributor
Author
|
Fixed most of the tests and added a new one to check the sorted behavior. Noticed one of them is still failing, will investigate though. |
jedevc
force-pushed
the
install-correct-order
branch
2 times, most recently
from
December 6, 2024 11:18
62e9240 to
197465a
Compare
jedevc
force-pushed
the
install-correct-order
branch
from
December 6, 2024 12:15
197465a to
c8e2f21
Compare
Contributor
Author
|
Think all of these are fixed now! |
Contributor
Author
|
This isn't an urgent change, moving this out of the milestone. |
jedevc
force-pushed
the
install-correct-order
branch
from
December 12, 2024 11:51
c8e2f21 to
ac97c76
Compare
Contributor
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
jedevc
force-pushed
the
install-correct-order
branch
from
January 6, 2025 14:23
ac97c76 to
5d87af3
Compare
Previously, calling `dagger install` with no name would bizarrely insert it into the beginning of the `dagger.json` `dependencies` field. Then calling `dagger develop` would fix it. This is what was happening: - We call `updateDeps` to update our dependencies. - We were calling `ModuleSource.dependencies` (which merges `withDependencies` nicely) and getting all ordered dependencies. - However, no name was specified in the `withDependencies` call, so the name was actually the empty string - so was appearing first in the lexigraphic sort. - Then, later in `updateDeps`, we fill in the missing name - this is correct, but is now too late for the sort, so we have the wrong order. The solution is fairly simply - `dependencies` should fill in missing names if possible. We *could* have added `updateDeps` as an alternative, but this is actually not great, since this means that `dependencies` would still be returning `dependencies` that have no name - which is a potential footgun for the next person coming along. Signed-off-by: Justin Chadwell <[email protected]>
There's a lot of shared logic here - which I hadn't realized was duplicated at first and needed to be changed in two places - this removes that need. Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
jedevc
force-pushed
the
install-correct-order
branch
from
January 6, 2025 15:55
5d87af3 to
fdb3eb5
Compare
vito
approved these changes
Jan 13, 2025
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.
Previously, calling
dagger installwith no name would bizarrely insert it into the beginning of thedagger.jsondependenciesfield. Then callingdagger developwould fix it.This was an absurd little pet-peeve, so took some time to fix it - it will be nice when we can clean up
ModuleSource.resolveFromCaller, since trying to understand that for this bug was by far the trickiest bit to actually understand and track.This is what was happening:
updateDepsto update our dependencies.ModuleSource.dependencies(which mergeswithDependenciesnicely) and getting all ordered dependencies.withDependenciescall, so the name was actually the empty string - so was appearing first in the lexigraphic sort.updateDeps, we fill in the missing name - this is correct, but is now too late for the sort, so we have the wrong order.The solution is fairly simply -
dependenciesshould fill in missing names if possible.We could have added
updateDepsas an alternative, but this is actually not great, since this means thatdependencieswould still be returningdependenciesthat have no name - which is a potential footgun for the next person coming along.