Repository navigation
Respect scoped dependencies when validating metadata-free locks - #20803
Closed
charliermarsh wants to merge 21 commits into
Closed
charliermarsh wants to merge 21 commits into
charliermarsh wants to merge 21 commits into
Conversation
charliermarsh
temporarily deployed
to
automations
July 29, 2026 22:24 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 29, 2026 22:38 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 29, 2026 22:51 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 29, 2026 23:04 — with
GitHub Actions
Inactive
uv test inventory changesThis PR changes the tests when compared with the
|
charliermarsh
temporarily deployed
to
automations
July 30, 2026 00:07 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 00:26 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 01:01 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 01:18 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 02:02 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 02:24 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 02:35 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 04:37 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 04:54 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 05:09 — with
GitHub Actions
Inactive
Merging this PR will not alter performance
Comparing Footnotes
|
charliermarsh
temporarily deployed
to
automations
July 30, 2026 06:13 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 06:27 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 06:42 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 18:04 — with
GitHub Actions
Inactive
charliermarsh
temporarily deployed
to
automations
July 30, 2026 18:34 — with
GitHub Actions
Inactive
charliermarsh
had a problem deploying
to
automations
July 30, 2026 19:39 — with
GitHub Actions
Error
charliermarsh
temporarily deployed
to
automations
July 30, 2026 19:48 — with
GitHub Actions
Inactive
charliermarsh
added a commit
that referenced
this pull request
Sep 15, 2026
The previous iterations of `package.metadata`-free lockfiles had missed a number of cases, and made it hard to ensure that all cases were actually covered. This PR takes a new approach: Remove the previous implementation, and then re-add it feature-by-feature in reviewable commit units. Each commit adds one feature that uv supports. The new approach is not entirely `package.metadata`-free, instead remote URL, which can activate other URL source, now have `package.metadata` which they previously didn't. That's required for offline validation (which is crucial for `uv lock --check` performance, offline or not) and IMO the more correct tradeoff: We shouldn't repeat information that's already available on disk, but we should state what we expect from remote resources. `uv.lock` revision 1.4 additionally records empty extras so `--frozen --extra foo` if the lock wasn't generated with extra `foo` present, but it was added to `pyproject.toml` afterwards. This is a lockfile size regression if you're using a lot of remote URLs, otherwise it's still a much smaller lockfile for large workspaces. Remote source are usually used sparingly as they are worse for performance, reliability and auditability than registry sources. ## Validation This change reflects basically every resolver assumption and form of dependency specification and also hits a number of preexisting bugs (see upstack PRs and skipped changes list). Instead of trying to reason through correctness from the features we're representing, this PR was tested (and fixed) against large, diverse validation set, checking that uv's invariants are upheld with lockfile revision 1.4. The PR is additionally split into one commit per feature the new freshness check support, to ease reviewing and ensure that all features are covered. The most import check that needs to always pass is `uv lock --check --offline --no-cache` on a fresh lockfile. We don't need to check features such as `uv sync`, as `package.metadata` is only used for fast path freshness checks, and `uv lock --check --offline --no-cache` exercises the offline fast path while blocking the slow path if it would use the internet (which is unacceptable both for performance and for checks that run in isolated environments). The goal is to cover the available dependency specification that people use, while not fixing unrelated bugs in this already large change. There are three of these larger validations. The first one is a script finds public GitHub projects with editable packages, workspaces, Git dependencies or dynamically generated dependencies and then verifies that both the original lockfile and a version with package metadata removed pass `uv lock --check --offline --no-cache` inside an isolated docker container. This dataset contained 254 projects with 14k locked packages. The second validation uses the check-mode in https://github.com/astral-sh/uv-ecosystem-testing with `UV_PREVIEW_FEATURES=lock-without-metadata` . The third one is running the test suite migrated to lockfile revision 1.4 with 4b98802, passing 4.8k tests: ``` features=test-python-patch,test-universal,native-auth cargo insta test --accept --test-runner nextest --workspace --features "$features" cargo nextest run --workspace --features "$features" ``` The PR handles the test cases and fixes from #20803 too. The area with the least coverage wrt to its complexity is conflicts supports. While the support is implemented, I'd consider its current support much weaker than the rest of the features. ## Skipped changes The following independent bugfixes are deliberately excluded from this stack: - #21210. - #21225. The cache assertion remains a TODO here. The 4.8k-test run above included the add-cache fix and predates this extraction; it is not a fresh full-suite run of the reduced stack. --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Metadata-free lock validation must reconstruct dependencies using the same package-scoped override and exclusion semantics as the resolver.
Dynamic source trees intentionally omit their version from uv.lock, so use the freshly built distribution version for scoped rules and bypass static metadata only when relevant scoped rules are present. This accepts unchanged locks and invalidates stale locks when a dynamic version changes which rule applies.
Apply package-scoped overrides and exclusions before flattening recursive extras, matching resolver order. Otherwise an overridden or excluded self-reference can reactivate an extra, invent a dependency edge, and cause an unchanged metadata-free lock to fail offline.
Add deterministic offline integration coverage for version-specific overrides, versionless fallback precedence, scoped exclusions, dynamic-version changes, and overridden or excluded recursive extras.