Skip to content

Add CLI minimum-version compatibility guard #1200

Description

@hatayama

Problem

The Unity package and the native CLI intentionally use separate version lines:

  • Packages/src/Cli~/contract.json declares the latest bundled CLI contract version.
  • CliConstants.MINIMUM_REQUIRED_CLI_VERSION declares the oldest CLI version the Unity package accepts.

Because those values are intentionally allowed to differ, CI must not enforce minimum == latest.

However, compatibility-sensitive changes can still require raising MINIMUM_REQUIRED_CLI_VERSION. It is easy to forget that check when changing CLI behavior, Editor/CLI contracts, readiness flows, or installer/update behavior.

Proposal

Add a lightweight compatibility guard that makes the minimum CLI version decision explicit.

The guard should:

  • Verify MINIMUM_REQUIRED_CLI_VERSION is not greater than the latest CLI contract version.
  • Detect compatibility-sensitive changes where keeping the existing minimum version needs an explicit decision.
  • Allow older minimum versions when they are intentional and documented.
  • Avoid forcing every CLI release to become the new Unity package minimum.

One possible design is a small decision file, for example:

{
  "minimumRequiredCliVersion": "3.0.0-beta.9",
  "decision": "keep",
  "reason": "The changed CLI behavior is additive and older CLIs still satisfy the Editor contract."
}

If the package truly depends on newer CLI behavior, the fix should be to raise CliConstants.MINIMUM_REQUIRED_CLI_VERSION and update the focused tests instead of adding a keep decision.

Acceptance Criteria

  • CI fails if MINIMUM_REQUIRED_CLI_VERSION is greater than the latest CLI contract version.
  • CI does not fail just because MINIMUM_REQUIRED_CLI_VERSION is lower than the latest CLI contract version.
  • CI fails for compatibility-sensitive changes when neither the minimum version nor an explicit keep decision is updated.
  • The keep-decision path requires a short reason so the compatibility judgment is reviewable.
  • The guard is covered by focused tests.

Context

PR #1199 needed a follow-up correction because the Unity package minimum CLI version still accepted older CLIs after the readiness flow stopped depending on server-state files.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions