Repository navigation
Report an unchecked vlt copy after rollback or a takeover as that run, not as a hosted pin - #2265
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Conversation
The vlt heal runs after a hosted rewrite, after rollback or remove restore the registry pins, and after a hosted to vendored takeover. A copy it could not check (node_modules is a link, or vlt's hidden lock is missing or unreadable) was reported with one text for all three: "vlt-lock.json pins Socket-patched packages ... run vlt ci to be sure the patched packages are installed". After a rollback that is false twice over: the run has just taken the pin out, and the copy that may still be installed is the patched one. The rollback now says the registry pins were restored and that vlt ci makes sure the registry packages are installed. The takeover says the packages were vendored. The hosted rewrite's text is unchanged, as are the warning code, the command to run and the exit codes. Fixes #2254. Assisted-by: Claude Code
From review. docs/testing/vlt-coverage.json names the tests behind each variant of the reinstall advisory. Its "copies could not be checked" entry listed only hosted scans, so the two tests of that arm after a rollback and after a takeover could be deleted without the map's checker noticing. Refs #2254. Assisted-by: Claude Code
|
bugbot run Generated by Claude Code |
PR SummaryLow Risk Overview The shared helper is now Tests lock in per-direction wording (unit + CLI rollback/takeover cases with missing Reviewed by Cursor Bugbot for commit 4a03aa8. Configure here. |
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 4a03aa8. Configure here.
|
[agent] What fails. Nine tests of The job ran the suite three times (01:27Z, 01:29Z and 01:31Z), each ending Why it is not this PR's. The diff changes two advisory strings in I have not re-run the job yet: it already tried three times against the same answers. I will re-run it once later in this session; if that fails too, it needs a re-run by a person once the patch service answers again. Generated by Claude Code |
|
[agent] PR shepherd: review brief What it does Risk Look here
Verified Changes I made Open questions Generated by Claude Code |
LLM Description written by Claude Code
Fixes #2254.
Problem
The vlt heal runs after a hosted rewrite (
scan/get --mode hosted), afterrollback/removerestore the registry pins, and after a hosted → vendored takeover. It keeps an installed copy it cannot check (node_modulesis a link, ornode_modules/.vlt-lock.jsonis missing or unreadable) and says so inredirect_vlt_reinstall_required. All three directions printed the hosted rewrite's sentence for that case.After
rollbackorremovethat sentence is wrong twice. Someone who has just removed a patch reads:The lock no longer pins the patch, and the copy that may still be installed is the patched one.
vlt ciis the right command, but the sentence offers it as the way to get the patched packages, which this user is trying to remove. Every other arm of the advisory is already worded per direction ("restored registry pins for N packages, …"), and the contract'sredirect_vlt_reinstall_requiredrow says the lock "pins (or, after rollback/remove, no longer pins)" and that the detail "says what happened and what to run".A project gets here with a linked
node_modules. By readingvlt_heal::invalidate, the heal also leads here itself: a hosted scan that removes one package's stale copy removes vlt's hidden lock too and keeps the copies it judged healthy, so a rollback before the nextvlt installcannot check those.Evidence on
main(cfc870f)Through the built binary. A hosted vlt project with the patched copy installed and no hidden lock, then
rollback --yes(cargo test -p socket-patch-cli --test rollback -- vlt_hosted_rollback, with this PR's test onmain's production code):With real vlt 1.2.0. A throwaway copy of the real-vlt leg
rollback_byte_exact(e2e_redirect_vlt_build), withnode_modules/.vlt-lock.jsondeleted before the rollback. It printed the installed state after each step and is not part of this PR:So the lock is back on the registry, the patched copy is still installed, a plain
vlt installkeeps it, and the advisory says the lock pins the patch.The other two tests fail on
mainthe same way: the unit testan_unchecked_copy_is_reported_in_the_direction_of_the_run(leftis the hosted sentence,rightthe rollback one) andvlt_hosted_then_vendored_takeover_reports_an_unchecked_copy_as_a_takeover.Fix
undeterminable_detail(n)held one sentence. It is nowunchecked_detail(did, n, installs): each caller passes what its run did to the lock and what kind of package the lock now installs, as the other arms ofreinstall_detail,rollback_detailandtakeover_detailalready do inline.After the fix:
and after a takeover (
scan --mode vendoredorvendorover a hosted pin):Deleted
undeterminable_detail, the helper whose one sentence fit only the hosted rewrite. No copy of the old sentence is left for the other two directions.Behavior change
Only the
detailtext of one arm ofredirect_vlt_reinstall_required, in two of its three directions:rollback,remove, the restore of a withdrawn pin inscan --mode hosted, and a takeover whose vendoring failed): the text above. This is the defect.vlt-lock.jsonthat the takeover has just removed. It now starts like the takeover's other arms. The command staysvlt ci: with real vlt 1.2.0 a plainvlt installrelinks the importer to the vendored directory and leaves the hosted store entry in place, andvlt ciremoves it.Unchanged: the hosted rewrite's sentence (byte for byte), the warning code, the command it names, which copies are kept, the exit codes and the JSON shape.
CLI_CONTRACT.mdalready describes the corrected behavior, so it is not edited.Risk
Low: two strings. No copy is removed or kept differently, and nothing in this repository reads the detail text besides the tests.
No
cfg(unix)orcfg(windows)code changed.Review
/code-review highfound nothing in the changed logic, and three things around it:docs/testing/vlt-coverage.jsondid not list the two new tests under the "copies could not be checked" variant, so its checker would not notice them being deleted.node_modules/.vltitself is a link. vlt never makes that layout, and naming it would change the hosted sentence, which this PR keeps byte for byte.warnings[]now holds the rollback sentence followed by the hosted one, where it held the hosted sentence twice. The contract says the restore's advisories joinwarnings[], every other arm of the restore's advisory already speaks of the restore there, and both namevlt ci. When no replacement is pinned the old sentence was false there too.Verification
4a03aa89: 81 of 83 checks pass, and Bugbot found no issues.hosted-e2eand its aggregateci-okfailed because the production patch service answered HTTP 500 to hosted downloads, as on Report an unreadable vendor ledger and a still-wired orphan in scan --prune #2261; the first comment below has the evidence. The job has been re-run since, and its gem leg is the failure tracked in CI: hosted-e2e gem leg fails on every PR: production published activestorage 6.0.3 patch 146ef6aa, not in GEM_UUIDS #2270, which is not in this PR's code. Once CI: hosted-e2e gem leg fails on every PR: production published activestorage 6.0.3 patch 146ef6aa, not in GEM_UUIDS #2270 is fixed onmain, this branch needsmainmerged and one more run.cargo clippy --locked -p socket-patch-cli --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --lib: 1077 passed.rollback(140),in_process_vendor_bun_takeover(49),in_process_rollback_hosted(41),cli(125, the test-tree ratchets),cli_remove_silent(10),remove(90): all passed.in_process_redirect: 135 passed. Three fail in this sandbox because it runs as root and they inject a failure with chmod:partial_lockfile_write_failure_exits_1_and_writes_no_ledger,redirect_json_mode_write_failures_emit_error_envelopeandvlt::scan_redirect_vlt_heal_invalidation_failure_warns. None reads the changed arm.python3 -B -m unittest scripts/tests/test_vlt_coverage.py: passed.Patched,Patchedaftervlt install,Pristineaftervlt ci).Diff
4 files, +180 −13: production +25 −11 (
src/commands/vlt_heal.rs), tests +152 −1 (unit +63 −1, CLI suites +89), coverage map +3 −1. No file here is changed by another openarch-refactor/oragent/PR.Generated by Claude Code