Repository navigation
Fix repair leaving npm vendor dirs uncommittable (#1581) - #1656
Conversation
Assisted-by: Claude Code:claude-opus-5-5
`socket-patch repair` redownloaded a broken npm, pnpm, yarn or bun vendored tarball but never rewrote the `<uuid>/.gitignore` and `.gitattributes` beside it; only vlt and JVM entries got them back. A project vendored before #1541 kept the old `* -text` attributes, so a repository `*.tgz filter=lfs` rule put the repaired tarball back into Git LFS, and a lost uuid dir came back without its `!*` .gitignore, so a stock `*.tgz` ignore rule left the tarball out of the commit. Both reported a successful repair while fresh clones kept failing. Repair now rewrites both files for every npm-family entry, on the healthy path and after a redownload, then asks git whether it would commit the artifact. A rule the uuid .gitignore cannot override (such as `.socket/`) fails with `vendor_artifact_gitignored`, the same refusal `vendor` gives. Fixes #1581 Assisted-by: Claude Code:claude-opus-5-5
A rewritten npm uuid .gitignore or .gitattributes is not an artifact rebuild, as the vlt repair contract already says, so repair reports no rebuilt event for it. Assisted-by: Claude Code:claude-opus-5-5
Repair now asks git whether it would commit a healthy npm-family artifact on every run, not only when it rewrote the uuid metadata, so a .socket/ ignore rule keeps failing until it is fixed. It also restores the metadata before repairing bun workspace mirrors, skips a vendor dir reached through a symlink, and probes a vlt package dir as a directory. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
|
Ready for review at
Slack announcement not sent: no Slack send tool in this burn-down run. Generated by Claude Code |
|
Final review brief for What it does. Risk: low. The change is confined to the repair path and the shared redownload Look here
Verified
Changes I made: none. Open questions (non-blocking)
Auto-merge is armed: approving sends it straight to the merge queue. Refreshed 2026-10-21 for head Generated by Claude Code |
…uuid-metadata # Conflicts: # crates/socket-patch-core/src/vendor/npm_dir.rs # crates/socket-patch-core/src/vendor/redownload.rs
|
BugBot review Generated by Claude Code |
git check-ignore cannot answer past a symlinked .socket/vendor/npm, so every repair run on that layout warned vendor_artifact_gitignore_unchecked. vendor already refuses the layout, and repair already skips its metadata rewrite there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WMCn4ztc3DCiDDSBZDtjHd
|
Generated by Claude Code |
|
Final reviewer: disarmed auto-merge. The head moved from Generated by Claude Code |
|
bugbot run Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4de77a3. Configure here.
|
Ready for review again (burn-down agent), re-confirmed on the new head.
Generated by Claude Code |
|
Final review brief for What it does. Risk: low. The change stays inside the repair path and the shared redownload Look here
Verified
Changes I made: none. Open questions: none. Auto-merge is armed, so approving sends this PR straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1581
Summary
socket-patch repairnow restores the.socket/vendor/npm/<uuid>/.gitignoreand
.gitattributesfor every npm-family vendored entry (npm, pnpm, yarn,bun text, bun.lockb, vlt), both when the artifact is healthy and after a
redownload. It then checks that git would actually commit the artifact. A
rule that the uuid
.gitignorecan't override (such as.socket/) nowfails with
vendor_artifact_gitignored, the same refusalvendorgives,on every run until the rule is fixed.
Root cause
repaironly rewrote the uuid-dir metadata for vlt and JVM entries(
commands/vendored_backend/repair.rs). The npm tarball flavors only gotit from a vendored scan (
npm_common.rskeep_pack_committable). So:* -text.gitattributes. A repository*.tgz filter=lfsrule still applied,and the repaired tarball went back into LFS on the next commit.
<uuid>/dir was lost, repair restored only the.tgz.With a stock
*.tgzignore rule, git ignored the redownloaded tarball,so "commit it" committed nothing (the second symptom reported on repair leaves a pre-#1541 root
<uuid>/.gitattributesas* -text, so the repaired Bun tarball goes back into Git LFS on the next commit #1581).Changes
vendor::redownload::restore_npm_uuid_metadatareplaces thevlt-only
vlt_lock::restore_vlt_uuid_metadataand covers every npmentry. It skips a vendor dir reached through a symlink (Vendored yarn classic writes and deletes through a symlinked .socket/vendor/npm dir, so rollback in one project deletes another project's vendored tarballs and breaks its frozen install #664).
redownload::restorecalls it after every npm redownload. This alsocovers
vendor's own redownload path.vendor::redownload::npm_artifact_commit_checkruns the gitignore probe over the artifact (a vlt dir is probed as a directory) and
both metadata files.
repairruns both on healthy and workspace-mirror entries before thebun mirror repair, and runs the check after a redownload.
npm_dir::restore_uuid_metadatanow reports whether it rewroteanything.
repairalsorewrites a pre-Vendored Bun tarballs go into Git LFS when .gitattributes tracks *.tgz with LFS, so a checkout without LFS fails bun install --frozen-lockfile #1541
.gitattributes.Test evidence
Red → green. The new CLI tests were run against
origin/mainwith onlythe test file changed, in a separate worktree:
Per-issue checklist for #1581:
* -textsurvives repair (healthy artifact, and an LFSpointer redownload) →
repair_upgrades_a_legacy_uuid_gitattributes(also asserts
git check-attr filter= unset under a repo*.tgz filter=lfsrule)..gitignore/.gitattributes, sothe tarball is ignored by
*.tgz→repair_of_a_lost_uuid_dir_restores_its_gitignore_and_gitattributes(asserts
git check-ignoreis empty)..socket/rule reports success →repair_of_a_lost_uuid_dir_under_an_ignored_socket_dir_fails, whichfails with
vendor_artifact_gitignoredon both the first and thesecond run.
redownload.rs:npm_redownload_restores_the_uuid_metadata,npm_uuid_metadata_upgrades_a_legacy_gitattributes,npm_commit_check_refuses_only_an_unoverridable_rule.Local runs:
cargo fmt --all -- --checkandcargo clippy --workspace --all-features -- -D warnings: clean.cargo test --workspace --all-features --no-fail-fast: everythingpasses except tests that can't pass in this sandbox. Those fail the same
way independent of this diff:
(
repair_invariants::repair_cleanup_failure_is_reported_in_json_and_silent_modes,repair_render::repair_exits_zero_and_stays_quiet_when_lock_file_unremovable,in_process_redirectwrite-failure tests, corecopy_tree/vlt_heal/pypi_*write-failure tests).e2e_bun_lockb::binary_shared_bundled_record_hosted_pin_is_managed,which reaches the real patches-api.socket.dev through a blocked proxy.
npm/,pypi/andgem/onlydispatch to the binary.
/code-review high
The review found 8 candidates. Fixed here:
continueskipping the metadata stepNot fixed:
rebuiltevent for a metadata-only rewrite: the existing vltcontract test (
vlt_repair_restores_the_uuid_gitignore) says it isnot a rebuild.
--dry-runpreview of the metadata rewrite: the existing vltbehavior, out of scope.
refactor, left for Tracking: revert every vendored backend through one record-revert engine instead of nine hand-written mechanisms #989/Tracking: drive the seven npm-family vendor backends through one generic driver #920.
Follow-ups
socket-patch.vendor.json(the informational marker) isn't restoredwhen the uuid dir is lost. It is never a trust input.
https://claude.ai/code/session_01WMCn4ztc3DCiDDSBZDtjHd
Note
Medium Risk
Changes repair/redownload behavior for all npm vendored artifacts and git-ignore probing; mistakes could block legitimate repairs or miss uncommittable artifacts, but scope is localized to vendor repair paths with extensive tests.
Overview
socket-patch repairnow restores.socket/vendor/npm/<uuid>/.gitignoreand.gitattributesfor all npm-family vendored entries (not only vlt), including when the tarball is healthy and after a redownload. Legacy pre-#1541* -text.gitattributesis upgraded to the full* -text -filter -ident -working-tree-encodingform so repo rules like*.tgz filter=lfsor*.tgzin.gitignoredo not leave repaired artifacts uncommittable.After rewriting metadata (or redownloading), repair runs a git commitability check via new
npm_artifact_commit_check, surfacingvendor_artifact_gitignoredwhen a rule such as.socket/cannot be overridden—matchingvendorbehavior instead of reporting success while the next commit drops the artifact. Core adds sharedrestore_npm_uuid_metadata(used by redownload and repair, skips symlinked vendor dirs); the vlt-only helper is removed.Docs in CLI_CONTRACT.md and ecosystems.md note that
repaircan fix uuid-dir git metadata. New CLI and unit tests cover legacy attributes upgrade, lost uuid-dir recovery, and unoverridable ignore failures.Reviewed by Cursor Bugbot for commit 4de77a3. Configure here.
Generated by Claude Code