Skip to content

fix: Setup now installs CLI releases that match the required protocol#1340

Merged
hatayama merged 7 commits into
v3-betafrom
fix/protocol
Jun 15, 2026
Merged

fix: Setup now installs CLI releases that match the required protocol#1340
hatayama merged 7 commits into
v3-betafrom
fix/protocol

Conversation

@hatayama

@hatayama hatayama commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Setup now points at a published CLI release that advertises the protocol required by the Unity package.
  • Protocol bump PRs now fail and receive a PR comment until the selected minimum CLI release is published and installable.

User Impact

  • Older package builds could require a newer protocol while Setup still installed an older CLI release, causing CLI/Unity protocol mismatches.
  • Future protocol bumps should be caught during PR review before users receive a package that installs an incompatible CLI.

Changes

  • Bump the package minimum CLI release to 3.0.0-beta.33.
  • Add a protocol minimum-version guard and PR comment workflow.
  • Verify selected CLI releases against published GitHub Release assets and release-tagged protocol metadata.
  • Validate release backfills against the resolved release commit instead of the current checkout.
  • Update release automation and policy docs to match the new protocol bump process.

Verification

  • scripts/check-go-cli.sh
  • cd cli && go test ./internal/automation ./cmd/check-protocol-minimum-version ./cmd/comment-protocol-minimum-version
  • sh scripts/test-protocol-minimum-version-workflow.sh && sh scripts/test-sync-release-please-package-releases.sh && sh scripts/test-native-cli-publish-workflow.sh && sh scripts/test-release-please-config.sh
  • cd cli && go run ./cmd/check-protocol-minimum-version --base origin/v3-beta --head HEAD
  • cd cli && go run ./cmd/check-protocol-minimum-version --verify-release
  • Unity compile completed with 0 errors and 0 warnings
  • $codex-review v3-beta --parallel-tests "scripts/check-go-cli.sh"

Review in cubic

hatayama added 6 commits June 15, 2026 10:39
Ensure Unity setup installs the published CLI release that advertises the required IPC protocol, and add PR/release automation so future protocol bumps cannot leave the installer target stale.
Update the repository guidance and CodeRabbit instructions to match the new protocol bump policy: PRs that change the required protocol must also advance the minimum CLI version to a published CLI release that advertises that protocol.
Ensure protocol bump PRs only pass after the selected minimum CLI release tag advertises the required protocol. Keep the PR warning comment open for mismatched release tags instead of clearing it when the version string merely changes.
Refresh the selected CLI release tag after the release readiness wait, so package release sync can verify protocol metadata even when the tag was created after the initial fetch.
Run the minimum CLI release protocol check whenever the installer target changes, even if the required protocol constant is unchanged. Use the PR merge ref for warning comments so stale branches are compared as GitHub will test them.
Validate protocol minimum targets against published GitHub releases with complete native CLI assets, and verify package-release backfills against the resolved release commit instead of the current checkout.
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Go-based protocol minimum version guard system with two CLI entrypoints, a PR comment automation tool, new CI workflows (protocol-minimum-version-warning, updates to build-and-test, release-please, native-cli-publish), and release sync script integration to enforce MINIMUM_REQUIRED_CLI_VERSION updates when CLI protocol changes. Also bumps MINIMUM_REQUIRED_CLI_VERSION to 3.0.0-beta.33.

Changes

Protocol Minimum Version Guard & Automation

Layer / File(s) Summary
Guard types, parsing, analysis, and verification logic
cli/internal/automation/protocol_minimum_version_guard.go
Defines ProtocolMinimumVersionGuardConfig, ProtocolMinimumVersionValues, ProtocolMinimumVersionGuardResult; implements ParseProtocolMinimumVersionValues, AnalyzeProtocolMinimumVersionGuard, AnalyzeProtocolMinimumVersionGuardForRefs, VerifyMinimumCliReleaseProtocol, release-published verification (draft check, asset presence), FormatProtocolMinimumVersionWarning, and ref/command helpers using git show and gh release view.
CLI entrypoints
cli/cmd/check-protocol-minimum-version/main.go, cli/cmd/comment-protocol-minimum-version/main.go
check-protocol-minimum-version dispatches to RunProtocolMinimumVersionGuard or RunMinimumCliReleaseProtocolCheck based on --verify-release; comment-protocol-minimum-version calls RunProtocolMinimumVersionComment and exits with its status code.
PR comment automation
cli/internal/automation/protocol_minimum_version_comment.go
Implements RunProtocolMinimumVersionComment: reads env config, analyzes guard conditions, upserts or deletes a marker-identified PR comment via gh api with paginated discovery and temp-file body writing.
CI workflows
.github/workflows/protocol-minimum-version-warning.yml, .github/workflows/build-and-test.yml, .github/workflows/release-please.yml, .github/workflows/native-cli-publish.yml
Adds protocol-minimum-version-warning workflow (pull_request_target); adds Check protocol minimum version bump step to build-and-test; adds Setup Go for package release sync to release-please; broadens Setup Go condition in native-cli-publish to include release == true.
Release sync integration
scripts/sync-release-please-package-releases.sh
Adds fetch_cli_release_tag and verify_minimum_cli_release_protocol helpers; calls them to fetch the CLI tag ref and verify protocol before publishing draft or creating new package releases.
Go tests for guard and comment automation
cli/internal/automation/protocol_minimum_version_guard_test.go
Covers AnalyzeProtocolMinimumVersionGuard, RunProtocolMinimumVersionGuard (mismatch, draft, missing assets), VerifyMinimumCliReleaseProtocol, RunMinimumCliReleaseProtocolCheck, and RunProtocolMinimumVersionComment using mock git/gh scripts.
Shell test scripts
scripts/test-protocol-minimum-version-workflow.sh, scripts/test-sync-release-please-package-releases.sh, scripts/test-native-cli-publish-workflow.sh, scripts/test-release-please-config.sh
New test-protocol-minimum-version-workflow.sh asserts CI workflow contents; sync test adds go mock, CLI tag setup, and protocol-check assertions; native-CLI publish test adds Go setup order check; release-please config test asserts Setup Go for package release sync step presence.
Version bump and docs
Packages/src/Editor/Domain/CliConstants.cs, AGENTS.md, .coderabbit.yaml
Bumps MINIMUM_REQUIRED_CLI_VERSION from 3.0.0-beta.32 to 3.0.0-beta.33; updates protocol mismatch guidance in AGENTS.md; refines .coderabbit.yaml protocol-bump instructions.

Sequence Diagram(s)

sequenceDiagram
  participant PR as Pull Request
  participant BuildAndTest as build-and-test
  participant WarningWorkflow as protocol-minimum-version-warning
  participant CheckCmd as check-protocol-minimum-version
  participant CommentCmd as comment-protocol-minimum-version
  participant GhAPI as GitHub API / gh CLI

  rect rgba(173, 216, 230, 0.5)
    note over PR, GhAPI: PR guard (fails if MINIMUM_REQUIRED_CLI_VERSION not updated)
    PR->>BuildAndTest: pull_request event
    BuildAndTest->>CheckCmd: go run (GH_TOKEN, base/head refs)
    CheckCmd->>CheckCmd: AnalyzeProtocolMinimumVersionGuardForRefs
    CheckCmd->>GhAPI: gh release view (verify published + assets)
    CheckCmd-->>BuildAndTest: exit 0 (pass) or exit 1 (fail)
  end

  rect rgba(255, 228, 181, 0.5)
    note over PR, GhAPI: PR comment automation (pull_request_target, trusted)
    PR->>WarningWorkflow: pull_request_target event
    WarningWorkflow->>WarningWorkflow: checkout + fetch PR merge ref
    WarningWorkflow->>CommentCmd: go run (GITHUB_TOKEN, base/head refs)
    CommentCmd->>GhAPI: list PR comments (paginated)
    CommentCmd->>GhAPI: PATCH/POST/DELETE comment
    CommentCmd-->>WarningWorkflow: done
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#1250: Also modifies CliConstants.MINIMUM_REQUIRED_CLI_VERSION in Packages/src/Editor/Domain/CliConstants.cs to advance the minimum CLI release version.
  • hatayama/unity-cli-loop#1300: Updates CliConstants.MINIMUM_REQUIRED_CLI_VERSION alongside cliVersion, directly connected to the version constant this PR's guard automation reads and validates.
  • hatayama/unity-cli-loop#1104: Extends the same scripts/sync-release-please-package-releases.sh release-sync logic by adding fetch_cli_release_tag and protocol verification helpers that build on prior release-sync infrastructure.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.41% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: Setup now installs CLI releases matching the required protocol version, which is the main objective of this PR.
Description check ✅ Passed The description is detailed and directly related to the changeset, explaining the problem, changes, and verification steps. It comprehensively covers the PR's objectives including protocol alignment, guard implementation, and release automation updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/protocol

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/protocol-minimum-version-warning.yml:
- Around line 17-20: The checkout action in the "Checkout base repository" step
does not disable credential persistence, which unnecessarily exposes the
authentication token to later workflow steps in this privileged
pull_request_target job. Add the `persist-credentials: false` parameter to the
`with` section of the actions/checkout action to prevent the token from being
stored in the local git config.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0ac6d330-6978-443e-b035-af94ae7d2563

📥 Commits

Reviewing files that changed from the base of the PR and between 812cd9d and ad13b08.

📒 Files selected for processing (17)
  • .coderabbit.yaml
  • .github/workflows/build-and-test.yml
  • .github/workflows/native-cli-publish.yml
  • .github/workflows/protocol-minimum-version-warning.yml
  • .github/workflows/release-please.yml
  • AGENTS.md
  • Packages/src/Editor/Domain/CliConstants.cs
  • cli/cmd/check-protocol-minimum-version/main.go
  • cli/cmd/comment-protocol-minimum-version/main.go
  • cli/internal/automation/protocol_minimum_version_comment.go
  • cli/internal/automation/protocol_minimum_version_guard.go
  • cli/internal/automation/protocol_minimum_version_guard_test.go
  • scripts/sync-release-please-package-releases.sh
  • scripts/test-native-cli-publish-workflow.sh
  • scripts/test-protocol-minimum-version-workflow.sh
  • scripts/test-release-please-config.sh
  • scripts/test-sync-release-please-package-releases.sh

Comment thread .github/workflows/protocol-minimum-version-warning.yml

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 17 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/sync-release-please-package-releases.sh Outdated
Comment thread cli/internal/automation/protocol_minimum_version_guard.go
Comment thread cli/internal/automation/protocol_minimum_version_comment.go Outdated
Comment thread .github/workflows/protocol-minimum-version-warning.yml
Ensure privileged PR warning workflows do not persist checkout credentials, require draft package releases to be protocol-verified before publishing, and scope automation comment updates to the workflow bot author.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
scripts/test-sync-release-please-package-releases.sh (1)

244-244: 💤 Low value

Consider parameterizing the CLI release tag in the origin push.

The tag ref is hardcoded to cli-v3.0.0-beta.6. If a future test needs to call prepare_origin_branch with a different CLI_RELEASE_TAG, the hardcoded tag would be incorrect. Current tests don't exercise this path, so it's not a bug today.

♻️ Optional refactor to use CLI_RELEASE_TAG
-    git push -q origin "$commit_sha:refs/heads/$branch_name" refs/tags/cli-v3.0.0-beta.6
+    git push -q origin "$commit_sha:refs/heads/$branch_name" "refs/tags/${CLI_RELEASE_TAG:-cli-v3.0.0-beta.6}"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test-sync-release-please-package-releases.sh` at line 244, The git
push command in the script hardcodes the tag reference as `cli-v3.0.0-beta.6`
instead of using the parameterized `CLI_RELEASE_TAG` variable. Replace the
hardcoded tag `cli-v3.0.0-beta.6` with `$CLI_RELEASE_TAG` in the refs/tags
portion of the git push command to make the tag configurable for future tests
that may use different CLI release tags.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/test-sync-release-please-package-releases.sh`:
- Line 244: The git push command in the script hardcodes the tag reference as
`cli-v3.0.0-beta.6` instead of using the parameterized `CLI_RELEASE_TAG`
variable. Replace the hardcoded tag `cli-v3.0.0-beta.6` with `$CLI_RELEASE_TAG`
in the refs/tags portion of the git push command to make the tag configurable
for future tests that may use different CLI release tags.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 25e456c4-50b8-4204-a608-0cccaa008c89

📥 Commits

Reviewing files that changed from the base of the PR and between ad13b08 and dbec43f.

📒 Files selected for processing (7)
  • .github/workflows/protocol-minimum-version-warning.yml
  • cli/internal/automation/protocol_minimum_version_comment.go
  • cli/internal/automation/protocol_minimum_version_guard.go
  • cli/internal/automation/protocol_minimum_version_guard_test.go
  • scripts/sync-release-please-package-releases.sh
  • scripts/test-protocol-minimum-version-workflow.sh
  • scripts/test-sync-release-please-package-releases.sh
🚧 Files skipped from review as they are similar to previous changes (5)
  • scripts/test-protocol-minimum-version-workflow.sh
  • scripts/sync-release-please-package-releases.sh
  • .github/workflows/protocol-minimum-version-warning.yml
  • cli/internal/automation/protocol_minimum_version_guard.go
  • cli/internal/automation/protocol_minimum_version_guard_test.go

@hatayama
hatayama merged commit 91cca52 into v3-beta Jun 15, 2026
9 checks passed
@hatayama
hatayama deleted the fix/protocol branch June 15, 2026 04:27
@github-actions github-actions Bot mentioned this pull request Jun 15, 2026
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.

1 participant