vendor --revert with a lost vendor ledger tells you to "run socket-patch repair to re-adopt them into the ledger", but repair refuses because it never rebuilds the ledger, so the advice loops and the vendored npm packages can't be reverted
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
Hướng nghiên cứu
Đọc crates/socket-patch-cli/src/commands/vendor.rs quanh dòng 4071 và crates/socket-patch-cli/src/commands/vendored_backend/repair.rs quanh dòng 184 để so sánh cảnh báo với việc repair từ chối. Chạy các bài kiểm thử hiện có liên quan đến cảnh báo hoàn nguyên vendor. Công việc hoàn tất khi cảnh báo không còn đề xuất một hành động không thể khắc phục việc thiếu ledger và hành vi này được một bài kiểm thử bao phủ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[agent] Found by the scheduled npm bug-hunt routine (ledger #302).
Summary
When .socket/vendor/state.json is lost (deleted, or dropped by a bad merge) while package-lock.json still wires the vendored tarballs, socket-patch vendor --revert keeps the artifacts, which is the correct fail-safe. It then warns vendor_orphan_still_wired with this remedy:
a project lockfile still points at .socket/vendor/npm/, which no ledger entry owns; the artifacts were kept (run
socket-patch repairto re-adopt them into the ledger, then revert again)
repair can't do that. It exits 1 with:
Cannot repair vendored artifact … the vendor ledger (.socket/vendor/state.json) has no entry for it, and repair does not rebuild the ledger from lockfiles; restore state.json from version control …
After repair, vendor --revert prints the same warning again ("Reverted 0 vendored packages.", exit 0). Following the advice goes round in a loop, and the project stays vendored.
Impact
Low severity, but it's a dead end for a user who doesn't have state.json in version control. The fail-safe parts all hold: in every step below, a cold-cache npm ci still installs patched bytes, and no artifact is deleted. Only the remedy is wrong. It contradicts CLI_CONTRACT.md (repair: "redownload missing/corrupt vendored artifacts (never re-synthesizing a lost ledger)"). It's in the same family as #900 and #977 (a suggested remedy that is a no-op).
Repro (Linux, npm 10.9.4, local mock of the patch API serving free patches for [email protected] and [email protected])
mkdir p && cd p
echo '{"name":"p","version":"1.0.0","dependencies":{"left-pad":"1.3.0","ms":"2.1.3"}}' > package.json
npm install
socket-patch scan --mode vendored --yes $API # exit 0, both vendored
rm .socket/vendor/state.json # ledger lost
socket-patch vendor --revert --yes $API
# Warning: … which no ledger entry owns; the artifacts were kept (run `socket-patch repair` to re-adopt them into the ledger, then revert again)
# Reverted 0 vendored packages. exit 0
socket-patch repair --yes $API
# Error: Cannot repair vendored artifact … repair does not rebuild the ledger from lockfiles … exit 1
socket-patch vendor --revert --yes $API # same warning again, exit 0
Expected vs actual
- Expected: a remedy that works here. Either the one
repair,rollbackandscan --prunealready give ("restore .socket/vendor/state.json from version control, or restore the lockfile withgit checkout -- <lockfile>"), or arepairthat actually re-adopts the entry, as the warning promises. - Actual: the warning points at
repair, which by contract and by its own message refuses this exact state.
Every other command reports this state consistently (main 05ecc6e, run twice):
| command | exit | message |
|---|---|---|
vendor --revert |
0 | vendor_orphan_still_wired → "run socket-patch repair to re-adopt" (wrong) |
repair |
1 | "repair does not rebuild the ledger … restore state.json" |
rollback |
1 | "restore .socket/vendor/state.json from version control …" |
scan --mode vendored --prune |
1 | "restore .socket/vendor/state.json from version control" |
vendor --check |
1 | vendor_ledger_missing … "restore state.json" |
OS × version
| OS | npm | result |
|---|---|---|
| Linux | 10.9.4 (Node 22.22) | fail (x2) |
macOS and Windows weren't probed. The message is built in shared CLI code, so it isn't OS-dependent, and probably not npm-specific either (sweep_orphan_vendor_dirs is ecosystem-generic). Not bisected.
Suspect code
crates/socket-patch-cli/src/commands/vendor.rs:4071(thevendor_orphan_still_wiredtext) vscrates/socket-patch-cli/src/commands/vendored_backend/repair.rs:184(repair's refusal).
Backlog review — 2026-10-08
Priority: P1 → P3. Missing-ledger recovery advice loops, but artifacts are retained and fresh installs remain patched. The report explicitly says only the remedy is wrong.
- Ngôn ngữ chính
- Rust
- Star
- 8
- Fork
- 0
- Merge trung bình
- 19 giờ 44 phút
- Pull request đã merge (30 ngày)
- 450
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SocketDev/socket-patch
-
agent:triaged bug bughunt pm:bundler priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
SocketDev/socket-patch#896 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
SocketDev/socket-patch#783 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:cargo priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
SocketDev/socket-patch#651 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CI perf: e2e-build-windows — full Windows test build is the merge-queue critical path in 27/30 runs (~2.5 min off every merge)Có thể đã có người làm @mikolalysenko đã nhận hôm nay. Đang mởagent:claimed agent:triaged ci-perf priority:p3
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
SocketDev/socket-patch#1385 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Swarm health manager logĐang mởswarm-health
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 15/100
SocketDev/socket-patch#1382 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SocketDev/socket-patch
Issue tương tự
-
llm translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
CybercentreCanada/sawp#13 ·
-
area: backend type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
armadavalor/WinKnife#6 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
5omeOtherGuy/phaseone#870 ·
Maintainer thường phản hồi trong vòng 1 ngày