Skip to content

Handle early dependency cache failures during Java setup - #1226

Open
jdubois wants to merge 1 commit into
actions:mainfrom
jdubois:jdubois-fix-cache-restore-promise
Open

Handle early dependency cache failures during Java setup#1226
jdubois wants to merge 1 commit into
actions:mainfrom
jdubois:jdubois-fix-cache-restore-promise

Conversation

@jdubois

@jdubois jdubois commented Aug 6, 2026

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>
Copilot AI lite review requested due to automatic review settings August 6, 2026 08:17
@jdubois
jdubois requested a review from a team as a code owner August 6, 2026 08:17

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.

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
File Description
src/setup-java.ts Validates cache provider earlier and wraps cache restore in a settled promise to prevent unhandled rejections while preserving setup error precedence.
src/cache.ts Exposes validatePackageManager to share cache-provider validation logic.
dist/setup/index.js Regenerated bundle reflecting the new setup orchestration and settled cache restore handling.
dist/setup/377.index.js Regenerated module bundle exporting validatePackageManager.
dist/cleanup/377.index.js Regenerated cleanup bundle reflecting shared cache validation export.
tests/setup-java.test.ts Adds tests for invalid cache inputs failing before distribution resolution and for early cache restore rejection handling without unhandled rejections.
tests/cache.test.ts Adds 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 thread src/setup-java.ts
Comment on lines +44 to +47
if (cache) {
const {validatePackageManager} = await import('./cache.js');
validatePackageManager(cache);
}
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.

Handle early dependency cache failures during Java setup

2 participants