From 2456889f98c639a0d83c7eaa7aea2ded17275fff Mon Sep 17 00:00:00 2001 From: Ke Bao Date: Tue, 31 Mar 2026 17:31:55 +0800 Subject: [PATCH] Rename rerun-ut to rerun-test (#21747) --- .claude/skills/ci-workflow-guide/SKILL.md | 2 +- .../{rerun-ut.yml => rerun-test.yml} | 8 ++-- .github/workflows/slash-command-handler.yml | 2 +- scripts/ci/utils/slash_command_handler.py | 44 +++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-) rename .github/workflows/{rerun-ut.yml => rerun-test.yml} (88%) diff --git a/.claude/skills/ci-workflow-guide/SKILL.md b/.claude/skills/ci-workflow-guide/SKILL.md index 6e2697742..430f5a306 100644 --- a/.claude/skills/ci-workflow-guide/SKILL.md +++ b/.claude/skills/ci-workflow-guide/SKILL.md @@ -381,6 +381,6 @@ group: pr-test-{event_name}-{branch}-{pr_sha}-{stage} | `/rerun-failed-ci` | Reruns failed jobs in the latest workflow run | | `/tag-and-rerun-ci` | Adds label + reruns | | `/rerun-stage ` | Dispatches `pr-test.yml` with `target_stage=` | -| `/rerun-ut ` | Reruns a specific test file via `rerun-ut.yml` | +| `/rerun-test ` | Reruns a specific test file via `rerun-test.yml` | Handled by `scripts/ci/utils/slash_command_handler.py` → `.github/workflows/slash-command-handler.yml`. diff --git a/.github/workflows/rerun-ut.yml b/.github/workflows/rerun-test.yml similarity index 88% rename from .github/workflows/rerun-ut.yml rename to .github/workflows/rerun-test.yml index 8cb6fc1a1..41531ed36 100644 --- a/.github/workflows/rerun-ut.yml +++ b/.github/workflows/rerun-test.yml @@ -1,5 +1,5 @@ -name: Rerun UT -run-name: ${{ inputs.pr_head_sha && format('[rerun-ut] {0} {1}', inputs.test_command, inputs.pr_head_sha) || format('[rerun-ut] {0}', inputs.test_command) }} +name: Rerun Test +run-name: ${{ inputs.pr_head_sha && format('[rerun-test] {0} {1}', inputs.test_command, inputs.pr_head_sha) || format('[rerun-test] {0}', inputs.test_command) }} on: workflow_dispatch: @@ -23,7 +23,7 @@ on: - 8-gpu-h20 - 8-gpu-b200 pr_head_sha: - description: "PR head SHA to checkout (for /rerun-ut on fork PRs)" + description: "PR head SHA to checkout (for /rerun-test on fork PRs)" required: false type: string default: "" @@ -44,7 +44,7 @@ permissions: issues: read jobs: - rerun-ut-cuda: + rerun-test-cuda: runs-on: ${{ inputs.runner_label }} timeout-minutes: 120 env: diff --git a/.github/workflows/slash-command-handler.yml b/.github/workflows/slash-command-handler.yml index 9411e0798..ea91c75f7 100644 --- a/.github/workflows/slash-command-handler.yml +++ b/.github/workflows/slash-command-handler.yml @@ -20,7 +20,7 @@ jobs: contains(github.event.comment.body, '/rerun-failed-ci') || contains(github.event.comment.body, '/tag-and-rerun-ci') || contains(github.event.comment.body, '/rerun-stage') || - contains(github.event.comment.body, '/rerun-ut')) + contains(github.event.comment.body, '/rerun-test')) runs-on: ubuntu-latest steps: diff --git a/scripts/ci/utils/slash_command_handler.py b/scripts/ci/utils/slash_command_handler.py index 6875d88fc..a62139494 100644 --- a/scripts/ci/utils/slash_command_handler.py +++ b/scripts/ci/utils/slash_command_handler.py @@ -45,7 +45,7 @@ def find_workflow_run_url( The workflow run URL if found, None otherwise. """ # Build expected display_title based on workflow's run-name. - # rerun-ut includes test_command: "[rerun-ut] []" + # rerun-test includes test_command: "[rerun-test] []" # Other workflows: "[stage-name] []" suffix = f" {test_command}" if test_command else "" if pr_head_sha: @@ -464,7 +464,7 @@ def resolve_test_file(file_part): return None, ( f"Ambiguous filename `{file_part}` — matched {len(matches)} files:\n\n" f"{match_list}\n\n" - f"Please provide the full path, e.g. `/rerun-ut {matches[0]}`" + f"Please provide the full path, e.g. `/rerun-test {matches[0]}`" ) return matches[0][len("test/") :], None @@ -553,7 +553,7 @@ def _resolve_and_dispatch_ut(gh_repo, pr, test_spec, token): ) try: - workflow_name = "Rerun UT" + workflow_name = "Rerun Test" workflows = gh_repo.get_workflows() target_workflow = None for wf in workflows: @@ -610,13 +610,13 @@ def _resolve_and_dispatch_ut(gh_repo, pr, test_spec, token): "error": f"Dispatch failed: {dispatch_resp.status_code}", } - print(f"Successfully triggered rerun-ut: {test_command}") + print(f"Successfully triggered rerun-test: {test_command}") run_url = find_workflow_run_url( gh_repo, target_workflow.id, ref, - "rerun-ut", + "rerun-test", token, dispatch_time, pr_head_sha=pr_head_sha, @@ -632,16 +632,16 @@ def _resolve_and_dispatch_ut(gh_repo, pr, test_spec, token): } except Exception as e: - print(f"Error triggering rerun-ut for {test_spec}: {e}") + print(f"Error triggering rerun-test for {test_spec}: {e}") return {"spec": test_spec, "success": False, "error": str(e)} -def handle_rerun_ut(gh_repo, pr, comment, user_perms, test_specs, token): +def handle_rerun_test(gh_repo, pr, comment, user_perms, test_specs, token): """ - Handles the /rerun-ut command. Accepts a list of test specs and dispatches + Handles the /rerun-test command. Accepts a list of test specs and dispatches a workflow run for each, posting a single consolidated comment. """ - # SECURITY: For fork PRs, only allow /rerun-ut if the commenter has write+ permission. + # SECURITY: For fork PRs, only allow /rerun-test if the commenter has write+ permission. # This command checks out and executes code from the PR branch on self-hosted GPU # runners, so we must ensure the commenter is a trusted collaborator. is_fork = pr.head.repo is None or pr.head.repo.owner.login != gh_repo.owner.login @@ -649,10 +649,10 @@ def handle_rerun_ut(gh_repo, pr, comment, user_perms, test_specs, token): commenter = comment.user.login perm = gh_repo.get_collaborator_permission(commenter) if perm not in ("admin", "write"): - print(f"Permission denied: /rerun-ut on fork PR by {commenter}.") + print(f"Permission denied: /rerun-test on fork PR by {commenter}.") comment.create_reaction("confused") pr.create_issue_comment( - "❌ `/rerun-ut` is not available for fork PRs unless the commenter " + "❌ `/rerun-test` is not available for fork PRs unless the commenter " "has write permission on the repo.\n\n" "Please ask a maintainer to run this command, or use the normal CI flow." ) @@ -660,21 +660,21 @@ def handle_rerun_ut(gh_repo, pr, comment, user_perms, test_specs, token): print(f"Fork PR, but commenter {commenter} has write+ permission. Proceeding.") if not ( - user_perms.get("can_rerun_ut", False) + user_perms.get("can_rerun_test", False) or user_perms.get("can_rerun_stage", False) ): - print("Permission denied: neither can_rerun_ut nor can_rerun_stage is true.") + print("Permission denied: neither can_rerun_test nor can_rerun_stage is true.") return False if not test_specs: comment.create_reaction("confused") pr.create_issue_comment( - "❌ Please specify a test: `/rerun-ut ::`\n\n" + "❌ Please specify a test: `/rerun-test ::`\n\n" "Examples:\n" - "- `/rerun-ut test/registered/core/test_srt_endpoint.py::TestSRTEndpoint.test_simple_decode`\n" - "- `/rerun-ut registered/core/test_srt_endpoint.py::TestSRTEndpoint`\n" - "- `/rerun-ut test_srt_endpoint.py`\n" - "- `/rerun-ut test_a.py test_b.py test_c.py` (multiple tests)" + "- `/rerun-test test/registered/core/test_srt_endpoint.py::TestSRTEndpoint.test_simple_decode`\n" + "- `/rerun-test registered/core/test_srt_endpoint.py::TestSRTEndpoint`\n" + "- `/rerun-test test_srt_endpoint.py`\n" + "- `/rerun-test test_a.py test_b.py test_c.py` (multiple tests)" ) return False @@ -737,7 +737,7 @@ def main(): # PR authors can always rerun failed CI and rerun individual UTs on their own PRs, # even if they are not listed in CI_PERMISSIONS.json. # Note: /tag-run-ci-label and /rerun-stage still require CI_PERMISSIONS.json. - # Note: /rerun-ut is blocked entirely for fork PRs in handle_rerun_ut() itself. + # Note: /rerun-test is blocked entirely for fork PRs in handle_rerun_test() itself. if pr.user.login == user_login: if user_perms is None: print( @@ -750,7 +750,7 @@ def main(): f"User {user_login} is the PR author and has existing CI permissions." ) user_perms["can_rerun_failed_ci"] = True - user_perms["can_rerun_ut"] = True + user_perms["can_rerun_test"] = True if not user_perms: print(f"User {user_login} does not have any configured permissions. Exiting.") @@ -795,9 +795,9 @@ def main(): stage_name = parts[1].strip() if len(parts) > 1 else None handle_rerun_stage(repo, pr, comment, user_perms, stage_name, token) - elif first_line.startswith("/rerun-ut"): + elif first_line.startswith("/rerun-test"): test_specs = first_line.split()[1:] - handle_rerun_ut(repo, pr, comment, user_perms, test_specs or None, token) + handle_rerun_test(repo, pr, comment, user_perms, test_specs or None, token) else: print(f"Unknown or ignored command: {first_line}")