Skip to content

Handle early dependency cache failures during Java setup - #1226

Merged
brunoborges merged 5 commits into
actions:mainfrom
jdubois:jdubois-fix-cache-restore-promise
Aug 7, 2026
Merged

Handle early dependency cache failures during Java setup#1226
brunoborges merged 5 commits into
actions:mainfrom
jdubois:jdubois-fix-cache-restore-promise

Conversation

@jdubois

Copy link
Copy Markdown
Contributor

Description:
Validate dependency cache providers before Java distribution installation, and attach rejection handling to cache restoration immediately while it continues to overlap JDK setup. Reconcile the settled cache result after setup so Java/configuration errors retain precedence and cache failures are reported through core.setFailed when setup succeeds.

Regenerate the setup and cleanup bundles for the shared cache validation path.

Related issue:
Fixes#1223

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Documentation changes are not required.
  • Tests were added or updated to cover the changes.

Validate dependency cache providers before Java installation and settle cache restore failures immediately while preserving setup error precedence.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI lite review requested due to automatic review settings August 6, 2026 08:17
@jdubois
jdubois requested a review from a team as a code ownerAugust 6, 2026 08:17

CopilotAI 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.

Pull request overview

This PR improves actions/setup-java orchestration by preventing early dependency-cache restore failures (including invalid cache provider inputs) from causing unhandled promise rejections, while ensuring Java setup/configuration failures keep precedence over cache failures.

Changes:

  • Validate the dependency cache provider earlier via a shared validatePackageManager path.
  • Convert cache restore to an immediately-handled “settled” promise to avoid unhandled rejections while it overlaps JDK installation.
  • Add/extend unit tests covering early invalid cache input failures and early cache restore rejection handling.
Show a summary per file
FileDescription
src/setup-java.tsValidates cache provider earlier and wraps cache restore in a settled promise to prevent unhandled rejections while preserving setup error precedence.
src/cache.tsExposes validatePackageManager to share cache-provider validation logic.
dist/setup/index.jsRegenerated bundle reflecting the new setup orchestration and settled cache restore handling.
dist/setup/377.index.jsRegenerated module bundle exporting validatePackageManager.
dist/cleanup/377.index.jsRegenerated cleanup bundle reflecting shared cache validation export.
tests/setup-java.test.tsAdds tests for invalid cache inputs failing before distribution resolution and for early cache restore rejection handling without unhandled rejections.
tests/cache.test.tsAdds direct tests for validatePackageManager behavior.

Review details

Tip

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

  • Files reviewed: 4/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment threadsrc/setup-java.ts Outdated
brunoborges
brunoborges previously approved these changes Aug 6, 2026
@brunoborgesbrunoborges self-assigned this Aug 6, 2026
@brunoborgesbrunoborges added the maintenance Internal refactors/chore work label Aug 6, 2026
brunoborgesand others added 3 commits August 6, 2026 11:49
Reject the cache restore only after it has started and while the Java
installation is still pending, instead of relying on event-loop timing.
Verified the test fails against the pre-fix implementation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the package-manager validation out of the top of run() so that
missing java-version/java-version-file and toolchain id errors keep
their original precedence. Validation now happens immediately before
the cache restore is started, which still fails fast before any JDK
download.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@brunoborges
brunoborges merged commit d17a685 into actions:mainAug 7, 2026
81 of 84 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenanceInternal refactors/chore work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle early dependency cache failures during Java setup

3 participants

@jdubois@brunoborges