Repository navigation
Fix vex remedy for an unpatched hosted gem (#2219) - #2221
Conversation
Empty commit to open the draft pull request that claims the issue. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeQ4rKnRJHYWRr5aMyn
When nothing can be attested because the installed copies still hold their original files, vex ends with one remedy for every ecosystem: "Reinstall from the lockfile (hosted or vendored patches)". For a hosted gem that cannot work. Bundler keeps a gem it has already installed whatever source the lock names, so bundle install changes nothing, and bundle pristine on Bundler 2.6+ removes the gems and then fails on the lock's checksum. This is what a second machine sees after it pulls the hosted Gemfile.lock onto an existing install (#2219). The hint now learns which omitted packages a hosted pin wires. A gem among them is told to run socket-patch scan, which replaces the installed copy, and names the two options for a shared gem home. Every other package keeps the reinstall wording. The end-to-end test runs the flow: pull the hosted pair onto an upstream install, vex names the scan, a scan with no --mode replaces the copy and leaves the pair alone, and vex then attests the gem. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeQ4rKnRJHYWRr5aMyn
Review of the previous commit found three gaps in the new hint. A scan with no --mode is a hosted one only in a project with no other patch state. With agent-mode patches in the manifest it stays in agent mode and replaces no gem, and beside a vendor ledger it stops with mode_ambiguous. The hint now asks the project's own mode resolution, and there it names the files to remove before bundle install, the remedy the stale-install warning already gives. A gem the manifest records as well as the lock keeps the general remedy: apply patches it in place. The hint said to run the scan "here", which is wrong for a vex run with --cwd. The word is gone. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeQ4rKnRJHYWRr5aMyn
|
bugbot run Generated by Claude Code |
PR SummaryLow Risk Overview
Docs ( Reviewed by Cursor Bugbot for commit 3b0fe94. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3b0fe94. Configure here.
The command_module_layering test failed in CI: vex named scan::ScanMode to ask whether a scan with no --mode is a hosted one, which adds a vex -> scan edge and closes a cycle through apply and agent_download. The question moves to commands::bare_scan_is_hosted, beside bare_scan_looks_below, so vex imports no command module for it. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeQ4rKnRJHYWRr5aMyn
Bugbot review: where a scan with no --mode is not a hosted one, the hint names the files to remove before bundle install, but it did not say what that does in a gem home outside the project. Bundler then installs the patched gem there, where other projects may load it. The sentence now names the project-local install for that case, as the scan branch of the same hint does. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeQ4rKnRJHYWRr5aMyn
|
[agent] PR shepherd: review brief for the approver What it does. When Risk: low. The change is in human-readable stderr text on an error path. The one new I/O is a manifest/vendor-state read, done only when a hosted gem is among the omitted purls, and any read error falls back to the conservative "remove these files" wording. Look here
Verified
Changes I made: none. Open questions: none. The description notes a separate follow-up: a run that attests something prints no remedy for its omitted packages. That is unchanged behavior and out of scope here. Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Approving; one inline note on a missed path.
Review note: a gem the manifest records was always left to the general remedy, which names socket-patch apply. That is right only when the record is the patch the hosted pin delivers. Where the pin superseded an agent-mode record of another patch, apply installs the old patch's files and vex still cannot attest the pin's. The hint now carries each hosted pin's patch uuid and exempts a gem only when the manifest record has the same one. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeQ4rKnRJHYWRr5aMyn

LLM Description written by Claude Code:claude-fable-5-2
Fixes #2219
Summary
When
socket-patch vexcan attest nothing because the installed copies arestill the upstream ones, it ends with one remedy for every ecosystem:
"Reinstall from the lockfile (hosted or vendored patches) or run
socket-patch apply". For a hosted gem neither works. Bundler keeps a gemit has already installed whatever source the lock names, so
bundle installchanges nothing, and
bundle pristineon Bundler 2.6+ removes the gems andthen fails on the lock's checksum, which leaves the project unable to
install. Every machine other than the one that ran the scan gets this
message after it pulls the hosted
Gemfile.lockonto an existing install.For a hosted gem
vexnow says:Only the human hint under the error changes. Exit codes,
--jsonoutput andwhat is attested are the same.
Root cause
nothing_attested_hintincrates/socket-patch-cli/src/commands/vex.rssawonly the omission tags, so it could not tell a hosted gem from any other
package that is
not_applied.The change
VexGenErrorcarries the omitted purls that a hosted pin wires.StaleHostedGems::amongpicks the gems among them and decides the remedy:socket-patch scan(a scan with no--modeis a hosted one there, and it replaces the installed copies);--modekeeps that mode or stops withmode_ambiguous, and--mode hostedwould move the other patches, so the hint names the filesto remove before
bundle install. This is the remedy theredirect_gem_stale_installwarning already gives;general remedy, since
applypatches it in place. A record of anotherpatch, which the pin superseded, does not (review note, fifth commit).
both sentences, each with its own count.
CLI_CONTRACT.mdanddocs/usage.mddescribe the new line.Evidence
e2e_redirect_gem_stale_install:standalone_vex_sends_a_stale_hosted_gem_to_the_scan_that_replaces_itGemfileandGemfile.lockover an upstream install,vexexits 1 and names the scan, the scan with no--modereplaces the copy and its archive and leaves the pair alone,vexthen attests the gem. Also the mixed-mode project, which is told which files to removevex::tests::nothing_attested_sends_a_hosted_gem_to_the_scan_not_to_a_reinstallvex::tests::stale_hosted_gems_are_the_unrecorded_gems_on_a_hosted_pin--modeis a hosted oneBefore the fix the end-to-end test failed on the old line ("Reinstall from
the lockfile (hosted or vendored patches) or run
socket-patch apply").Run locally:
cargo test -p socket-patch-cli --lib: 1053 passedcargo test -p socket-patch-cli --test e2e_redirect_gem_stale_install: 63 passedcargo test -p socket-patch-cli --test e2e_vex --test e2e_vex_redirect --test e2e_embedded_vex: 15, 28 and 35 passedcargo clippy --locked --workspace --all-features -- -D warnings: cleancargo fmt -p socket-patch-cli -- --check: cleancargo test -p socket-patch-cli --test command_module_layering: 4 passed (it failed in CI on the second commit, wherevexnamed ascantype; the third commit asks through a helper incommands/mod.rs)The tests lay the gems down by hand, as the rest of this suite does, so no
real Bundler ran here. The Bundler behavior the hint describes comes from the
issue's own runs on Bundler 4.0.18 and 2.5.22 and from
docs/ecosystems.md.Review
/code-review highreported four findings. Three are fixed in the secondcommit (the scan named in a project where it is not a hosted one, a gem the
manifest also records, and the word "here" for a run with
--cwd).Cursor Bugbot reported one finding: the manual remedy did not say what it
does in a gem home outside the project. Fixed in the fourth commit, which
names the project-local install for that case.
Not fixed here: when at least one other patch attests,
vexexits 0 andprints only the
Warning: omitting ... (not_applied)line, with no remedyfor any ecosystem. That is how the hint has always worked (it is printed only
under "nothing to attest"), and adding a remedy to a successful run changes
more output than this issue asks for. It is worth its own issue.
https://claude.ai/code/session_011f9aeQ4rKnRJHYWRr5aMyn
Generated by Claude Code