Repository navigation
Skip on-disk gem preview in dry takeovers - #1786
Mikola Lysenko (mikolalysenko) merged 2 commits into
Conversation
A dry hosted-to-vendored takeover previews the vendored backend over the restored text, then again over the files on disk. For a gem, the Gemfile on disk still wraps the declaration in the hosted `source ... do` block, so the second preview, which now checks the Gemfile edit, could refuse it as indented while the real run vendors it. Stop after the restored-text preview for gems, as bun and sbt already do. Adds an e2e test that a top-level hosted gem previews a clean eject and then ejects for real. Assisted-by: Claude Code:claude-opus-5-5
The dry takeover skipped the on-disk backend preview for every gem, but takeover_dry_refusal returns None both when the restored text vendors cleanly and when it could not preview it at all (an uncaptured or binary reverted file). In the second case nothing checked the gem before the dry run reported success. Skip only when the restore rewrote a Gemfile/gems.rb (where the hosted source block lives) and its text was previewable, and match the ecosystem with Ecosystem::from_purl like the rest of the function. Co-Authored-By: Claude <noreply@anthropic.com>
|
bugbot run Generated by Claude Code |
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 dc55a10. Configure here.
|
[agent] Generated by Claude Code |
|
Ready for review at
Generated by Claude Code |
Final review briefWhat it does. A dry-run hosted→vendored takeover previews the vendor backend twice: over the restored text, then over the files on disk. Since #1762, the second preview for a gem could refuse the on-disk Gemfile because the hosted Risk: low. It changes a dry-run branch only (wet runs are untouched), and the restored-text preview still raises every real refusal. The author notes that no current CLI path reaches this branch with a hosted gem, so the guard is defensive. Look here
Verified. Read the full diff and the call site. The skip happens only after Changes I made. None. Open questions. None. The PR description lists the trade-offs the author left on purpose (the skipped disk preview's warnings are dropped, as for bun/sbt). Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Follow-up to #1762 (Refs #1761), from a review comment that arrived
after #1762 merged:
#1762 (comment)
Problem
#1762 made the gem vendored backend's dry run check the Gemfile/lock
edits the wet run would make. A dry hosted→vendored takeover in
vendor_records_reusingpreviews the backend twice: first over therestored text (
takeover_dry_refusal), then over the files on disk.For a gem, the Gemfile on disk still wraps the declaration in the
hosted
source "…/patch-registry/gem/…" doblock, so the secondpreview can now refuse it as "declaration is indented", even though the
wet run (which restores first) vendors it.
Fix
In that dry takeover branch, a gem stops after the restored-text
preview, the same way bun (
bun.lock/bun.lockb) and sbt(
socket-patch.sbt) already do. The restored-text preview still raisesevery real refusal, including the #1761 group-block one.
Note: no CLI path reached that branch with a hosted gem in my tests.
vendorejects whenever a hosted pin is in scope (the eject previewsonly over restored text), and the
scan/get --mode vendoreddryruns classify against the ledger without calling a backend. The guard
is defensive: two lines, matching the bun/sbt handling.
Tests
gem_hosted_pin_previews_and_runs_a_clean_eject(
e2e_redirect_gem_build): a top-level hosted gem (converged lock)previews
eject_planned(exit 0, nothing written), and the wetvendorthen wires.socket/vendor/gem/…. This covers the"successful hosted→vendored gem dry run" case the review found
untested. It also passes on the previous
main; it is coverage, not ared→green test, since no CLI path reaches the branch.
cargo fmt --all -- --checkandcargo clippy --workspace --all-features -- -D warningsclean;e2e_redirect_gem_build+e2e_vendor_gem_build--ignored36 + 9pass (Bundler 4.0.18, Ruby 3.3.6);
in_process_vendor147,in_process_vendor_bun_takeover45, corevendor::gem148 pass.Code review (/code-review high)
Fixed in dc55a10: the guard skipped the disk preview for every gem, even when the restored-text preview never ran (uncaptured/binary reverted file), so nothing checked the gem. It now skips only when the restore rewrote a
Gemfile/gems.rband that text was previewable, and usesEcosystem::from_purl.Not fixed, on purpose:
VendorOutcomefromtakeover_dry_refusalwould remove all three ecosystem special cases. That is a larger refactor, out of scope for this follow-up.Generated by Claude Code
Note
Medium Risk
Changes vendor takeover dry-run branching for gems; scoped like existing bun/sbt skips but can alter preview outcomes and warnings for hosted gem ejects.
Overview
Fixes a false dry-run refusal for hosted→vendored gem takeovers: after previewing the backend over restored Gemfile text, the CLI no longer runs a second preview against the on-disk Gemfile still wrapped in the hosted
source … doblock (which could triggergemfile_declaration_not_editableeven though the wet run restores first).The preview gate is extracted into
restored_text_previewable, and gems join the existing bun.lock / sbt skip path only when the restore rewroteGemfileorgems.rband that overlay was actually previewable.Adds e2e
gem_hosted_pin_previews_and_runs_a_clean_eject: converged hosted gem getseject_plannedon--dry-run(exit 0, no writes) and wires.socket/vendor/gem/…on the wetvendor.Reviewed by Cursor Bugbot for commit dc55a10. Configure here.
Generated by Claude Code