Skip to content

Harden java-package validation across distributions - #1165

Merged
brunoborges merged 1 commit into
mainfrom
brunoborges-harden-java-package-contract
Jul 29, 2026
Merged

Harden java-package validation across distributions#1165
brunoborges merged 1 commit into
mainfrom
brunoborges-harden-java-package-contract

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:
java-package values were interpreted inconsistently across distributions, allowing typos to select a default artifact or fail only after cache or network work. This change introduces one typed capability registry and validates distribution, package, and Temurin JMOD version combinations before installer construction.

The same registry now drives table-based behavior tests and contract checks for action metadata, README guidance, the advanced compatibility table, and E2E package combinations. The published contract includes the JetBrains JCEF and FreeType variants, jdkfile is restricted to jdk, and the generated setup bundle is updated.

Related issue:
Fixes: #1164

Check list:

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 10b8fe1e-18f4-42cb-8672-11215715a713
Copilot AI review requested due to automatic review settings July 29, 2026 04:46
@brunoborges
brunoborges requested a review from a team as a code owner July 29, 2026 04:46
@brunoborges brunoborges added the maintenance Internal refactors/chore work label Jul 29, 2026
@brunoborges
brunoborges merged commit 19c23b3 into main Jul 29, 2026
444 checks passed
@brunoborges
brunoborges deleted the brunoborges-harden-java-package-contract branch July 29, 2026 04:50

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 centralizes and hardens java-package validation by introducing a single distribution→package capability registry, then using it to validate requested package types (and the Temurin jdk+jmods + version constraint) before installer selection. It also aligns the published action contract (action metadata + docs) and adds contract-style tests to keep docs, metadata, and E2E matrices consistent with the registry.

Changes:

  • Add JAVA_PACKAGE_CAPABILITIES + validateJavaPackage() and use it from getJavaDistribution().
  • Expand/clarify the published java-package contract in action.yml, README.md, and the advanced compatibility table.
  • Add contract and factory tests to ensure docs/metadata/E2E combinations match the registry, and to verify rejection/acceptance behavior.
Show a summary per file
File Description
src/distributions/package-types.ts Introduces the typed distribution/package registry and validation logic (including Temurin jdk+jmods version constraint).
src/distributions/distribution-factory.ts Calls centralized package validation before constructing an installer; removes the previous special-case jdk+jmods check.
README.md Updates java-package documentation to reflect all supported variants and points readers to the compatibility table.
docs/advanced-usage.md Updates the package compatibility section wording and clarifies jdkfile validation behavior.
action.yml Expands the java-package input description to include JetBrains variants and clarifies per-distribution support.
tests/java-package-contract.test.ts Adds contract tests to keep action.yml, README, advanced docs, and E2E matrices aligned with the registry.
tests/distributors/distribution-factory.test.ts Adds table-driven acceptance/rejection tests for package validation and Temurin jdk+jmods version gating.
dist/setup/index.js Updates the bundled distribution output to include the new package-types module and validation behavior.

Review details

Tip

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

Comments suppressed due to low confidence (1)

tests/java-package-contract.test.ts:72

  • The include: matrix parsing assumes distribution values are always single-quoted. YAML allows quoted or unquoted scalars, so this can miss valid entries and silently reduce coverage (future workflow edits could make the test pass while no longer validating all include rows).
    const includedPackages = workflow.matchAll(
      /- distribution: '([^']+)'\s*\n\s*java-package: ([^\s]+)/g
    );
  • Files reviewed: 7/8 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment on lines +57 to +59
const defaultMatrix = workflow.match(
/distribution:\s*\n\s*\[([^\]]+)\]\s*\n\s*java-package:\s*\['([^']+)'\]/
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Internal refactors/chore work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden the java-package contract across distributions

2 participants