Repository navigation
Bundler: update git pins declared on git/github blocks - #16481
Open
matchbookmac wants to merge 6 commits into
Open
matchbookmac wants to merge 6 commits into
matchbookmac wants to merge 6 commits into
Conversation
GitPinReplacer only rewrote `tag:`/`ref:` on `gem "x", git: ..., tag: ...` declarations. When a gem is declared inside a `git "...", tag: "..." do` (or `github`) block, the pin lives on the block's call, so the Gemfile was left unchanged, the lockfile re-resolved to identical content, and LockfileUpdater raised "Expected content to change!". Rewrite the pin on a git/github block when its body declares the targeted gem. Fixes dependabot#16435 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
Fixes #16435.
GitPinReplaceronly rewrotetag:/ref:ongem "x", git: ..., tag: ...declarations. Bundler also lets you declare gems inside agit/githubblock, with the pin on the block's call:For these gems the Gemfile was never rewritten, so the lockfile re-resolved to the same content and
LockfileUpdater#updated_lockfile_contentraisedRuntimeError: Expected content to change!. In a grouped update, that one failure marks every group member asunknown_error, and no PR gets opened.Anything you want to highlight for special attention from reviewers?
Rewriter#on_blocknow rewrites the pin on a top-levelgit/githubblock call when the block body declares the targeted gem. It then callssuperso nestedgemdeclarations are still visited. Blocks that don't declare the gem, and non-git blocks such asgroup, are left alone.update_pinsso thegemand block paths share it. It also now guards against a call whose last argument isn't a node.GitPinReplaceris also used byUpdateChecker::FilePreparer#replace_git_pin, so block-declared gems get their pin replaced there too during resolution.git_source(:name)helpers aren't handled. That seemed out of scope.How will you know you've accomplished your goal?
GitPinReplacerunit specs cover: a single-gemgitblock, a multi-gem block next to an unrelated block (only the matching one changes), agithubblock, and a non-git block (untouched).FileUpdaterspec uses agit_source_blockfixture (dependabot-fixtures/quein agit ..., tag: "v0.11.6" doblock, bumped tov0.12.0). It asserts that both the Gemfile tag and the lockfiletag:/revision:change. Without the fix, this spec reproduces the bug: the lockfile is unchanged.spec/dependabot/bundler/file_updater*andspec/dependabot/bundler/update_checkerpass (505 examples, 0 failures), and rubocop is clean on the changed files.Checklist
馃 Generated with Claude Code