Repository navigation
Fix vendored re-scan failing over a gem patched in hosted mode (#2395) - #2397
Mikola Lysenko (mikolalysenko) wants to merge 6 commits into
Conversation
Refs #2395 Assisted-by: Claude Code:claude-fable-5-2
A gem declared in a group block and patched in hosted mode, as the vendored refusal advises, must be a skip of the next vendored scan. The two skip tests fail on main with failed/gemfile_declaration_not_editable; the guard test passes. Refs #2395 Assisted-by: Claude Code:claude-fable-5-2
A vendored scan refuses a gem whose gem line sits inside a block and names hosted mode. Once the gem held the selected patch there, every later vendored scan raised the refusal again and exited 1: the skip vendor_gem_patched_in_other_mode covered only the native-extension refusal, and the declaration refusal of a hosted gem was raised before the patch view was fetched, so nothing could check the installed copies. The declaration refusal now reaches the same settlement. When the lock pins the selected patch, the download phase leaves the gem to the vendor loop, which has the record: every installed copy holding the patch makes it the skip, anything else the refusal as before. Nothing is written either way. Fixes #2395 Assisted-by: Claude Code:claude-fable-5-2
The vendored download phase left every hosted gem refused for its declaration, and pinned at the selected patch, to the vendor loop, which fetched its patch view. A checkout with no copy of the gem installed has nothing the view could judge: refuse it before any fetch, as before. Refs #2395 Assisted-by: Claude Code:claude-fable-5-2
get <uuid> --mode vendored raises a vendored refusal before its engine, in the pre-record error shape. The gem left to the patch view skipped that step and reached the vendor loop, so the same refusal had two shapes depending on whether the gem was installed. The uuid path holds the view already: it now settles the gem there, as the skip or as the refusal in its one shape. Also scope the dry-run and takeover sentences of the contract and the guide to what the preview does. Refs #2395 Assisted-by: Claude Code:claude-fable-5-2
|
bugbot run Generated by Claude Code |
PR SummaryLow Risk Overview The download phase defers declaration (and other “use another mode”) refusals when the hosted pin matches the selection and an installed copy exists, so the vendor loop can verify bytes before deciding skip vs failure. Reviewed by Cursor Bugbot for commit 1459168. 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 1459168. Configure here.
get imported vendor's settlement directly, an edge between two command modules that the layering test refuses. The download helper owns these refusals and already imports vendor: it settles the one left to the patch view, and get calls the helper. Refs #2395 Assisted-by: Claude Code:claude-fable-5-2
|
[agent] PR shepherd: review brief for the approver What it does Risk Look here
Verified
Changes I made Open questions Generated by Claude Code |
LLM Description written by Claude Code:claude-fable-5-2
Fixes #2395
Summary
scan --mode vendoredrefuses a gem whosegemline sits inside a block(
group :development do), and the refusal says to leave the gem to hostedmode. After the user did that, every later
scan --mode vendoredraised thesame refusal, counted the gem as left to patch and exited 1.
Such a gem is now the benign skip
vendor_gem_patched_in_other_mode, as anative gem already was (#2269): exit 0, counted as patched, nothing written.
The conditions are those of the native skip:
Gemfile.lockpins theselected patch hosted (or the manifest records it for agent mode), and
every installed copy the crawl finds holds it. Anything else is refused
as before.
Root cause
Two things kept the declaration refusal away from the existing skip:
settle_gem_refusalreturned early for every code butnative_extensions_unsupported.takeover preflight, in the download phase, before the patch view is
fetched. Without the view nothing can check the installed copies.
The change
refusal_names_another_modecovers both codes, and the skip'sdetail says which reason applies.
settlement as the backend's.
scan,get <purl>): a gem refused for its declarationis left to the vendor loop only when its pin is the selected patch and
a copy of it is installed. Every other gem is refused before any fetch, as
before.
get <uuid>holds the view already, so it settles the gem before itsengine and keeps its one shape for a refusal (
status: "error").CLI_CONTRACT.md(the skip's row, the takeover preflight paragraph) anddocs/ecosystems.md.The
npm/,pypi/andgem/wrappers call the binary and need no change.What stays refused (each a case of the guard test)
refused without fetching the view, which an existing real-Bundler test
pins (
gem_hosted_group_block_pin_survives_a_refused_vendored_takeover).Evidence
The issue's script (real Bundler 4.0.18, Ruby 3.3.6,
rake 13.4.2ingroup :development), step 3,scan --mode vendoredafter the hostedget:main1b3f422[error] … (gemfile_declaration_not_editable),1 vulnerability left to patchSkipping …; it stays patched in hosted mode,Nothing left to patch.The Gemfile and the lock are unchanged by the scan, and
vexstill writesits statement.
Tests, in
crates/socket-patch-cli/tests/e2e_redirect_gem_stale_install.rs(real binary, mock patch service). The first commit adds them against
main, where the two skip tests fail withfailed/gemfile_declaration_not_editableand the guard passes:groupblock is patched in hosted mode as the refusal advises: the #2269 skip covers native gems only #2395:vendored_scan_skips_a_grouped_gem_that_holds_the_patch_in_hosted_mode(
scantwice, a human run,get <uuid>),vendored_scan_skips_a_grouped_gem_that_holds_the_patch_in_agent_mode.vendored_scan_still_refuses_a_grouped_gem_that_is_not_patched(the five cases above, with
get <uuid>held to its error shape).a_gem_patched_in_another_mode_is_a_skip_and_its_refusal_is_not.Local runs:
cargo clippy --all-targetsreports 78 errors in test code thatmainhastoo (CI's clippy job does not pass
--all-targets); none is in a line thisPR touches.
Review findings not fixed
of the gem installed (a CI job that scans before
bundle install), thescan still exits 1. The native skip has the same limit, and the existing
test named above expects the refusal there. Whether a lock pin alone
should count as "patched in hosted mode" is a behavior question for a
maintainer; the guide now states the limit.
it still lists a hosted gem in a block as
would-refuse(exit 0 eitherway). The contract and the guide say so.
https://claude.ai/code/session_011f9aeNrnmLGQjptH8jHcD9
Generated by Claude Code