mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-29 16:13:47 +00:00
Validate lockfile (rather than re-resolve) in uv lock
(#6091)
## Summary Historically, in order to "resolve from a lockfile", we've taken the lockfile, used it to pre-populate the in-memory metadata index, then run a resolution. If the resolution didn't match our existing resolution, we re-resolved from scratch. This was an appealing approach because (in theory) it didn't require any dedicated logic beyond pre-populating the index. However, it's proven to be _really_ hard to get right, because it's a stricter requirement than we need. We just need the current lockfile to _satisfy_ the requirements provided by the user. We don't actually need a second resolution to produce the exact same result. And it's not uncommon that this second resolution differs, because we seed it with preferences, which fundamentally changes its course. We've worked hard to minimize those "instabilities", but they're still present. The approach here is intended to be much simpler. Instead of resolving from the lockfile, we just check if the current resolution satisfies the state of the workspace. Specifically, we check if the lockfile (1) contains all the relevant members, and (2) matches the metadata for all dependencies, recursively. (We skip registry dependencies, assuming that they're immutable.) This may actually be too conservative, since we can have resolutions that satisfy the requirements, even if the requirements have changed slightly. But we want to bias towards correctness for now. My hope is that this scheme will be more performant, simpler, and more robust. Closes https://github.com/astral-sh/uv/issues/6063.
This commit is contained in:
parent
359f39ca0f
commit
e3f345ce09
30 changed files with 5641 additions and 2546 deletions
|
@ -3,7 +3,7 @@ pub use error::{NoSolutionError, NoSolutionHeader, ResolveError};
|
|||
pub use exclude_newer::ExcludeNewer;
|
||||
pub use exclusions::Exclusions;
|
||||
pub use flat_index::FlatIndex;
|
||||
pub use lock::{Lock, LockError, TreeDisplay};
|
||||
pub use lock::{Lock, LockError, ResolverManifest, TreeDisplay};
|
||||
pub use manifest::Manifest;
|
||||
pub use options::{Options, OptionsBuilder};
|
||||
pub use preferences::{Preference, PreferenceError, Preferences};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue