gradle: fix wrapper updater crash when only some wrapper files define checksum#14399
Merged
kbukum1 merged 1 commit intoMar 10, 2026
Merged
Conversation
This was referenced Mar 9, 2026
Co-authored-by: Codex <noreply@openai.com>
17fe271 to
ecaec57
Compare
kbukum1
approved these changes
Mar 10, 2026
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.
Problem
Dependabot crashes updating
gradle-wrapperin repositories with multiplegradle-wrapper.propertiesfiles when only some files includedistributionSha256Sum.Error:
Error processing gradle-wrapper (TypeError)T.let: Expected type String, got type NilClassRoot cause
WrapperUpdater#command_argsused a global guard:dependency.requirements.size > 1but indexed into the local per-file slice:
requirements[1]In mixed multi-wrapper scenarios, a local file can have only one requirement (
distributionUrl), sorequirements[1]isniland Sorbet raises.Fix
Use a local guard and nullable type for checksum extraction:
checksum = T.let(requirements[1]&.[](:requirement), T.nilable(String)) if requirements.size > 1This keeps behavior for single-wrapper repositories unchanged and prevents the crash for mixed multi-wrapper repositories.
Test coverage
Added a focused regression spec:
gradle/spec/dependabot/gradle/file_updater/wrapper_updater_spec.rbScenario covered:
distributionUrldistributionUrl+distributionSha256SumAssertion:
Testing
Result:
5 examples, 0 failures