Repository navigation
Fix repair leaving npm vendor dirs uncommittable (#1581) - #1656
Open
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Open
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
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
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 21, 2026 09:19
Collaborator
Author
|
BugBot review 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 1d7c6ad. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Generated by Claude Code