Commit e31da36
fix(core): hosted/vendored rewriter fixes found by the real-PM matrices
First of seven commits that land the manifest-less VEX branch
(feat/vex-lockfile-inventory) on top of #247. The branch's ~165-commit
history, built on the pre-#247 main 9489b18 with per-PM merge commits, was
squashed onto 09956d9 and re-split by concern; the full pre-rebase history
is preserved on branch backup/vex-lockfile-pre-rebase.
These are the product bugs the per-PM real-toolchain matrices turned up
while the manifest-less VEX suites were written. Each is independent of
VEX and pinned by a core regression test:
- composer (hosted): the rewriter drops the entry's `source` block when it
immediately precedes `dist` (one `redirect_composer_dist` fragment edit
spanning both, reverted byte-for-byte). Composer 1 and 2.2 LTS silently
installed the pristine upstream commit from git whenever the hosted
download failed; a hand-ordered source that cannot be dropped warns
`redirect_composer_source_kept`. Golden fixture: `source-and-dist`.
- gem (hosted): the patch-registry `GEM` section is inserted in bundler's
source order (sorted by remote), so a frozen `bundle install` on bundler
>= 4.0.19 accepts the converged lock. The `basic` golden and the exact
lock expectations move the Socket section first.
- cargo (hosted + vendored): a v1 `Cargo.lock` (checksums in `[metadata]`,
dependents naming the crate by its full package id) is redirected and
vendored correctly: the `[metadata]` line and every dependent's full-id
reference follow the source, each fragment its own ledger edit, and
`cargo --locked` accepts the result; the vendored detach/restore of a v1
entry is byte-identical. `plan_cargo_lock` keeps #247's multi-source
twin disambiguation (`Ambiguous`) and hoisted regexes; the block end now
also stops at a trailing `[metadata]` / `[[patch.unused]]`, and the
checksum is inserted after a block-final `source` line too.
- yarn berry (hosted + vendored): written checksums follow the lock's own
spelling — yarn 4.0.0–4.0.2 spell `10c0` checksums as bare hex, so the
prefixed form failed `yarn install --immutable` with YN0028.
- npm (vendored): npm 12 reifies from the `package-lock.json` it creates
beside a committed shrinkwrap, so `vendor` now rewires every present npm
lock (siblings first, primary last; an unrewirable sibling warns
`vendor_npm_sibling_lock_unwired`), and the in-use/revert probes read
every npm lock before deleting an artifact. `select_lockfile` reads
through #247's guarded `read_regular_to_bytes`.
- npm (hosted): a lockfileVersion 1 redirect warns
`redirect_npm_legacy_client` — npm 6 ignores a v1 lock's `resolved` and
fails EINTEGRITY against the patched pin.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent e024629 commit e31da36
11 files changed
Lines changed: 1416 additions & 168 deletions
File tree
- crates/socket-patch-core
- src
- patch/redirect
- vendor
- tests/fixtures/redirect
- composer/composer-lock/source-and-dist
- expected
- input
- gem/bundler/basic/expected
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 | | |
27 | 38 | | |
28 | 39 | | |
| |||
99 | 110 | | |
100 | 111 | | |
101 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
102 | 146 | | |
103 | 147 | | |
104 | 148 | | |
| |||
132 | 176 | | |
133 | 177 | | |
134 | 178 | | |
135 | | - | |
| 179 | + | |
136 | 180 | | |
137 | 181 | | |
138 | 182 | | |
139 | 183 | | |
140 | 184 | | |
141 | 185 | | |
142 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
143 | 201 | | |
144 | 202 | | |
145 | 203 | | |
| |||
159 | 217 | | |
160 | 218 | | |
161 | 219 | | |
| 220 | + | |
162 | 221 | | |
163 | 222 | | |
164 | 223 | | |
| |||
167 | 226 | | |
168 | 227 | | |
169 | 228 | | |
170 | | - | |
| 229 | + | |
171 | 230 | | |
172 | 231 | | |
173 | 232 | | |
| |||
183 | 242 | | |
184 | 243 | | |
185 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
186 | 265 | | |
187 | 266 | | |
188 | 267 | | |
| |||
300 | 379 | | |
301 | 380 | | |
302 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
303 | 437 | | |
304 | 438 | | |
305 | 439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
397 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
398 | 399 | | |
399 | 400 | | |
400 | 401 | | |
| |||
431 | 432 | | |
432 | 433 | | |
433 | 434 | | |
434 | | - | |
435 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
436 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
437 | 445 | | |
438 | 446 | | |
439 | 447 | | |
440 | 448 | | |
441 | 449 | | |
442 | 450 | | |
| 451 | + | |
443 | 452 | | |
444 | 453 | | |
445 | | - | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
446 | 458 | | |
447 | 459 | | |
448 | | - | |
| 460 | + | |
449 | 461 | | |
450 | 462 | | |
451 | 463 | | |
| |||
0 commit comments