Fix cooldown ignored in additional_dependencies issue#15124
Open
AbhishekBhaskar wants to merge 9 commits into
Open
Fix cooldown ignored in additional_dependencies issue#15124AbhishekBhaskar wants to merge 9 commits into
AbhishekBhaskar wants to merge 9 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes pre-commit cooldown handling so that (1) additional dependencies respect the configured cooldown and (2) when the latest hook version is in cooldown, Dependabot falls back to the most recent version outside the cooldown window instead of returning the current version.
Changes:
- Forward cooldown configuration into all pre-commit additional dependency checkers and their underlying ecosystem update checkers.
- Add fallback logic in the pre-commit git-tag latest-version finder to select the newest candidate version outside cooldown when the latest is quarantined.
- Add/extend specs covering cooldown fallback behavior and cooldown passthrough for Python additional dependencies.
Show a summary per file
| File | Description |
|---|---|
| pre_commit/lib/dependabot/pre_commit/update_checker/latest_version_finder.rb | Adds cooldown fallback search to find the newest tag outside cooldown. |
| pre_commit/lib/dependabot/pre_commit/update_checker.rb | Passes update_cooldown down into additional dependency checker construction. |
| pre_commit/lib/dependabot/pre_commit/additional_dependency_checkers/base.rb | Adds optional cooldown_options plumbing on the base checker API. |
| pre_commit/lib/dependabot/pre_commit/additional_dependency_checkers/python.rb | Forwards cooldown to the pip UpdateChecker. |
| pre_commit/lib/dependabot/pre_commit/additional_dependency_checkers/node.rb | Forwards cooldown to the npm_and_yarn UpdateChecker. |
| pre_commit/lib/dependabot/pre_commit/additional_dependency_checkers/go.rb | Forwards cooldown to the go_modules UpdateChecker. |
| pre_commit/lib/dependabot/pre_commit/additional_dependency_checkers/ruby.rb | Forwards cooldown to the bundler UpdateChecker. |
| pre_commit/lib/dependabot/pre_commit/additional_dependency_checkers/rust.rb | Forwards cooldown to the cargo UpdateChecker. |
| pre_commit/lib/dependabot/pre_commit/additional_dependency_checkers/dart.rb | Forwards cooldown to the pub UpdateChecker. |
| pre_commit/lib/dependabot/pre_commit/metadata_finder.rb | Avoids errors and improves URL extraction by supporting repo_url. |
| pre_commit/spec/dependabot/pre_commit/update_checker/latest_version_finder_spec.rb | Adds tests for cooldown fallback behavior in latest-version selection. |
| pre_commit/spec/dependabot/pre_commit/additional_dependency_checkers/python_spec.rb | Adds tests ensuring cooldown is passed through to the Python UpdateChecker. |
Copilot's findings
- Files reviewed: 12/12 changed files
- Comments generated: 2
kbukum1
reviewed
May 23, 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 #15111
This PR fixes 2 issues-
Cooldown does not apply to additional dependencies: When a pre-commit hook has
additional_dependencies(e.g.,black==25.1.0), the cooldown configuration was not being forwarded to the underlying ecosystem update checkers (pip, npm, go_modules, etc.). This caused additional dependencies to always update to the absolute latest version, ignoring cooldown.Cooldown returns current version instead of next-best: When the latest version of a hook is within the cooldown window, the code previously returned the current version (no update), instead of falling back to the most recent version outside cooldown — which is the behavior all other ecosystems implement via
filter_by_cooldowninPackageLatestVersionFinder.File updater writes wrong version after cooldown filtering: When cooldown selected a fallback version (e.g., 26.3.1),
latest_version_tagstill returned the absolute latest tag (26.5.1), causing the file updater to write the wrong rev into.pre-commit-config.yaml.Anything you want to highlight for special attention from reviewers?
git clone --bareand checks commit dates from the latest version downward, stopping at the first version outside the cooldown window.current_versionnow handles v-prefixed tags (e.g.,v4.4.0) by stripping the prefix, preventing potential downgrades whennumeric_versionreturns nil.latest_version_tagreturns the cooldown-filtered tag (stored during iteration) so the file updater writes the correct ref.cooldown_optionsparameter was added toAdditionalDependencyCheckers::Base#initializeas an optional keyword argument, so existing callers are unaffected.update_cooldownto their respective ecosystem update checkers.How will you know you've accomplished your goal?
latest_version_finder_spec.rb.Checklist