Skip to content

Fix gemspec-only vendor test on Bundler 1.17 (#2203) - #2206

Merged
Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
agent/fix-gemspec-only-test-bundler-1
Nov 24, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
agent/fix-gemspec-only-test-bundler-1

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-fable-5-2

Fixes #2203

Summary

Test-only change. gem_vendor_gemspec_only_dependency_refusal_names_remedies_that_work (e2e_vendor_gem_build) has failed in the nightly Bundler 1.17.3 leg since it was added. The product behaves correctly there; the test tripped over a Bundler 1.x habit.

Root cause

The test checks the two ways out of the refusal in one project directory:

  1. Add a gem "rack" line above gemspec, vendor, and run a frozen bundle install.
  2. Put the Gemfile back and patch in agent mode, which starts with an unfrozen bundle install.

Bundler <= 2.0 persists BUNDLE_FROZEN: "true" into the project's .bundle/config on a frozen install. Step 2's install then runs frozen against a changed Gemfile and Bundler refuses it:

You are trying to install in deployment mode after changing
your Gemfile. [...]
You have added to the Gemfile:
* rack (>= 3)
You have deleted from the Gemfile:
* rack

That message goes to stdout, which the premise assert did not print, so the nightly log showed only Pathname#untaint warnings.

What changed

  • The test saves the project's .bundle/config at the start and writes it back before step 2's install. The fresh-checkout tests in this file and in e2e_redirect_gem_build already do the same for the same reason.
  • The premise assert in gemspec_library prints stdout as well as stderr.

No assertion is removed or loosened, and nothing is skipped on any Bundler.

Evidence

Ruby 3.1.6, BUNDLER_VERSION=1.17.3, SOCKET_PATCH_BUNDLER_E2E_REQUIRED=1, SOCKET_PATCH_BUNDLER_E2E_VERSION=1.17.3:

before: cargo test -p socket-patch-cli --test e2e_vendor_gem_build -- --ignored gem_vendor_gemspec
        gem_vendor_gemspec_only_dependency_refusal_names_remedies_that_work FAILED
        (e2e_vendor_gem_build.rs:2275, called from the agent-mode leg)
after:  cargo test -p socket-patch-cli --test e2e_vendor_gem_build -- --ignored
        13 passed; 0 failed

Ruby 3.3.6, Bundler 4.0.18: both gem_vendor_gemspec* tests pass.

cargo clippy --locked --workspace --all-features -- -D warnings (CI's command) does not compile test targets. --all-targets reports lints in this suite's shared test helpers that are on main; none is on a line this PR touches.

The nightly Bundler-era legs do not run on a PR, so this PR's CI does not exercise the 1.17.3 leg; the local run above is the evidence for it.

Review

/code-review high found no bug in the diff. Two notes, left out to keep this PR to the failing test:

  • gem_vendor_refuses_an_eval_gemfile_direct_dep also installs unfrozen after a frozen install in one directory. It passes on 1.17.3 (run above) because its rewritten Gemfile declares the same dependencies, so Bundler's frozen check has nothing to refuse.
  • Other premise asserts in this file still print only stderr. Changing them all is a wider edit than this fix needs.

https://claude.ai/code/session_011f9aePiVyUzKFwJZh49P6u


Generated by Claude Code

gem_vendor_gemspec_only_dependency_refusal_names_remedies_that_work
failed in the nightly Bundler 1.17.3 leg. Its first remedy runs a
frozen `bundle install`, and Bundler <= 2.0 persists
`BUNDLE_FROZEN: "true"` into the project's `.bundle/config` when it
does. The second remedy then changes the Gemfile and installs
unfrozen, which that Bundler refuses as a deployment-mode install
of a changed Gemfile.

Put the committed `.bundle/config` back before that install, as the
fresh-checkout tests in this suite already do. The premise assert in
`gemspec_library` now prints stdout as well, where Bundler 1.x writes
its errors.

Fixes #2203

Assisted-by: Claude Code:claude-fable-5-2
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011f9aePiVyUzKFwJZh49P6u
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 23, 2026 21:31
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] bugbot run


Generated by Claude Code

@cursor

cursor Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Only e2e test harness changes; no production code or relaxed assertions.

Overview
Test-only fix for gem_vendor_gemspec_only_dependency_refusal_names_remedies_that_work failing on Bundler 1.17.3 nightly legs.

The test runs a frozen bundle install then agent mode with a changed Gemfile in the same directory. Bundler ≤ 2.0 writes BUNDLE_FROZEN: "true" into .bundle/config on frozen installs, so the later unfrozen install was still frozen and refused the Gemfile change—not a product bug.

The PR snapshots .bundle/config before the scenario and restores it before the agent-mode leg (same idea as fresh-checkout tests that copy committed_bundle). The gemspec_library premise assert now prints stdout as well as stderr when install fails, so Bundler’s refusal message is visible in logs.

Reviewed by Cursor Bugbot for commit 4999fc3. Configure here.

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] PR shepherd: review brief for the approver

What it does. Test-only fix for #2203. The nightly Bundler 1.17.3 leg failed gem_vendor_gemspec_only_dependency_refusal_names_remedies_that_work because Bundler <= 2.0 writes BUNDLE_FROZEN: "true" into .bundle/config on a frozen install, so the test's later unfrozen install of a changed Gemfile was refused. The test now saves the project's .bundle/config and restores it before that install, and the premise assert prints stdout too (where Bundler put the real error).

Risk. Low. One test file, 9 lines; no product code, no assertion removed or loosened, nothing skipped.

Look here.

  • [crates/socket-patch-cli/tests/e2e_vendor_gem_build.rs#L2449-L2450](https://github.com/SocketDev/socket-patch/blob/4999fc3bb8d8086b1b2141e5e34eb905192edfff/crates/socket-patch-cli/tests/e2e_vendor_gem_build.rs#L2449-L2450): the config snapshot, taken before any frozen install (the staged project writes its own private .bundle/config, so the read can't miss).
  • [crates/socket-patch-cli/tests/e2e_vendor_gem_build.rs#L2556-L2560](https://github.com/SocketDev/socket-patch/blob/4999fc3bb8d8086b1b2141e5e34eb905192edfff/crates/socket-patch-cli/tests/e2e_vendor_gem_build.rs#L2556-L2560): the restore before the agent-mode leg, the same pattern this file already uses near L366.
  • [crates/socket-patch-cli/tests/e2e_vendor_gem_build.rs#L2277-L2278](https://github.com/SocketDev/socket-patch/blob/4999fc3bb8d8086b1b2141e5e34eb905192edfff/crates/socket-patch-cli/tests/e2e_vendor_gem_build.rs#L2277-L2278): stdout added to the premise message.

Verified. Read the diff and the test around it against #2203's log. CI on 4999fc3bb8d8086b1b2141e5e34eb905192edfff: ci-ok and clippy green, no review threads. The Bundler 1.17.3 leg only runs nightly, so the PR's evidence for it is the author's local run (13 passed on 1.17.3; both gemspec tests pass on Bundler 4.0.18).

Changes I made. None.

Open questions. None.


Generated by Claude Code

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Nov 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[agent] Reviewed the test fixture and both remedy paths. Restoring the fixture's Bundler config between the frozen install and the agent-mode leg fixes the state leak while preserving both assertions.

Merged via the queue into main with commit 8be19d9 Nov 24, 2026
83 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-gemspec-only-test-bundler-1 branch November 24, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly: gem_vendor_gemspec_only_dependency_refusal_names_remedies_that_work fails on bundler 1.17.3 (bundle install premise)

3 participants