Repository navigation
Commit f8cf609
Restore the uv 0.2 pins hosted mode writes (#2014)
* Restore the uv 0.2 pins hosted mode writes
Hosted mode rewires uv 0.2 `[[distribution]]` locks (uv < 0.2.35) in all
three of their grammars, but the hosted unwind refused every such pin
("which grammar this lock follows is not derivable"), so `rollback`,
`remove` and `scan` could not undo what hosted wrote.
The grammar is derivable: it is the same evidence the rewrite follows.
The entry's own hosted source keeps its spelling (`"direct+<url>"` vs
`{ url }`), and the lock's other registry packages show the registry,
the artifact shape (`[distribution.sdist]` / `[[distribution.wheel]]`
sub-tables vs inline `sdist` / `wheels`) and the artifact keys. So the
unwind now restores these entries like `[[package]]` ones:
- the source goes back to `"registry+<R>"` or `{ registry = R }` in the
entry's spelling;
- artifacts are re-derived from PyPI in the siblings' shape, with uv
<= 0.2.5's `wheel` key and its sub-table order (sdist before the
entry's `[[distribution.dependencies]]`, wheels after);
- dependents' references, inline or `[[distribution.dependencies]]`
tables with string sources, are pointed back.
The paired pyproject is restored as before. Vendored still refuses these
locks (no portable local wheel spelling), unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Prove the uv 0.2 unwind faithful, refuse what it can't restore
Review fixes for the uv 0.2 `[[distribution]]` hosted unwind, checked
against real `uv lock` output from uv 0.1.45 to 0.2.35:
- Every one of those releases records every file of a release on every
platform, so a pure-Python 3 release re-derives faithfully in all
three grammars. The tests now round-trip real 0.1.45, 0.2.5, 0.2.15,
0.2.16, 0.2.18 and 0.2.34 locks (tests/fixtures/upstream/uv-0.2).
- uv <= 0.2.5 write an entry's sdist and wheel sub-tables before its
dependency tables; the unwind had the wheel after them.
- uv 0.2.18-0.2.22 write an inline sdist before inline dependencies,
0.2.23-0.2.34 after them, and nothing else in the lock tells them
apart. The order is read off another registry entry carrying both;
without one the rewrite refuses to wire the entry and the unwind
refuses to restore it.
- uv 0.2.12-0.2.27 apply an exclude-newer cutoff from [tool.uv], a
project or user uv.toml, or UV_EXCLUDE_NEWER without recording it;
0.2.28-0.2.33 record it at the lock's top level. The unwind refuses
on any of them for the inline grammar (and on the top-level key), and
the rewrite refuses a lock whose project sets one.
- One grammar detector in utils/python_lock.rs serves both directions:
the entry's own artifacts decide, then any other entry's (the
rewrite's whole-text search is gone).
- Sources are restored through UvSource in their own spelling, a
standard [distribution.source] table included, with accurate errors;
artifact_tables reuses table_likes.
Docs: CLI_CONTRACT.md and docs/testing/uv-compatibility.md describe the
restore, the refusals and the measured boundaries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Don't treat exclude-newer-package as a uv 0.2 lock cutoff
sets_exclude_newer matched every key starting with exclude-newer, so a
project setting exclude-newer-package (a per-package cutoff, or a false
exemption) made hosted rewrite and the uv 0.2 unwind refuse every inline
[[distribution]] pin. uv 0.2.12-0.2.27, the releases whose unrecorded
cutoff this guards against, predate that key and ignore it, so only the
global exclude-newer cutoff blocks those locks. The pyproject [options]
path in upstream/uv.rs already excluded the key the same way.
Found by Cursor Bugbot on ab4f0f8.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011f9aeQKNTJYztmYaJaAEsc
* Refuse to wire uv locks whose exclude-newer the unwind refuses
Second review round, plus the known follow-up.
- A uv lock that records an `exclude-newer` cutoff for the package (a
global one under `[options]` or, for uv 0.2.28-0.2.33, at the top
level, or an `exclude-newer-package` naming it) was still wired by
hosted mode, though the unwind always refuses such a pin. The rewrite
now refuses it (`redirect_uv_lock_unsupported`), for `[[package]]` and
`[[distribution]]` locks alike. One classifier, `upstream::lock_cutoff`,
serves the rewrite and the unwind.
- The rewrite's project-settings cutoff check for `[[distribution]]`
locks re-implemented uv settings discovery and missed the settings file
above the root (`UV_ANCESTOR_CONFIG_KEY`) the unwind reads. It now uses
`pylock_uv_settings` / `root_uv_settings`, computed once per run
rather than per dep.
- The sdist / inline-dependencies refusal ran before the not-applicable
checks, turning an entry the rewrite does not touch (a non-registry,
non-direct source) into a hard refusal. It now runs after them.
- docs/testing/uv-compatibility.md no longer contradicts itself on which
release files a 0.2.x lock records.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 57923a3 commit f8cf609
22 files changed
Lines changed: 1549 additions & 110 deletions
File tree
- crates
- socket-patch-cli
- socket-patch-core
- src
- hosted
- patch/redirect
- upstream
- utils
- tests
- fixtures
- upstream/uv-0.2
- 0.1.45
- 0.2.15
- 0.2.16
- 0.2.18
- 0.2.34
- 0.2.5
- vex-discover-golden
- docs/testing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1268 | 1268 | | |
1269 | 1269 | | |
1270 | 1270 | | |
1271 | | - | |
| 1271 | + | |
1272 | 1272 | | |
1273 | 1273 | | |
1274 | 1274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1356 | 1356 | | |
1357 | 1357 | | |
1358 | 1358 | | |
1359 | | - | |
| 1359 | + | |
1360 | 1360 | | |
1361 | 1361 | | |
1362 | 1362 | | |
| |||
1381 | 1381 | | |
1382 | 1382 | | |
1383 | 1383 | | |
1384 | | - | |
| 1384 | + | |
1385 | 1385 | | |
1386 | 1386 | | |
1387 | 1387 | | |
1388 | | - | |
| 1388 | + | |
1389 | 1389 | | |
1390 | 1390 | | |
1391 | | - | |
1392 | 1391 | | |
1393 | 1392 | | |
1394 | 1393 | | |
| |||
0 commit comments