From 3f5508c675e6c9efe037e114b80046feba4cd889 Mon Sep 17 00:00:00 2001 From: hatayama Date: Sun, 12 Jul 2026 01:10:40 +0900 Subject: [PATCH] fix: Show the uloop prefix on the dispatcher release summary The release PR collapsible summaries print release-please component ids, so the dispatcher row read "dispatcher: " while the project runner row already carried the uloop prefix through its component id. The body clarifier now renames the dispatcher summary to "uloop-dispatcher: ". The published-release label sync resolves release tags from these summaries, so it now accepts the renamed slug and still maps it to the dispatcher-v tag; the release-please component id and tag format stay untouched. --- .../internal/automation/release_pr_body.go | 31 ++++++++++++++++--- .../automation/release_pr_checks_test.go | 19 ++++++++++++ scripts/sync-published-release-pr-labels.sh | 2 +- .../test-sync-published-release-pr-labels.sh | 12 +++++++ 4 files changed, 58 insertions(+), 6 deletions(-) diff --git a/cli/release-automation/internal/automation/release_pr_body.go b/cli/release-automation/internal/automation/release_pr_body.go index 19e2ada2d..c95ba8b19 100644 --- a/cli/release-automation/internal/automation/release_pr_body.go +++ b/cli/release-automation/internal/automation/release_pr_body.go @@ -67,26 +67,47 @@ func clarifyReleasePRCheckComponentHeadingBlock(block string) (string, bool) { return block, false } - displayName, found := releasePRCheckComponentDisplayName(matches[1]) + component := matches[1] + version := matches[2] + changed := false + + if summarySlug, found := releasePRCheckComponentSummarySlug(component); found { + clarifiedSummary := "
" + summarySlug + ": " + version + "" + block = strings.Replace(block, matches[0], clarifiedSummary, 1) + changed = true + } + + displayName, found := releasePRCheckComponentDisplayName(component) if !found { - return block, false + return block, changed } - version := matches[2] heading := "## [" + version + "](" if !strings.Contains(block, heading) { - return block, false + return block, changed } clarifiedHeading := "## [" + displayName + " " + version + "](" return strings.Replace(block, heading, clarifiedHeading, 1), true } +// releasePRCheckComponentSummarySlug renames component summary labels whose +// release-please component id lacks the uloop prefix. The release tag keeps +// the bare component id, so consumers that resolve tags from summaries must +// also accept the renamed slug (see release_tag_from_body in +// scripts/sync-published-release-pr-labels.sh). +func releasePRCheckComponentSummarySlug(component string) (string, bool) { + if component == "dispatcher" { + return "uloop-dispatcher", true + } + return "", false +} + func releasePRCheckComponentDisplayName(component string) (string, bool) { switch component { case "unity-package": return "Unity Package", true - case "dispatcher": + case "dispatcher", "uloop-dispatcher": return "uloop Dispatcher", true case "uloop-project-runner": return "uloop Project Runner", true diff --git a/cli/release-automation/internal/automation/release_pr_checks_test.go b/cli/release-automation/internal/automation/release_pr_checks_test.go index ba0cba031..55d700bd0 100644 --- a/cli/release-automation/internal/automation/release_pr_checks_test.go +++ b/cli/release-automation/internal/automation/release_pr_checks_test.go @@ -79,6 +79,25 @@ func TestReleasePRCheckComponentHeadingsAreClarified(t *testing.T) { assertReleasePRCheckLogContains(t, clarifiedBody, "## [Unity Package 3.0.0-beta.48](https://example.test/compare/v3.0.0-beta.47...v3.0.0-beta.48) (2026-07-01)") assertReleasePRCheckLogContains(t, clarifiedBody, "## [uloop Dispatcher 3.0.1-beta.13](https://example.test/compare/dispatcher-v3.0.1-beta.12...dispatcher-v3.0.1-beta.13) (2026-07-11)") assertReleasePRCheckLogContains(t, clarifiedBody, "## [uloop Project Runner 3.0.0-beta.45](https://example.test/compare/uloop-project-runner-v3.0.0-beta.44...uloop-project-runner-v3.0.0-beta.45) (2026-07-01)") + assertReleasePRCheckLogContains(t, clarifiedBody, "
uloop-dispatcher: 3.0.1-beta.13") + assertReleasePRCheckLogContains(t, clarifiedBody, "
unity-package: 3.0.0-beta.48") + assertReleasePRCheckLogContains(t, clarifiedBody, "
uloop-project-runner: 3.0.0-beta.45") +} + +// Verifies an already clarified dispatcher block stays unchanged on a second clarification pass. +func TestReleasePRCheckClarifiedDispatcherBlockIsStable(t *testing.T) { + body := "
uloop-dispatcher: 3.0.1-beta.13\n\n" + + "## [uloop Dispatcher 3.0.1-beta.13](https://example.test/compare/dispatcher-v3.0.1-beta.12...dispatcher-v3.0.1-beta.13) (2026-07-11)\n" + + "
\n" + + clarifiedBody, changed := clarifyReleasePRCheckComponentLabels(body) + + if changed { + t.Fatal("expected clarified dispatcher block to stay unchanged") + } + if clarifiedBody != body { + t.Fatalf("expected body to stay unchanged, got:\n%s", clarifiedBody) + } } // Verifies that missing release PRs skip without dispatching checks. diff --git a/scripts/sync-published-release-pr-labels.sh b/scripts/sync-published-release-pr-labels.sh index 85cfa9891..3939a4415 100755 --- a/scripts/sync-published-release-pr-labels.sh +++ b/scripts/sync-published-release-pr-labels.sh @@ -24,7 +24,7 @@ release_tag_from_body() { "v" + $version elif $component == "uloop-project-runner" then "uloop-project-runner-v" + $version - elif $component == "dispatcher" then + elif $component == "dispatcher" or $component == "uloop-dispatcher" then "dispatcher-v" + $version else "" diff --git a/scripts/test-sync-published-release-pr-labels.sh b/scripts/test-sync-published-release-pr-labels.sh index 47df24a02..51e01f6e9 100755 --- a/scripts/test-sync-published-release-pr-labels.sh +++ b/scripts/test-sync-published-release-pr-labels.sh @@ -175,6 +175,17 @@ test_marks_dispatcher_component_summary_release_pr_from_body() { assert_contains "$TMP_DIR/dispatcher-component-summary/output.txt" "Marked release PR #1470 as tagged for dispatcher-v3.0.1-beta.12." } +# Verifies uloop-prefixed dispatcher summaries written by the release PR clarifier still resolve the dispatcher release tag. +test_marks_uloop_dispatcher_component_summary_release_pr_from_body() { + run_case uloop-dispatcher-component-summary \ + '[{"number":1696,"title":"chore: release v3-beta","body":"
uloop-dispatcher: 3.0.1-beta.13
","mergeCommit":{"oid":"abc123"}}]' \ + '{"dispatcher-v3.0.1-beta.13":{"isDraft":false,"targetCommitish":"abc123"}}' + + assert_file_equals "$TMP_DIR/uloop-dispatcher-component-summary/status.txt" "0" + assert_contains "$TMP_DIR/uloop-dispatcher-component-summary/gh.log" "release view dispatcher-v3.0.1-beta.13 --repo hatayama/unity-cli-loop --json isDraft,targetCommitish" + assert_contains "$TMP_DIR/uloop-dispatcher-component-summary/output.txt" "Marked release PR #1696 as tagged for dispatcher-v3.0.1-beta.13." +} + # Verifies component summaries take precedence over legacy numeric release titles. test_marks_project_runner_component_summary_release_pr_before_numeric_title() { run_case project-runner-component-before-title \ @@ -234,6 +245,7 @@ test_marks_stale_pending_release_pr test_marks_branch_title_release_pr_from_body test_marks_component_summary_release_pr_from_body test_marks_dispatcher_component_summary_release_pr_from_body +test_marks_uloop_dispatcher_component_summary_release_pr_from_body test_marks_project_runner_component_summary_release_pr_from_body test_marks_project_runner_component_summary_release_pr_before_numeric_title test_keeps_draft_release_pending