Skip to content

Feature/java doc fix#8175

Merged
jack-berg merged 4 commits intoopen-telemetry:mainfrom
opensourcevk:feature/java-doc-fix
Mar 12, 2026
Merged

Feature/java doc fix#8175
jack-berg merged 4 commits intoopen-telemetry:mainfrom
opensourcevk:feature/java-doc-fix

Conversation

@opensourcevk
Copy link
Copy Markdown
Contributor

Summary
This change fixes version filtering in the javadoc-crawler module by replacing lexicographic string comparison with semantic version comparison when deciding whether an artifact should be crawled.
Previously, crawlJavaDocs(...) compared artifact versions using String.compareTo(...). That produced incorrect ordering for versions such as 1.9.0 and 1.49.0, which could cause older artifacts to be treated as newer and crawled unnecessarily. The updated logic parses version components numerically and compares them semantically, including basic handling for qualifiers such as -alpha.
What Changed
• Replaced direct string comparison with a new compareVersions(...) helper in JavaDocsCrawler.java.
• Added a small internal SemanticVersion implementation to compare:
◦ dotted numeric version parts (1.9.0 vs 1.49.0)
◦ versions with different component lengths
◦ qualified vs non-qualified versions (1.60.0-alpha vs 1.60.0)
• Added tests in JavaDocsCrawlerTest.java to verify:
◦ semantic ordering works as expected
◦ artifacts below the minimum version are skipped without issuing crawl requests

Why
The crawler uses minimum version thresholds to avoid hitting javadoc.io for artifacts that are too old to matter. With string comparison, some older versions were incorrectly allowed through. This change makes that filtering accurate, reduces unnecessary HTTP requests, and avoids putting extra load on javadoc.io.

@opensourcevk opensourcevk requested a review from a team as a code owner March 11, 2026 10:38
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.29%. Comparing base (839f235) to head (98e3de3).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8175   +/-   ##
=========================================
  Coverage     90.29%   90.29%           
  Complexity     7650     7650           
=========================================
  Files           843      843           
  Lines         23059    23059           
  Branches       2309     2309           
=========================================
  Hits          20822    20822           
  Misses         1519     1519           
  Partials        718      718           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@trask
Copy link
Copy Markdown
Member

trask commented Mar 11, 2026

cc @jaydeluca

Copy link
Copy Markdown

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 updates the javadoc-crawler module’s minimum-version filtering so artifacts are compared using semantic version ordering instead of lexicographic String.compareTo, preventing incorrect skip/crawl decisions (e.g., 1.9.0 vs 1.49.0).

Changes:

  • Replaced lexicographic version filtering with compareVersions(...) in JavaDocsCrawler.
  • Added a small internal SemanticVersion parser/comparator with basic qualifier handling.
  • Added unit tests to validate semantic ordering and to ensure artifacts below the minimum version do not trigger crawl requests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
javadoc-crawler/src/main/java/io/opentelemetry/javadocs/JavaDocsCrawler.java Switches min-version filtering to semantic comparison and introduces SemanticVersion.
javadoc-crawler/src/test/java/io/opentelemetry/javadocs/JavaDocsCrawlerTest.java Adds tests for semantic ordering and for skipping crawl requests below min version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Thanks for this. Couple of minor comments. I asked copilot for a review, and gave a 👍 to the comments I agree with.

@jaydeluca
Copy link
Copy Markdown
Member

while we're updating this, we could also update the minimum version block:

  private static final Map<String, String> GROUPS_AND_MIN_VERSION =
      Map.of(
          "io.opentelemetry", "1.60.1",
          "io.opentelemetry.instrumentation", "2.25.0",
          "io.opentelemetry.contrib", "1.54.0",
          "io.opentelemetry.semconv", "1.40.0",
          "io.opentelemetry.proto", "1.10.0");

@opensourcevk opensourcevk requested a review from jack-berg March 12, 2026 11:53
@jack-berg
Copy link
Copy Markdown
Member

Thanks!

@jack-berg jack-berg merged commit de07b70 into open-telemetry:main Mar 12, 2026
27 checks passed
@otelbot
Copy link
Copy Markdown
Contributor

otelbot bot commented Mar 12, 2026

Thank you for your contribution @opensourcevk! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants