fix: Build the canister dependency graph only for the requested canisters - #3818
Merged
Conversation
ghost
suggested changes
Jul 5, 2024
ghost
left a comment
There was a problem hiding this comment.
Here is an example test that should be easy to adapt to verify the changes in this PR:
https://github.com/dfinity/sdk/blob/master/e2e/tests-dfx/deploy.bash#L152
anchpop
force-pushed
the
@anchpop/more-permissive-dependency-search
branch
2 times, most recently
from
July 5, 2024 20:02
d8bdd27 to
8cb81bb
Compare
Contributor
Author
|
Thanks @ericswanson-dfinity , I added an automated test |
anchpop
force-pushed
the
@anchpop/more-permissive-dependency-search
branch
from
July 5, 2024 20:18
8cb81bb to
eb41edc
Compare
ghost
approved these changes
Jul 5, 2024
anchpop
enabled auto-merge (squash)
July 5, 2024 21:03
anchpop
added a commit
to dfinity/snsdemo
that referenced
this pull request
Aug 8, 2024
Hopefully we can remove it from the SNS cli soon. Removing it from here means that won't be an issue. Thanks to dfinity/sdk#3818, it no longer serves any purpose in this repository anyway
rikonor
pushed a commit
that referenced
this pull request
Feb 3, 2025
…ters (#3818) * Make dependency search more permissive to malformed canisters * Add test
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.
How Has This Been Tested?
I created a test project called
helloand added it to my dfx.json. Then I addedunder
"canisters"in dfx.json. Here is the result of runningdfx deploy helloon dfx 0.20.1:You can see how adding this entry to
dfx.jsonhas causeddfx deploy helloto fail for no apparent reason. You even get a weird message complaining about motoko despite never having mentioned motoko in the entry formalformed.Here is the result with a version of dfx I just built from this branch:
Now, the deployment succeeds
Description
Build the canister dependency graph only for the requested canisters, instead of building it for all canisters.
The motivation for this is that sometimes
canister.builder.get_dependenciesreturns an error for some canisters, as those canisters are not properly formed (e.g. they are Motoko canisters with nomainfield). In this case, you could still theoretically calldfx deploy <canister>and you might expect dfx to not complain that some unrelated canisters in your dfx.json are not properly formed. By only callingcanister.builder.get_dependencieson canisters that are actually needed for building the canister being deployed, we can avoid this from happening.Of course,
dfx deploywithout specifying a canister will still not work. But it seems to be common for people to usedfx deploy <canister>this way, as both I and @dskloetd have run into this before and that is just the cases I know about. And I think it is not a great user experience to havedfx deploy <canister>not work in this case when it easily could.I would also like to add an automated test but I'm not sure how.
Checklist: