Repository navigation
Fix hosted gem unwind behind a private mirror (#2230) - #2233
Mikola Lysenko (mikolalysenko) wants to merge 6 commits into
Conversation
Assisted-by: Claude Code:claude-fable-5-2
The hosted gem unwind re-pins a CHECKSUMS entry only for a gem whose upstream remote is the literal rubygems.org. A project whose Gemfile names a private mirror as its source locks its gems under that remote, so rollback and remove always refused, also with SOCKET_RUBYGEMS_URL set to that very server, which the rest of the unwind already treats as the registry's stand-in. Accept the stand-in in the restore too: the sha256 is read from that server's compact index. The refusal that remains names the setting. Refs #2230 Assisted-by: Claude Code:claude-fable-5-2
After a hosted unwind an installed copy with an archive in its gem home was judged only against the upstream sha256. With none to judge by (a gem from another remote under a lock without CHECKSUMS, or an offline run), nothing judged it, so the patched build the scan had put there was left with no upstream_gem_stale_install warning. Judge such a copy by its pinned patch records, like a copy whose gem home has no archive. Refs #2230 Assisted-by: Claude Code:claude-fable-5-2
Refs #2230 Assisted-by: Claude Code:claude-fable-5-2
Refs #2230 Assisted-by: Claude Code:claude-fable-5-2
Review follow-ups for the gem mirror unwind: - The cache-dir archive check asked the gem registry for the sha256 of any gem with no CHECKSUMS entry, also one the lock resolves from another gem server. It names that archive as unchecked instead. - The refusal no longer names SOCKET_RUBYGEMS_URL for a server reached over plain http, which the setting refuses. - Doc wording. Refs #2230 Assisted-by: Claude Code:claude-fable-5-2
|
bugbot run Generated by Claude Code |
PR SummaryMedium Risk Overview Upstream restore now treats Installed-copy refresh ( CLI contract and ecosystems docs were updated to match; golden, unit, and e2e tests cover mirror restore, refusal text, and stale reporting. Reviewed by Cursor Bugbot for commit c55705d. 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 c55705d. Configure here.
|
[agent] PR shepherd: review brief for the approver What it does. Lets Risk: low. It only touches the gem unwind path. The restore accepts one more remote, and only the one the user names explicitly. The other two changes add a warning or skip a registry lookup, and neither changes any files. The refusal text now strips credentials from the remote URL, where before it printed it raw. Look here
Verified. I read the full diff of the Rust sources, Changes I made. None. Open questions. The PR's own "Not fixed" note, which predates this PR: with Generated by Claude Code |
LLM Description written by Claude Code:claude-fable-5-2
Fixes #2230
Summary
A project whose
Gemfilenames a private gem server as its source(
source "https://gems.example.com") could not get a hosted gem pin undoneby socket-patch. After this PR:
CHECKSUMS:rollback/removerestore the pair byte forbyte, and put the upstream gem back in the gem home, when
SOCKET_RUBYGEMS_URLnames that server. Without the setting they stillrefuse and change nothing, and the refusal now names the setting.
CHECKSUMS: the pair was already restored, but thepatched build left in the gem home was not reported. It is now named by
upstream_gem_stale_installwith the files to remove.unwind checks an archive in Bundler's cache dir.
No new network destination: the unwind contacts only the registry the user
names with
SOCKET_RUBYGEMS_URL, as before.Root cause
restore_one(core,redirect/upstream/gem.rs) re-pinned aCHECKSUMSentry only when the upstream remote was the literalrubygems.org. The refresh, the source-gem lookup and the contract's
SOCKET_RUBYGEMS_URLrow ("a lockremote:equal to it counts as theregistry") all use
is_rubygems_remote, which accepts the setting'sserver. The restore now uses it too.
PinJudge::probe(CLI,gem_refresh.rs) left every installed copy withan archive in its gem home to the archive check. That check needs the
upstream sha256. With none (another remote under a lock without
CHECKSUMS, or--offline/ a registry error) nothing judged the copy.Such a copy is now judged by its pinned patch records, like a copy whose
gem home has no archive.
stale_cache_warningasked the registry's compact indexfor any gem with no
CHECKSUMSentry, whatever remote the lock resolvesit from. A private gem's name went to the registry, and a public gem of
the same name would have made the archive look patched. It is now gated
on
rubygems_locked, and the archive is named as unchecked.Behavior changes to review
upstream_gem_stale_installnow also appears after an unwind for arubygems.org gem under a lock without
CHECKSUMSwhen the run is--offlineor the registry fails and the gem home holds an archive. Thecopy is judged by the patch record (proven patched: reported as stale;
proven unpatched: silent; no record: "could not be checked"). Before, the
copy was passed over. This is the rule the contract already had for a gem
home without an archive.
the remote and names the setting). For a remote reached over plain
httpon another host the setting is not named, because it would be refused.
Evidence
Red before the fix, green after:
upstream_restore_golden::gem_mirror_named_by_socket_rubygems_url_round_trips(core)upstream_restore_golden::gem_refusals_leave_everything_hosted(core)gem_refresh::tests::pin_judge_judges_an_archiveless_copy_by_any_of_its_pins(CLI unit)e2e_redirect_gem_stale_install::hosted_unwind_restores_a_mirror_gem_when_the_registry_setting_names_the_mirrorrollbackandremove,CHECKSUMSlock: refusal, then exact restore and upstream installrollback_failede2e_redirect_gem_stale_install::hosted_unwind_names_a_patched_install_from_a_mirror_without_checksumsCHECKSUMS, online and--offline; cache-dir archive; registry not askede2e_redirect_gem_stale_install::hosted_unwind_leaves_an_upstream_install_from_a_mirror_alonee2e_redirect_gem_build::gem_hosted_unwind_restores_a_gem_from_a_private_gem_server(real Bundler,--ignored)CHECKSUMSlock from a realbundle install; after the unwindbundle installandbundle pristinepass and keep the upstream gemLocal runs (Ruby 3.3.6, Bundler 4.0.18):
CLI_CONTRACT.mdanddocs/ecosystems.mddescribe the new behavior. Thewrappers under
npm/,pypi/andgem/need no change.Code review
/code-review highran on the diff. Fixed: the cache-dir registry lookup(root cause 3), the refusal's remedy for a plain-http remote, a missing blank
line in the docs, and the wording of the
SOCKET_RUBYGEMS_URLcontract row.Not fixed, with reasons:
SOCKET_RUBYGEMS_URLexported forevery project, a lock that resolves from rubygems.org itself is also
restored from the setting's server. That is the setting's existing
stand-in meaning and predates this PR. The refusal asks for the setting on
that re-run only. Separating "stand-in for rubygems.org" from "this
private server" would be a new setting, which is a maintainer's call.
intended: the copy may hold the patched build and nothing else reports it.
Follow-ups (not in this PR)
CHECKSUMSlock withoutsaying that the unwind needs
SOCKET_RUBYGEMS_URL, and its hold noteoffers a plain
socket-patch rollback pkg:gem/.... The refusal now givesthe way out, so this is a wording improvement.
own (with Bundler's configured credentials) is a design decision for a
maintainer.
https://claude.ai/code/session_011f9aeRPXFzq8PM8WQb75Ke
Generated by Claude Code