Skip to content

Use Lock::from_toml consistently, check version - #20924

Merged
woodruffw merged 3 commits into
mainfrom
ww/parse-lock
Aug 4, 2026
Merged

woodruffw merged 3 commits into
mainfrom
ww/parse-lock

Conversation

@woodruffw

Copy link
Copy Markdown
Member

Summary

See #20921 (comment) for context.

This accomplishes two goals:

  • We now use the faster lockfile parsing path when parsing tool installation lockfiles
  • We now correctly validate the lockfile's version in uv tool subcommands, which is consistent with what the project commands do

Test Plan

Added a test demonstrating the change. The behavior from the change is arguably surprising, though: ToolLock::read silently skips the lockfile if it's invalid, which includes our new version check. Arguably that should be stronger, i.e. we should reject if the lockfile is malformed (or at least warn?).

Signed-off-by: William Woodruff <william@yossarian.net>
@woodruffw
woodruffw requested review from charliermarsh and zsol August 3, 2026 18:41
@woodruffw woodruffw added performance internal A refactor or improvement that is not user-facing area:uv-tool Related to the uv tool interface labels Aug 3, 2026
Comment thread crates/uv/src/commands/project/lock_target.rs Outdated
Signed-off-by: William Woodruff <william@yossarian.net>
@woodruffw

Copy link
Copy Markdown
Member Author

Sorry, re-requesting review since I changed the approach 😅

@woodruffw woodruffw changed the title Devolve parse_lock, use for ToolLock Use Lock::from_toml consistently, check version Aug 3, 2026
Signed-off-by: William Woodruff <william@yossarian.net>
@astral-sh-bot

astral-sh-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the main base revision.

  • Added tests: 2
  • Removed tests: 0
  • Changed suites: 1
uv-resolver: +2 / -0

Added:

  • uv-resolver::lock::deserialize::tests::unparsable_unsupported_lock_version_is_identified
  • uv-resolver::lock::deserialize::tests::unsupported_lock_version_is_rejected

Removed: none

@zsol zsol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, this looks great! Gotta make sure the pub fields we just hid aren't used by known projects that use our crates

@woodruffw

Copy link
Copy Markdown
Member Author

Took a quick look at the reverse deps on crates.io and couldn't find any third-party users of uv-resolver. But there might be a better place to discover our downstreams that I'm not aware of 🙈

@woodruffw
woodruffw merged commit 363819b into main Aug 4, 2026
60 checks passed
@woodruffw
woodruffw deleted the ww/parse-lock branch August 4, 2026 13:28

This branch was previously deployed

1 inactive deployment
automations — 32a257a3 Deployed Aug 3, 2026 by woodruffw via review / security review #44049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:uv-tool Related to the uv tool interface internal A refactor or improvement that is not user-facing performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants