Skip to content

fix: check versions across all the defined maven registries#13747

Merged
kbukum1 merged 1 commit intodependabot:mainfrom
yeikel:fix/fetch-from-all
Feb 3, 2026
Merged

fix: check versions across all the defined maven registries#13747
kbukum1 merged 1 commit intodependabot:mainfrom
yeikel:fix/fetch-from-all

Conversation

@yeikel
Copy link
Copy Markdown
Contributor

@yeikel yeikel commented Dec 10, 2025

What are you trying to accomplish?

When checking for new versions, we shouldn’t assume that the first repository to respond has the latest version, as it might return a stale one. Instead, Dependabot should scan all repositories, aggregate all available metadata for an artifact, and select the highest version available across them

This behavior was introduced with #5872 in order to reduce the network load, and while the following is true while resolving

Remote repository URLs are queried in the following order for artifacts until one returns a valid result

This does not directly translate while looking for new versions as documented in the spec.

For more details, see #5872 (comment)

Fixes #9383

How will you know you've accomplished your goal?

Running the updated version using my reproducer works as expected

See: https://github.com/yeikel/dependabot-reproducer-9383

Current

updater | 2025/12/10 06:13:56 INFO Latest version is 0.11.0-sshd-314-1
updater | 2025/12/10 06:13:56 INFO No update needed for org.apache.sshd:sshd-core 2.11.0
{"data":{"base-commit-sha":"6dbf65dc2b7a652b60054518953e70fe2a9fa21e"},"type":"mark_as_processed"}
proxy | 2025/12/10 06:13:56 [023] PATCH http://host.docker.internal:57186/update_jobs/cli/mark_as_processed
proxy | 2025/12/10 06:13:56 [023] 200 http://host.docker.internal:57186/update_jobs/cli/mark_as_processed
updater | 2025/12/10 06:13:56 INFO Finished job processing
proxy | 2025/12/10 06:13:56 Skipping sending metrics because api endpoint is empty
proxy | 2025/12/10 06:13:56 0/10 calls cached (0%)

After:

updater | 2025/12/10 06:19:56 INFO Latest version is 2.16.0
{"data":{"base-commit-sha":"6dbf65dc2b7a652b60054518953e70fe2a9fa21e"},"type":"mark_as_processed"}
proxy | 2025/12/10 06:20:00 [062] PATCH http://host.docker.internal:57437/update_jobs/cli/mark_as_processed
proxy | 2025/12/10 06:20:00 [062] 200 http://host.docker.internal:57437/update_jobs/cli/mark_as_processed
updater | 2025/12/10 06:20:00 INFO Finished job processing
updater | 2025/12/10 06:20:00 INFO Results:
updater | +---------------------------------------------------------------+
updater | | Changes to Dependabot Pull Requests |
updater | +---------+-----------------------------------------------------+
updater | | created | org.apache.sshd:sshd-core ( from 2.11.0 to 2.16.0 ) |
updater | +---------+-----------------------------------------------------+
proxy | 2025/12/10 06:20:00 Skipping sending metrics because api endpoint is empty
proxy | 2025/12/10 06:20:00 4/29 calls cached (13%)

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@yeikel yeikel requested a review from a team as a code owner December 10, 2025 06:36
@github-actions github-actions bot added the L: java:maven Maven packages via Maven label Dec 10, 2025
@yeikel yeikel changed the title fix: check versions across all the defined registries fix: check versions across all the defined maven registries Dec 10, 2025
@yeikel yeikel force-pushed the fix/fetch-from-all branch 14 times, most recently from 50e3c52 to 1d7eea3 Compare December 17, 2025 04:18
@yeikel yeikel force-pushed the fix/fetch-from-all branch 7 times, most recently from d4ec419 to ddf0f86 Compare December 23, 2025 02:09
@yeikel
Copy link
Copy Markdown
Contributor Author

yeikel commented Dec 31, 2025

@kbukum1

Could you please review this and share your feedback if any?

Thank you in advance!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Maven version checking to scan all configured repositories instead of stopping at the first repository that responds. Previously, Dependabot would break after finding versions in the first repository, potentially missing newer versions available in other repositories. The fix ensures the highest version across all repositories is correctly identified.

Key changes:

  • Modified version collection logic to aggregate results from all repositories
  • Added test coverage for multi-repository scenarios
  • Updated test expectations to reflect correct behavior when versions exist in multiple repositories

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
maven/lib/dependabot/maven/package/package_details_fetcher.rb Removed break statement to continue collecting versions from all repositories instead of stopping at the first
maven/spec/fixtures/maven_central_metadata/with_release_older_version.xml Added fixture representing a repository with older versions to test cross-repository version comparison
maven/spec/dependabot/maven/update_checker/version_finder_spec.rb Added test case validating that all repositories are checked and the highest version is selected; updated existing test expectations to reflect corrected source_url behavior

@yeikel yeikel force-pushed the fix/fetch-from-all branch 6 times, most recently from b6453f8 to 3ada364 Compare January 7, 2026 19:18
@yeikel yeikel force-pushed the fix/fetch-from-all branch 3 times, most recently from 2e8026d to f1d0bcf Compare January 14, 2026 14:44
@yeikel yeikel force-pushed the fix/fetch-from-all branch 5 times, most recently from 72f8176 to cbffdc0 Compare January 26, 2026 23:29
@yeikel
Copy link
Copy Markdown
Contributor Author

yeikel commented Jan 26, 2026

@kbukum1

Could you please clarify what's blocking this merge? Do you need any additional information, reproducer or tests?

Thanks

@yeikel yeikel force-pushed the fix/fetch-from-all branch 2 times, most recently from 7d77995 to 864965a Compare February 2, 2026 19:59
@kbukum1 kbukum1 moved this to Scoping in Dependabot Feb 2, 2026
@kbukum1 kbukum1 moved this from Scoping to On Hold in Dependabot Feb 2, 2026
@kbukum1 kbukum1 force-pushed the fix/fetch-from-all branch from 864965a to 920df76 Compare February 3, 2026 22:21
@kbukum1 kbukum1 moved this from On Hold to In Progress in Dependabot Feb 3, 2026
@kbukum1 kbukum1 merged commit 02d5665 into dependabot:main Feb 3, 2026
63 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Dependabot Feb 3, 2026
@yeikel yeikel deleted the fix/fetch-from-all branch February 3, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: java:maven Maven packages via Maven

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Maven version search should search all repositories, not stop after the first maven-metadata.xml

3 participants