Repository navigation
Commit 08c30b7
committed
Keep Pipenv's index on hosted entries so rollback restores it exactly
The hosted Pipfile.lock rewrite dropped each entry's `index`, and the
ledger-free upstream restore then guessed it from sibling registry
entries (none -> the PyPI source name; all siblings index-less -> none).
Pipenv's own choice cannot be re-derived from the lock or the Pipfile:
for the same Pipfile it depends on the release and the locking
environment (measured with real `pipenv lock`):
shape 2018.11.26 2020-2022 2023.12.1-2026.8.0
direct pypi pypi pypi
extras table pypi pypi (none)
marker-excluded pypi (none) (none)
transitive (none) (none) (none)
So the backtest's rollbackRestoresLockBytes failed on 2022.12.19
extras (transitive pysocks sibling has no index -> index dropped) and
on 2022.12.19 / 2026.8.0 marker-excluded (no siblings -> "pypi"
added), and rollbackAfterRelockRetires failed on 2026.8.0
marker-excluded: the relock hybrid (our `file` kept, `version` and
registry `hashes` restored, no `index`) was restored with an `index`
Pipenv never wrote.
The hosted rewrite now keeps `index` exactly as Pipenv wrote it
(present or absent) and only drops `version`; the restore carries the
entry's `index` back unchanged instead of choosing one, refusing when
it (or the Pipfile's explicit index) does not name a PyPI source in
`_meta.sources`. A `file` entry carrying `index` installs the
referenced wheel itself (direct_url.json present) on Pipenv
2018.11.26, 2020.11.15, 2021.11.23, 2022.12.19, 2023.12.1, 2024.4.1,
2025.1.3 and 2026.8.0 (`install --deploy`, `sync`, `verify`), and a
marker-excluded one stays uninstalled; Pipenv 7-11 ignore `index` on a
`path` entry (convert_deps_to_pip skips it for file/path deps).
Tests: real Pipenv 2018.11.26 / 2022.12.19 / 2026.8.0 locks for the
extras and marker-excluded shapes (tests/fixtures/pipenv-shapes) round
trip byte for byte in LF and CRLF, and the 2026.8.0 marker-excluded
relock hybrid restores the pristine bytes. The backtest's
allCategoriesRewritten now expects hosted entries to keep the pristine
`index` (vendored still drops it).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018tncU7u7FK48tubFNA12UQ1 parent e36ba5b commit 08c30b7
21 files changed
Lines changed: 537 additions & 76 deletions
File tree
- crates
- socket-patch-cli
- tests
- socket-patch-core
- src/patch/redirect
- upstream
- tests
- fixtures
- pipenv-shapes
- 2018.11.26
- extras
- marker-excluded
- 2022.12.19
- extras
- marker-excluded
- 2026.8.0
- extras
- marker-excluded
- vex-discover-golden
- docs/testing
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
125 | 140 | | |
126 | 141 | | |
127 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
361 | 366 | | |
362 | 367 | | |
363 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | 379 | | |
381 | 380 | | |
382 | 381 | | |
| |||
388 | 387 | | |
389 | 388 | | |
390 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
391 | 400 | | |
392 | 401 | | |
393 | | - | |
394 | 402 | | |
395 | 403 | | |
396 | 404 | | |
| |||
594 | 602 | | |
595 | 603 | | |
596 | 604 | | |
597 | | - | |
598 | | - | |
599 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
600 | 609 | | |
601 | 610 | | |
602 | 611 | | |
| |||
609 | 618 | | |
610 | 619 | | |
611 | 620 | | |
612 | | - | |
| 621 | + | |
613 | 622 | | |
614 | 623 | | |
615 | 624 | | |
| |||
0 commit comments