Skip to content

Validate locked versions satisfy requirement specifiers - #18566

Closed
zanieb wants to merge 10 commits into
astral-sh:mainfrom
zaniebot:claude/add-tests-issue-12276-T9DTw
Closed

zanieb wants to merge 10 commits into
astral-sh:mainfrom
zaniebot:claude/add-tests-issue-12276-T9DTw

Conversation

@zanieb

@zanieb zanieb commented Mar 19, 2026

Copy link
Copy Markdown
Member

No description provided.

@zanieb
zanieb force-pushed the claude/add-tests-issue-12276-T9DTw branch from 892f0f2 to 92b8d9e Compare March 19, 2026 13:48
@codspeed

codspeed Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 14 untouched benchmarks


Comparing zaniebot:claude/add-tests-issue-12276-T9DTw (5556e97) with main (afc3443)

Open in CodSpeed

@zanieb
zanieb force-pushed the claude/add-tests-issue-12276-T9DTw branch from 92b8d9e to cc7bcbc Compare March 19, 2026 22:01

@themavik themavik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The specifier check runs over requirements and constraints but skips overrides and build_constraints. If a project has tool.uv.override-dependencies = ["foo==1.0.0"] and the lock has foo at 2.0.0, the new check still passes because it only sees the base requirement specifier, not the override.

Might be intentional since manifest equality already catches changed override sets — but a tampered lock with matching manifest and wrong pinned version would still slip through for overrides specifically.

@zanieb
zanieb force-pushed the claude/add-tests-issue-12276-T9DTw branch from cc7bcbc to caa49aa Compare March 24, 2026 13:12
@zaniebot
zaniebot force-pushed the claude/add-tests-issue-12276-T9DTw branch from caa49aa to 6b1f25c Compare June 2, 2026 19:31
@astral-sh-bot

astral-sh-bot Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

uv test inventory changes

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

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

Added:

  • uv::it::lock::check_locked_version_valid_disjoint_constraint_offline_locked
  • uv::it::lock::check_locked_version_valid_forked_dependency_group_resolution_offline_locked
  • uv::it::lock::check_locked_version_valid_forked_resolution
  • uv::it::lock::check_locked_version_valid_inactive_extra_dependency_group_offline_locked
  • uv::it::lock::check_locked_version_valid_override_offline_locked
  • uv::it::lock::check_locked_version_valid_script_override_offline_locked
  • uv::it::lock::check_locked_version_violates_conflict_forked_constraint_specifier
  • uv::it::lock::check_locked_version_violates_conflict_marked_dependency_specifier
  • uv::it::lock::check_locked_version_violates_constraint_dependencies
  • uv::it::lock::check_locked_version_violates_dependency_group_specifier
  • uv::it::lock::check_locked_version_violates_marker_scoped_local_dependency_specifier
  • uv::it::lock::check_locked_version_violates_non_project_dependency_group_specifier
  • uv::it::lock::check_locked_version_violates_not_equal_constraint
  • uv::it::lock::check_locked_version_violates_transitive_override_specifier
  • uv::it::lock::check_locked_version_violates_upper_bound_constraint

Removed: none

claude and others added 10 commits June 2, 2026 16:36
…l-sh#12276)

Add three integration tests that demonstrate the bug where `uv lock --check`
fails to detect when locked versions in `uv.lock` violate constraints
specified in `pyproject.toml`. Tests cover `!=`, `<`, and
`constraint-dependencies` specifiers.

https://claude.ai/code/session_01NvteAXNxPeHJ6GxKUQNe4f
…2276)

Add checks in `Lock::satisfies()` that verify locked package versions
actually satisfy the version specifiers from requirements, constraints,
and `requires-dist` metadata. Previously, validation only confirmed that
the specifier metadata matched between `pyproject.toml` and `uv.lock`,
without verifying the locked versions satisfied those specifiers.

Update test snapshots to reflect that `uv lock --check` now correctly
detects constraint violations.

https://claude.ai/code/session_01NvteAXNxPeHJ6GxKUQNe4f
@zaniebot
zaniebot force-pushed the claude/add-tests-issue-12276-T9DTw branch from 6b1f25c to 5556e97 Compare June 2, 2026 21:39
astral-automations-bot Bot pushed a commit to astral-sh/uv-dev that referenced this pull request Nov 24, 2026
This PR adds more lock file validation. Specifically, it tries to ensure
that requirements in the lock file are consistent with package versions
in the lock file. A basic version of this is somewhat easy, but things
get more complicated when we need to account for overrides and
constraints.

Closes astral-sh#12276, Closes astral-sh#18566, Ref astral-sh#21484, Closes astral-sh#23073, Closes astral-sh#23143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants