-
Notifications
You must be signed in to change notification settings - Fork 2.9k
uv lock --check --refresh false positive in workspace with [tool.uv.conflicts] #18553
Description
`uv lock --check --refresh` reports "lockfile needs to be updated" (exit 1) even when `uv lock --refresh` produces a byte-for-byte identical lockfile. This is a false positive — confirmed by running `git diff uv.lock` immediately after, which shows zero changes.
Minimal reproducible example
https://github.com/kingjin94/workspace-conflicts/tree/repro/uv-check-refresh-false-positive
A workspace with 4 packages each declaring conflicting prod/non-prod extras (`psycopg2` vs `psycopg2-binary`) via `[tool.uv.conflicts]`.
git clone https://github.com/kingjin94/workspace-conflicts
cd workspace-conflicts
git checkout repro/uv-check-refresh-false-positive
bash repro-check-refresh.shFull output:
=== Step 1: uv lock --refresh (writes result) ===
Resolved 7 packages in 170ms
Exit code: 0
=== Step 2: git diff uv.lock (should be empty) ===
No changes — lockfile is up to date
=== Step 3: uv lock --check --refresh (should also pass, but fails) ===
Resolved 7 packages in 151ms
The lockfile at `uv.lock` needs to be updated, but `--check` was provided. To update the lockfile, run `uv lock`.
Exit code: 1
Steps 1 and 2 prove the lockfile is genuinely current. Step 3 is a false positive.
Notes
The workspace uses `[tool.uv.conflicts]` to declare prod/non-prod extras as incompatible. This generates conflict fork markers in the lockfile. The `--check` validation pass appears to apply different marker normalization than the write pass, causing a structural mismatch even when the lockfile content is semantically identical.
This is a distinct surviving variant after the fixes in:
uv lock --checkfails even thoughuv lockgives no updates #13614 (fixed in 0.7.x — `--check` false positive with Python version markers)- The uv lock --check command fails even though it should pass. #15869 (fixed in 0.8.23 — `--check` false positive with `include-group` conflicts)
uv lock --upgrade --dry-rungiving "Lockfile changes detected" despite no changes #16839 (fixed in 0.10.6 — `--dry-run` false positive with fork markers)
Confirmed still present on 0.10.11 with a workspace using `[tool.uv.conflicts]` + extras.