Report concrete versions for floating Oracle JDK downloads - #1213
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes Oracle JDK and Oracle GraalVM “floating” (/latest/) downloads reporting and caching only the requested major version by deriving the concrete installed patch/build from the extracted JDK release metadata, and by binding floating resolution reuse to an immutable artifact identity (checksum).
Changes:
- Add
getJavaVersionFromReleaseFile()to read/normalize the concrete Java version from the extracted JDKreleasefile (including macOSContents/Homelayout). - For Oracle JDK and Oracle GraalVM
/latest/downloads, cache toolcache/JDK-cache entries under the concrete installed version and record floating resolution mappings keyed by authoritative artifact identity. - Update E2E + unit/regression tests to validate output correctness, cache identities, and behavior across successive floating artifacts.
Show a summary per file
| File | Description |
|---|---|
| src/util.ts | Adds release-file parsing + normalization to derive concrete installed Java versions. |
| src/jdk-resolution-cache.ts | Extends resolution identity to include immutable artifact identity (source) and persists floating safely. |
| src/distributions/oracle/installer.ts | Uses release metadata for floating installs and forces major-only stable requests through remote resolution. |
| src/distributions/graalvm/installer.ts | Same as Oracle JDK: concrete version from release file for floating installs + remote resolution for major-only Oracle GraalVM. |
| src/distributions/base-installer.ts | Adds floating-resolution restore/register flow keyed by artifact identity and integrates concrete-version validation for floating downloads. |
| .github/workflows/e2e-versions.yml | Extends E2E version verification to assert concrete output for floating Oracle/GraalVM major-only requests. |
| tests/verify-java.sh | Adds checks ensuring action output version matches installed Java, and requires concreteness for floating cases. |
| tests/util-install.test.ts | Adds unit coverage for release-file parsing/normalization including macOS layout. |
| tests/jdk-resolution-cache.test.ts | Adds coverage that different floating artifact identities produce distinct cache keys. |
| tests/distributors/oracle-installer.test.ts | Adds coverage for remote-resolution requirement (but currently contains a Jest structure bug). |
| tests/distributors/graalvm-installer.test.ts | Adds coverage for concrete caching of floating artifacts and remote-resolution requirement. |
| tests/distributors/base-installer.test.ts | Adds regression test ensuring two different floating artifacts under one major install/cache distinctly. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 12/19 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Oracle and Oracle GraalVM do not always publish a `.sha256` sibling next to a `/latest/` artifact. Those floating releases were excluded from both the resolution cache and the JDK cache, so `cache-jdk` users lost caching entirely for them. A floating URL is a constant string, so it cannot serve as a cache identity on its own — a stale entry would be reused forever. Instead, derive a validator from the headers of the HEAD request that already resolves the artifact: the ETag when present, otherwise `Last-Modified` combined with `Content-Length`. Republishing changes the validator, which changes the cache key, so a new build is downloaded rather than masked. `getJdkReleaseIdentity` now falls back to that fingerprint before the URL, and the floating cache gates ask whether the release has a stable identity (checksum or fingerprint) rather than a checksum specifically. A floating release with neither is still left uncached. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
I pushed one commit to this branch ( Context: I had a parallel implementation of #1212 and compared the two. Yours is the better design — preferring The one gap I wanted to close is the checksum-less case. Oracle and Oracle GraalVM don't always publish a The naive fix — falling back to the URL identity — doesn't work: a
Republishing changes the validator, which changes the key, so a new build is downloaded rather than masked. 41 suites / 1340 tests pass, along with format-check, lint, and a |
Closes #1212
Summary
releasemetadata for Oracle JDK and Oracle GraalVM/latest/downloadsdist/bundles with the repository CI toolchainValidation
dist/comparison: https://github.com/jdubois/setup-java/actions/runs/31010359757brace-expansion@5.0.9), so validation and bundle generation used the fork workflows as requestedbash -n __tests__/verify-java.shgit diff --check