Repository navigation
Fix gem lock refusal repeated per platform patch (#2436) - #2482
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Conversation
Refs #2436. Assisted-by: Claude Code:claude-fable-5-2
A gem that Gemfile.lock locks for the ruby platform beside platform gems, with a patch for each build, must be refused once: one failed event, one [error] line, one would-refuse row and a count of one. Fails on main, which reports the refusal for every patch (#2436). Assisted-by: Claude Code:claude-fable-5-2
A vendored scan selects a patch for each build of a gem the lock names, and a refusal read from Gemfile.lock is the same for all of them. The download phase and the dry-run preview reported it for every patch and counted each as a failure: nine identical lines for nokogiri on a default Bundler 4 lock. The refusal is now reported under one patch of the gem, the ruby gem's where it is refused, else the first. The other patches stay refused (not downloaded, no rollout slot) with no line, event or count of their own. Refs #2436. Assisted-by: Claude Code:claude-fable-5-2
Review follow-ups to the once-per-gem refusal: an expected skip (a gem version the lock does not resolve) keeps its line and event for each patch, a purl listed twice is not dropped with its own repeat, and the contract states the rule for every failing gem refusal, not for one code. Refs #2436. Assisted-by: Claude Code:claude-fable-5-2
|
bugbot run Generated by Claude Code |
PR SummaryLow Risk Overview
The vendored download phase drops repeat patches from selection so they are not fetched or counted again. The vendor dry-run preview mirrors that (one row / one Reviewed by Cursor Bugbot for commit 086034e. Configure here. |
|
[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:claude-fable-5-2
Refs #2436
Summary
On a default Bundler 4 lock, a vendored
scanof a project with nokogiriprinted the same
platform_gem_unsupportedrefusal nine times (once forthe patch of the ruby gem and once for each platform gem's patch) and
closed with "9 patches failed" for one gem. It now prints the refusal once
and counts one failure. No file the tool writes changes: the gem was
refused before and is refused now.
Root cause
A vendored run selects one patch per build of a gem that
Gemfile.locknames. A refusal read from the lock is the same for every one of them, but
the download phase (
fetch_selected_patches) and the dry-run previewlooked the refusal up per selected patch and reported and counted each.
The change
vendor::refusals::repeated_gem_refusals(core) names the patches of agem that are refused with the same code and detail as another patch of
the gem. The refusal is reported under the ruby gem's patch where that
one is refused, else under the first in purl order, the same order of
preference the vendor loop uses for the patch a gem is vendored through.
[error]line, nofailedevent, no count, no view fetch (as before).--max-new-patchesplan, so none of them takes a slot.vendor_gem_version_not_locked) is not folded andstays one line and event per patch, as the contract describes it.
CLI_CONTRACT.mdanddocs/ecosystems.mdstate the rule.Behavior change to note: under
--json, a gem refused this way now hasone
failedevent (oneskippedevent in a dry run) instead of one perselected patch, and
summary.failedcounts it once.Evidence
scan_vendor_gem_lock_refusal_is_reported_once_per_gem(
tests/in_process_vendor.rs, first commit) runs the built binary on agem locked for the ruby platform beside two platform gems with a patch
for each build. On
mainit fails with 3failedevents where 1 isexpected; with the fix it passes and checks the JSON event and count,
the single
[error]line, "Nothing was vendored: 1 patch failed", thesingle
[would-refuse]row, the dry-run JSON, and that nothing waswritten.
a_gems_refusal_is_reported_under_one_patch(core) covers which patchreports, and what is not folded: another gem, version, reason or
ecosystem, an expected skip, and one purl listed twice.
preview_reports_a_gems_refusal_once(cli) covers the preview row, theheadline count and the rollout plan's refused set.
cargo clippy --locked --workspace --all-features -- -D warnings;socket-patch-corevendor::refusalstests;
socket-patch-clilib tests (1106);in_process_vendor(157),scan_vendor_e2e(43),in_process_gem_multi_platform(9).With real Ruby 3.x and Bundler 4.0.18 (
--include-ignored):e2e_redirect_gem_build(57) ande2e_vendor_gem_build(23).cargo clippy ... --all-targetsalready fails onmainin test codeunder the pinned toolchain (88 errors in
socket-patch-core, none inthe files this PR touches); CI's clippy does not pass
--all-targets.Review
/code-review highfound no correctness bug and five nits. Fixed: a purllisted twice would have dropped its own report; the docs named one code
for a rule that covers every failing gem refusal; expected skips are now
left per patch; a stale doc comment. Not fixed:
or the copy installed, as the wet run does before it reports, so the two
can name different patches of the gem as the one that reports. That
difference in narrowing is older than this PR and changing it changes
which rows a dry run lists.
to the vendor loop for that one patch. It is not part of the download
phase's refusals and is not folded here. Not run.
Left of #2436
The issue also reports the re-scan of a gem that is already vendored as
platform gems: one
[skip] ... (already vendored)line per platformpatch. Those lines are not refusals (each patch's record is reused by the
vendor step) and are not changed here.
https://claude.ai/code/session_011f9aeQtMahebsTVDgcRvsp
Generated by Claude Code