Fix TypeError when force_updater receives git commit SHA instead of Version#14096
Draft
Fix TypeError when force_updater receives git commit SHA instead of Version#14096
Conversation
- Add guard to check for git dependencies before calling force_updater - force_updater expects Gem::Version, not commit SHA strings - Add tests for git dependency handling in both methods Co-authored-by: kbukum1 <171620528+kbukum1@users.noreply.github.com>
Co-authored-by: kbukum1 <171620528+kbukum1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TypeError for Dependabot::Version casting
Fix TypeError when force_updater receives git commit SHA instead of Version
Feb 4, 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.
What are you trying to accomplish?
Fixes
TypeError: T.cast: Expected type Dependabot::Version, got type Stringwhen updating git dependencies.For git dependencies,
latest_versionreturns commit SHAs (String) from methods likegit_commit_checker.head_commit_for_current_branch. Theforce_updaterexpectsGem::Versionobjects and validates this constraint. Git dependencies bypass version resolution entirely—they track commits, not semantic versions—making the full unlock path inapplicable.Anything you want to highlight for special attention from reviewers?
Added guards to short-circuit before
force_updaterinvocation:latest_version_resolvable_with_full_unlock?returnsfalsefor git dependenciesupdated_dependencies_after_full_unlockreturns[]for git dependenciesThis follows the existing pattern for git dependency handling (see
lowest_resolvable_security_fix_versionline 47).Alternative considered: Modify
ForceUpdaterto accept String types. Rejected because full unlock semantics don't apply to git dependencies—they don't have version constraints to unlock.How will you know you've accomplished your goal?
Added test coverage for both methods with git dependencies returning commit SHAs. Tests verify no TypeError is raised and appropriate values are returned.
All changes pass Sorbet type checking, RuboCop validation, and CodeQL security analysis.
Checklist
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.