Skip to content

Prefer Zulu 4-segment hotfix builds when resolving version ranges - #1278

Merged
brunoborges merged 1 commit into
mainfrom
brunoborges-zulu-sdkmanrc-hotfix-builds
Oct 2, 2026
Merged

brunoborges merged 1 commit into
mainfrom
brunoborges-zulu-sdkmanrc-hotfix-builds

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:
Azul publishes out-of-band hotfix builds with a 4-segment java_version. For example, zulu25.36.205-ca-jdk25.0.4.1 has java_version=[25,0,4,1] and openjdk_build_number=1. SDKMAN calls this build 25.0.4+1.1.

Since the v6 Azul Metadata API migration, an exact 25.0.4+1.1 request (for example from .sdkmanrc java=25.0.4+1.1-zulu) already resolves. The failure in the issue came from a pinned pre-v6 commit that dropped the build number.

There was still a bug with version ranges. Candidates were sorted with semver.compareBuild, which compares the text after + and ranks 25.0.4+7 above 25.0.4+1.1. As a result, 25 or 25.0.4 resolved to the older GA build instead of the newer 25.0.4.1 hotfix.

This PR sorts Zulu candidates numerically by:

  1. java_version (a missing segment counts as 0)
  2. openjdk_build_number
  3. distro_version, which stays the tie-breaker

The version strings themselves are unchanged, so exact matching and toolcache folder names behave the same.

Toolcache lookup of already-cached versions may have a similar ordering issue. It is not addressed here.

Related issue:
Fixes: #1275

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
    • Not run in full. Targeted jest runs of __tests__/distributors/zulu-installer.test.ts and __tests__/util.test.ts passed (284 tests).
    • npm run build passed. ESLint on the changed source and Zulu test file was clean.
    • The pre-commit hook ran prettier and eslint on the staged files.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes. Two of the new Zulu tests fail without the fix.

Azul reports hotfix releases like 25.0.4.1 as java_version=[25,0,4,1]
with openjdk_build_number=1 (SDKMAN '25.0.4+1.1'). Sorting candidates via
semver.compareBuild ranked 25.0.4+7 above 25.0.4+1.1, so ranges such as
'25' resolved to the older build. Compare java_version, build number and
distro_version numerically instead.

Fixes: #1275

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@brunoborges
brunoborges requested a review from a team as a code owner October 2, 2026 03:49
Copilot AI balanced review requested due to automatic review settings October 2, 2026 03:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused implementation matches the documented ordering requirements and includes regression coverage for exact and ranged versions.

Review effort: Balanced
Findings: None

What changed in this PR

Updates Zulu version resolution so range requests prefer newer four-segment hotfix builds.

Changes:

  • Sorts candidates numerically by Java version, build number, then distro version.
  • Adds coverage for exact and ranged hotfix resolution.
  • Rebuilds the runtime bundle.
File Description
src/​distributions/​zulu/​installer.ts Implements numeric candidate ordering.
dist/​setup/​978.index.js Updates the generated runtime bundle.
__tests__/​util.test.ts Covers SDKMAN Zulu version parsing.
__tests__/​distributors/​zulu-installer.test.ts Tests hotfix selection behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@brunoborges
brunoborges merged commit 74920aa into main Oct 2, 2026
83 of 86 checks passed
@brunoborges
brunoborges deleted the brunoborges-zulu-sdkmanrc-hotfix-builds branch October 2, 2026 04:07
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.

Unable to use 25.0.4+1.1-zulu via .sdkmanrc

2 participants