Skip to content

gh-631: compare major then minor in SemanticVersion.compareTo - #636

Open
Ashlesha-17 wants to merge 3 commits into
weaviate:mainfrom
Ashlesha-17:feature/fix-semantic-version-compare
Open

Ashlesha-17 wants to merge 3 commits into
weaviate:mainfrom
Ashlesha-17:feature/fix-semantic-version-compare

Conversation

@Ashlesha-17

Copy link
Copy Markdown

Fixes #631

SemanticVersion.compareTo built an integer by concatenating major and minor
("%d%d"), so 1.32 became 132 and 2.0 became 20. Any 2.x server was therefore
treated as older than the 1.32 minimum and the client refused to connect.

This changes it to compare major first, then minor.

Tests: added cases to VersionSupportTest for 2.0.0, 2.5.1, 10.0.0, 1.100.0
and 1.31.9. Ran mvn test -Dtest=VersionSupportTest locally, all passing.

@orca-security-eu orca-security-eu Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot

Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@Ashlesha-17

Copy link
Copy Markdown
Author

I agree to the CLA.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The compareTo declaration and body in VersionSupport.java remain indented two spaces too deeply relative to the annotation and surrounding record members.

1 open issue
What changed in this PR

Fixes the Java client’s version compatibility check so newer major server releases are not rejected against the 1.32 minimum.

Changes:

  • Compares major versions first, then minor versions, while continuing to ignore patch versions.
  • Adds regression cases for major-version jumps, a three-digit minor version, and an unsupported older minor version.
File Description
src/​test/​java/​io/​weaviate/​client6/​v1/​internal/​VersionSupportTest.java Adds version-ordering regression cases.
src/​main/​java/​io/​weaviate/​client6/​v1/​internal/​VersionSupport.java Replaces concatenation with separate major and minor comparisons.

Review effort: Max

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Ashlesha-17

Copy link
Copy Markdown
Author

Thanks for the formatting fix! Let me know if anything else is needed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The tests lack a case rejecting actual version 1.99.0 against minimum 2.0.0, leaving the reverse direction of the concatenation bug uncovered.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Test lower actual major with a larger minor

src/​test/​java/​io/​weaviate/​client6/​v1/​internal/​VersionSupportTest.java:25

Optional: no case checks a lower actual major with a larger minor, such as minimum 2.0.0 and actual 1.99.0. Add that case with false to cover the reverse direction of the concatenation bug.

1 resolved since last review

Review effort: Max

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.

v6: VersionSupport rejects every 2.x server (major and minor are concatenated)

4 participants