Skip to content

chore: Stabilize package release sync after native CLI publishing - #1252

Merged
hatayama merged 3 commits into
v3-betafrom
feature/hatayama/fix-release-please-race
Jun 1, 2026
Merged

chore: Stabilize package release sync after native CLI publishing#1252
hatayama merged 3 commits into
v3-betafrom
feature/hatayama/fix-release-please-race

Conversation

@hatayama

Copy link
Copy Markdown
Owner

Summary

  • Package release automation now waits for the matching native CLI release assets before continuing.
  • Native CLI publishing now retriggers release-please once the CLI release is ready, so the package release PR can be opened without manual reruns.

User Impact

  • Maintainers no longer have to manually rerun release-please when it starts before native CLI assets finish publishing.
  • Concurrent release workflow runs now reuse an already-created package release instead of failing nondeterministically.

Changes

  • Add a readiness wait for the matching CLI release before syncing package releases.
  • Dispatch release-please after native CLI publishing completes on push events.
  • Make package release creation safe when another workflow creates the same release first.
  • Extend release automation tests to cover readiness retries, workflow dispatch, and concurrent package release creation.

Verification

  • scripts/test-release-please-config.sh
  • scripts/test-native-cli-publish-workflow.sh
  • scripts/test-sync-release-please-package-releases.sh
  • git diff --check
  • ~/.codex/skills/codex-review/scripts/codex-review --parallel-tests "scripts/test-release-please-config.sh && scripts/test-native-cli-publish-workflow.sh && scripts/test-sync-release-please-package-releases.sh && git diff --check" v3-beta

hatayama added 2 commits May 31, 2026 22:54
Wait for CLI release assets before release-please package sync gives up, and dispatch release-please again after native CLI publish completes so package PR creation recovers from push-time workflow races.
Reuse a matching package release if another release automation run creates it after the initial missing-release check. This keeps the new release-please wait path from failing when the native CLI publish workflow reaches the same sync step at the same time.
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 026eda95-ade9-4913-8a68-d7ed9b16d673

📥 Commits

Reviewing files that changed from the base of the PR and between bcbb8d0 and 30a531c.

📒 Files selected for processing (2)
  • scripts/sync-release-please-package-releases.sh
  • scripts/test-sync-release-please-package-releases.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/test-sync-release-please-package-releases.sh

📝 Walkthrough

Walkthrough

Adds dispatch of release-please.yml from the native CLI publish workflow (with actions: write permission) and hardens package release sync by capturing release-create failures, polling for CLI release readiness, and extending tests for delayed assets and concurrent creation.

Changes

Native CLI Publish Workflow Dispatch

Layer / File(s) Summary
Workflow permissions and dispatch step
.github/workflows/native-cli-publish.yml
Job permissions are extended with actions: write. A new step dispatches release-please.yml after successful native CLI publish on push events when publish is enabled and not a dry run.
Dispatch workflow tests
scripts/test-native-cli-publish-workflow.sh
Permission test is updated to verify actions: write. New test case test_release_please_is_dispatched_after_publish validates the dispatch step's presence, conditional logic, TARGET_BRANCH parameter, and gh workflow run invocation.

Package Release Sync Robustness

Layer / File(s) Summary
Release creation error handling
scripts/sync-release-please-package-releases.sh
create_package_release now wraps gh release create with error capture and exit-code branching. On success it validates the release target commit and conditionally publishes drafts; on failure it inspects release JSON to detect concurrently created releases and emits captured errors or propagates statuses.
CLI release readiness polling
scripts/sync-release-please-package-releases.sh
New function wait_for_cli_release_ready polls cli_release_is_ready with configurable timeout and interval. Main flow switches from a single immediate check to polling and defers package sync (exits 0) if readiness times out.
Test mock infrastructure for timing and concurrency
scripts/test-sync-release-please-package-releases.sh
Mocked gh release view supports delayed "release found" via CLI_RELEASE_READY_AFTER_ATTEMPTS. Mocked gh release create simulates concurrent creation by touching a marker and failing subsequent attempts. Mocked sleep logs waits.
Test harness parameters and new test cases
scripts/test-sync-release-please-package-releases.sh
run_sync signature expands to accept timing, retry, and concurrency parameters and wires them into the script under test. Adds tests verifying retry-until-native-assets-ready and reuse of concurrently created root package releases.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#1104: Modifies scripts/sync-release-please-package-releases.sh and tests to gate package sync on native CLI release readiness and adds related test coverage.
  • hatayama/unity-cli-loop#1036: Related changes to dispatching release-please.yml with a target branch/ref and resolving that input in release-please.yml.
  • hatayama/unity-cli-loop#1244: Related updates to release-please.yml and permission/dispatch behavior that pair with this PR's dispatch and permission changes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% 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 summarizes the main change: stabilizing package release sync after native CLI publishing, which is the primary objective of the PR.
Description check ✅ Passed The description is directly related to the changeset, providing a clear summary of changes, user impact, and verification steps that align with the modifications made.
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 feature/hatayama/fix-release-please-race

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.

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

1 issue found across 4 files

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

Re-trigger cubic

Comment thread scripts/sync-release-please-package-releases.sh Outdated
@hatayama hatayama closed this May 31, 2026
@hatayama hatayama reopened this May 31, 2026
Avoid hammering GitHub release polling when the configured wait interval is non-positive by sleeping for the clamped one-second retry delay.
@hatayama
hatayama merged commit 1cb6526 into v3-beta Jun 1, 2026
5 checks passed
@hatayama
hatayama deleted the feature/hatayama/fix-release-please-race branch June 1, 2026 01:03
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