Skip to content

Commit d951455

Browse files
committed
Merge release/v5-prerelease (#283) into v5/remove-setup-and-ui
Take #283's deletion of repair_vendor.rs and its ledger-rebuild tests. Keep this PR's help grouping in the README command table with #283's "re-vendor" wording, drop the setup-only `ecosystem_not_setup` row from CLI_CONTRACT, and keep vendor advisories code-free in human output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PQaKzoW5dSw9u5pgAAvVRj
2 parents 2374af1 + 06437d2 commit d951455

35 files changed

Lines changed: 2854 additions & 6340 deletions

‎.github/workflows/bun-compatibility.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ on:
4343
- 'crates/socket-patch-cli/src/commands/scan/**'
4444
- 'crates/socket-patch-cli/src/commands/rollback.rs'
4545
- 'crates/socket-patch-cli/src/commands/vendor.rs'
46-
- 'crates/socket-patch-cli/src/commands/repair_vendor.rs'
46+
- 'crates/socket-patch-cli/src/commands/vendored_backend/**'
4747
- 'crates/socket-patch-cli/src/commands/remove.rs'
4848
# Main runs are the only rust-cache writers (save-if below), so a
4949
# path-filtered push trigger is what seeds the cache the PR builds restore
@@ -75,7 +75,7 @@ on:
7575
- 'crates/socket-patch-cli/src/commands/scan/**'
7676
- 'crates/socket-patch-cli/src/commands/rollback.rs'
7777
- 'crates/socket-patch-cli/src/commands/vendor.rs'
78-
- 'crates/socket-patch-cli/src/commands/repair_vendor.rs'
78+
- 'crates/socket-patch-cli/src/commands/vendored_backend/**'
7979
- 'crates/socket-patch-cli/src/commands/remove.rs'
8080
workflow_dispatch:
8181
inputs:

‎.github/workflows/vlt-compatibility.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ on:
3636
- 'crates/socket-patch-cli/src/commands/rollback.rs'
3737
- 'crates/socket-patch-cli/src/commands/remove.rs'
3838
- 'crates/socket-patch-cli/src/commands/vendor.rs'
39-
- 'crates/socket-patch-cli/src/commands/repair_vendor.rs'
39+
- 'crates/socket-patch-cli/src/commands/vendored_backend/**'
4040
- 'crates/socket-patch-cli/src/commands/get.rs'
4141
- 'crates/socket-patch-cli/src/commands/vlt_preflight.rs'
4242
- 'crates/socket-patch-cli/src/commands/scan/**'
@@ -72,7 +72,7 @@ on:
7272
- 'crates/socket-patch-cli/src/commands/rollback.rs'
7373
- 'crates/socket-patch-cli/src/commands/remove.rs'
7474
- 'crates/socket-patch-cli/src/commands/vendor.rs'
75-
- 'crates/socket-patch-cli/src/commands/repair_vendor.rs'
75+
- 'crates/socket-patch-cli/src/commands/vendored_backend/**'
7676
- 'crates/socket-patch-cli/src/commands/get.rs'
7777
- 'crates/socket-patch-cli/src/commands/vlt_preflight.rs'
7878
- 'crates/socket-patch-cli/src/commands/scan/**'

‎CHANGELOG.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,30 @@ into the new version's section — see docs/releasing.md.
293293
(`https://repo.packagist.org`) and `SOCKET_NUGET_URL`
294294
(`https://api.nuget.org`).
295295

296+
- **`repair` no longer rebuilds the vendor ledger from lockfiles.** A
297+
lockfile that references `.socket/vendor/<eco>/<uuid>/` with no entry in
298+
`.socket/vendor/state.json` now fails with `vendor_ledger_missing` (an
299+
artifact-level `failed` event with `uuid` and `details.{ecosystem,path}`;
300+
exit 1) instead of re-synthesizing the entry (`details.ledgerRestored` is
301+
gone). The rewired lockfile cannot supply the pre-vendor originals a
302+
revert needs, so the remedy is restoring `state.json` from version
303+
control (or `git checkout -- <lockfile>` and re-vendoring). The unverified
304+
npm "rebuild from the wired integrity" rung and the gem Gemfile wiring
305+
reconstruction went with it; `rollback`'s missing-ledger error now asks
306+
for `state.json` to be restored instead of naming `repair`.
307+
- **`repair` re-vendors broken artifacts the way `vendor` does.** Missing
308+
or corrupt vendored artifacts go through the same vendored backend as
309+
`vendor` / `scan --mode vendored` / `get --mode vendored`, so under the
310+
default `--vendor-source auto` the patch service's prebuilt artifact is
311+
downloaded again, with a local build as the fallback (and the only
312+
source under `--offline` / `--vendor-source build`). The result is still
313+
verified against the ledger fingerprint before it counts as `rebuilt`.
314+
Failure details are now `vendor`'s own (for example "no installed
315+
package found on disk"), and a drifted installed copy of a gem or pypi
316+
release variant is no longer force-overwritten by repair — it fails the
317+
same installed-variant check `vendor` applies. Internally, `vendor`, `scan`/`get --mode vendored`, `vendor --revert`,
318+
`rollback`'s vendored leg, `remove` and `repair` now share one
319+
`VendoredBackend { apply, revert, repair }`.
296320
- **Vendored runs refuse lock-text failures before downloading them.**
297321
`scan --mode vendored` and `get --mode vendored` evaluate the vendor
298322
backends' pure lock-text gates — pnpm, yarn classic and yarn berry

‎README.md‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ need the network and refuse to run with `--offline`.
476476
| [`remove`](#remove) | The single-patch form of `rollback`: restore, unwind, drop the record and GC for one PURL/UUID (a hosted patch is restored to upstream) |
477477
| [`vendor --revert`](#vendor) | **Un-vendors wholesale**: restores the recorded original lockfile fragments byte-for-byte and removes the `.socket/vendor/` artifacts (a package vendored over a hosted pin returns to upstream, not to hosted) |
478478
| [`scan --prune`](#scan) | Agent mode: **reconciles, doesn't reverse** — drops manifest entries for packages that have left the project and garbage-collects orphan blob/diff/archive files |
479-
| [`repair`](#repair) (alias `gc`) | **Restores health, not originals**: re-downloads missing blobs, rebuilds missing/corrupt vendored artifacts, and cleans up unused ones |
479+
| [`repair`](#repair) (alias `gc`) | **Restores health, not originals**: re-downloads missing blobs, re-vendors missing/corrupt vendored artifacts, and cleans up unused ones |
480480
481481
> Reverting a hosted edit by hand (e.g. `git checkout -- <lockfile>`) is always safe:
482482
> hosted mode keeps no other state, so there is nothing else to clean up.
@@ -494,7 +494,7 @@ need the network and refuse to run with `--offline`.
494494
| [`rollback`](#rollback) | Unwind every patch, in any mode: restore original files and hosted or vendored lockfile wiring |
495495
| **[Agent mode](#agent-mode)** | |
496496
| [`apply`](#apply) | Apply the patches in `.socket/manifest.json` in place (run it after every install) |
497-
| [`repair`](#repair) | Download missing patch artifacts, rebuild vendored artifacts, clean up unused ones (alias: `gc`) |
497+
| [`repair`](#repair) | Download missing patch artifacts, re-vendor broken vendored artifacts, clean up unused ones (alias: `gc`) |
498498
499499
`socket-patch --update` updates the CLI itself (see [Updating](#updating)).
500500
@@ -1160,14 +1160,18 @@ project that ran `setup`:
11601160
11611161
### `repair`
11621162
1163-
Download missing blobs, rebuild missing or corrupt vendored artifacts, and clean up unused
1163+
Download missing blobs, re-vendor missing or corrupt vendored artifacts, and clean up unused
11641164
blobs.
11651165
11661166
Alias: `gc`
11671167
11681168
`repair` cleans up the `.socket/` directory without running a scan — useful when you've
11691169
manually adjusted the manifest, recovered from a partial-failure state, or just want to
1170-
free space. It also rebuilds missing or corrupt vendored artifacts. For the combined
1170+
free space. It also re-vendors missing or corrupt vendored artifacts the same way `vendor`
1171+
does (the patch service's prebuilt artifact first, a local build as the fallback), checked
1172+
against `.socket/vendor/state.json`. `repair` does not recreate a lost `state.json`: if a
1173+
lockfile points into `.socket/vendor/` and the ledger has no entry for it, `repair` fails with
1174+
`vendor_ledger_missing` — restore `state.json` from version control. For the combined
11711175
agent-mode workflow (discover + apply + GC in one pass), use `scan --sync` instead.
11721176
11731177
Like every other mutating command, `repair` takes the `.socket/apply.lock` advisory lock

0 commit comments

Comments
 (0)