-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[move lockfile] rename dependency name
field to id
and add a separate name
field to store manifest name
#19387
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, thanks @kklas ! Just a couple of smaller (but important) questions. Also a thought: Would it make sense to make name
optional if it already matches id
? I can think of arguments on both sides.
external-crates/move/crates/move-package/src/resolution/dependency_graph.rs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting -- first example of the id
and name
being different -- this wasn't the case I expected! Is it possible that this shouldn't be how things work in the presence of external resolution?
When we externally resolve a package, the name given to the dependency that invokes the external resolver is not meaningful to the final dependency graph and I wonder whether that's changed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't external resolution or loading from lockfile happening here. name
and id
are different here because there is a special id resolution hook registered for the tests that when it encounters *-Rename
for package name it will resolve its id to *-Resolved
.
Hm I suppose we could just load |
I just noticed that in most cases the I'm not strongly attached to the idea, I was just curious to get your thoughts. |
Yes, I think there's no technical reason to have this so it's difficult to justify special casing the code like this which will make it more difficult to understand. |
Is there anything else we need to do aside from bumping the version to |
Ah good question -- the intention is typically that newer versions of the binary can read and understand older lock files. In this case, would it work to treat |
I think that makes sense. It would mean making Another thing to consider is that we will have to ignore old lockfiles of dependencies once on-chain hooks land because it will lead to inconsistencies (e.g. duplicate modules of |
It sounds to me like the easiest of those options is the one you originally suggested, given the issues when the on-chain hook gets enabled (namely that if we see a lock file of an older version, we ignore it, and recompute it) -- if we made things backwards compatible today, we are only kicking the can down the road, same for adding a versioned schema, which is not difficult, but wouldn't be useful once the package hook lands. I don't think we want to add a different |
Yep, makes sense! I made the resolver ignore the lockfile when it's lower version and bump the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks @kklas !
Landed -- thanks @kklas ! |
Description
As discussed in #14178 (comment) (second and third point), a few changes to the lockfile:
name
field independencies
is renamed toid
to better reflect the meaning in the dependency graph (the packages are discriminated by their identifier, as resolved by the hook, which is not necessarily their manifest name)name
field which will store the dependency manifest name (this is needed to show user-friendly error messages using the package manifest name instead of identifier which may be confusing)This is part of the work to enable compiling against on-chain dependencies #14178.
cc @rvantonder @amnn
Test plan
All changes are covered by existing unit tests.
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.
name
field toid
and introduces a separatename
field that stores the package's name from its manifest for improved error reporting. Older lock files will be ignored when resolving dependencies so that this information is always available.