GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — Fix gem restore of Bundler 4.1 override targets (#1989) by mikolalysenko · Pull Request #1991 · SocketDev/socket-patch Conversation
|
| Issue | Regression test | Without fix | With fix |
|---|---|---|---|
| #1989 | override_target_redirect_round_trips_through_restore (hosted rewrite → restore_one on a Bundler 4.1 OVERRIDES pair) |
fail: manifest gained gem "rails", "7.0.0" |
pass, byte-exact |
| #1989 | an_overrides_with_target_is_a_subdependency (argument order, version: with a comma, with: nil, name as target/parent/prefix, section scoping) |
fail | pass |
OVERRIDES shape was checked against a real lock written by bundle _4.1.0.beta3_ lock for the issue's Gemfile. It has the same section position and entry format.cargo fmt --all -- --check: clean.cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --all-features --lib: 6997 passed, 4 failed. The 4 also fail on unmodified main in this sandbox, because it runs as root (copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_…, pypi_requirements::wire_failure_…; same as Build: share one test RNG across randomized tests (#1868) #1882 and Build: share one test env guard in core (#1889) #1891).cargo test -p socket-patch-cli --all-features --lib --bins: 940 passed.cargo test -p socket-patch-cli --all-features --test e2e_redirect_gem_build --test e2e_vendor_gem_build -- --ignored with real Ruby 3.3.6 and Bundler: 37 + 11 passed.cargo test --workspace ran out of this sandbox's disk allowance while linking the ~100 CLI integration binaries, so CI covers the rest./code-review high)Override#to_lock is [target.inspect, "with: #{op.inspect}", "in: #{from.inspect}", ...].join(", "), and its own LOCK_LINE parser accepts only that form.in: parent still counts": the existing sub-line rule takes the same risk. Both are only a secondary guard behind provably_appended (an option-less block after a blank line that the in-place rewrite cannot produce).override without in:": Bundler rejects with: without in: (add_dependency_override raises).zz_parent_unwind scenario belongs in e2e_redirect_gem_build.Note
Medium Risk
Changes transitive-vs-direct classification during gem restore; wrong parsing could drop real declarations or leave stray pins, but behavior is gated by existing provably_appended checks and only extends dependency detection.
Overview
Fixes hosted gem rollback/remove (#1989) when a patched gem is wired only through Bundler 4.1’s override "…", with: "<gem>", in: "<parent>". Those locks keep the parent’s original spec edge and record the swap in OVERRIDES, so the gem never appears on a 6-space sub-line. Restore used to treat it as direct and inject gem "<name>", "<version>", blocking updates past the pinned version.
is_subdependency in gem.rs now also treats the with: gem name from lock OVERRIDES entries (via new override_targets parser) as “another spec depends on this,” alongside existing sub-line checks. That lets restore_one classify the hosted append as transitive again—drop the Socket block and DEPENDENCIES entry instead of adding an exact pin—so Gemfile / Gemfile.lock round-trip byte-for-byte like ordinary transitive redirects.
Docs and unit/async tests cover argument order, version: clauses with commas, with: nil, and full rewrite → restore for an override-only rails fixture.
Reviewed by Cursor Bugbot for commit 927fa4c. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
With Bundler 4.1, `override "other", with: "gem", in: "parent"` records the replacement only in the lock's OVERRIDES section and keeps parent's original edge in the specs. Hosted rollback and remove then treated the gem as directly declared and wrote a new exact `gem "gem", "x.y.z"` pin into the Gemfile, which blocked the project from updating past the vulnerable version. The restore now counts an OVERRIDES `with:` target as a dependency of another spec, so it drops the appended Socket block and its DEPENDENCIES entry and gives back the original pair byte for byte. Fixes #1989 Assisted-by: Claude Code:claude-opus-5-5
Cover the two other OVERRIDES shapes Bundler 4.1 writes: a replacement with a version requirement (which holds a comma) and `with: nil`. Assisted-by: Claude Code:claude-opus-5-5
630dd19 to
26062a3
Compare
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ 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 927fa4c. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
[agent] Reviewed 927fa4ccdf118bf8a01e1164112f8de68d318980. Checked Bundler OVERRIDES target recognition and restore ownership; the exact-head override_target round-trip test passed locally (1 test). No major correctness issues found. Validation: The focused core override_target round-trip test passed locally (1 test). Source and regression-test review plus available exact-head CI checks; broader local suites were not run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Burn-down agent: labeled Ready for review.
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Hosted gem rollback / remove turn a gem reached only through a Bundler 4.1override …, with:, in: into a new top-level exact pin, so the project can no longer update past the vulnerable version
There was an error while loading. Please reload this page.