Skip to content

Use script-aware lock mismatch diagnostics - #20439

Open
zanieb wants to merge 1 commit into
astral-sh:mainfrom
zaniebot:zb/bughunt200/136-script-lock-diagnostics
Open

Use script-aware lock mismatch diagnostics#20439
zanieb wants to merge 1 commit into
astral-sh:mainfrom
zaniebot:zb/bughunt200/136-script-lock-diagnostics

Conversation

@zanieb

@zanieb zanieb commented Jul 15, 2026

Copy link
Copy Markdown
Member

A stale script lock reports uv.lock and suggests uv lock, directing users to update the wrong file. Show the actual script lock and a command that repairs that script, quoting its path so spaces and shell metacharacters cannot make the hint unusable.

#18832 added script-lock errors and #20219 moved lock repair guidance into a hint; this makes that hint target the script.

@zanieb zanieb added the error messages Messaging when something goes wrong label Jul 15, 2026
@zanieb
zanieb requested a review from charliermarsh July 15, 2026 15:59
.unwrap_or(script.as_os_str())
.to_os_string();
file_name.push(".lock");
PathBuf::from(file_name)

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.

Can we reuse this logic anywhere else? I thought we had a utility / abstraction for this already.

@zanieb zanieb Jul 15, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the issue is that we have LockTarget which holds a borrow and can't be used in errors.

I complained about this in my self-review and it was supposed to be fixed (at least, the relationship was supposed to be mentioned in the LockTargetKind comment. Let me see... it's also plausible we can abstract this specific logic.

@zanieb
zanieb force-pushed the zb/bughunt200/136-script-lock-diagnostics branch from 10ace64 to 25b578b Compare July 15, 2026 21:48
@astral-sh-bot

astral-sh-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the latest main baseline.

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

Added:

  • uv::lock::lock::lock_script_locked_hint_with_spaces

Removed: none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Messaging when something goes wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants