Skip to content

feat(pr-risk): add safe label migration CLI - #256

Closed
huang47 wants to merge 1 commit into
mainfrom
cx/risk-label-migration-cli
Closed

huang47 wants to merge 1 commit into
mainfrom
cx/risk-label-migration-cli

Conversation

@huang47

@huang47 huang47 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a dry-run-by-default CLI for migrating risk:R0 through risk:R3 assignments to named labels
  • add and verify the target before removing the source
  • paginate all PRs, preserve unrelated labels, and fail on migration errors or residual assignments

Usage

bash scripts/pr-risk/migrate-risk-labels.sh OWNER/REPO
bash scripts/pr-risk/migrate-risk-labels.sh OWNER/REPO --apply

Live dry-run on Comfy-Org/ComfyUI_frontend: 55 assignments, no writes.

Validation

  • ShellCheck
  • migration suite: 10 assertions
  • all existing PR-risk suites
  • git diff --check

@huang47
huang47 marked this pull request as draft September 2, 2026 20:40
@huang47 huang47 closed this Sep 2, 2026
@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 56e95609-9169-452e-9e1f-eb4db0cc9dc7

📥 Commits

Reviewing files that changed from the base of the PR and between df10491 and 1086285.

📒 Files selected for processing (4)
  • .github/workflows/test-pr-risk.yml
  • scripts/pr-risk/README.md
  • scripts/pr-risk/migrate-risk-labels.sh
  • scripts/pr-risk/tests/test_migrate_risk_labels.sh

📝 Walkthrough

Walkthrough

The PR adds a Bash CLI that maps legacy risk labels to named labels. It supports dry-run and apply modes, verifies label changes, adds focused tests, documents usage, and integrates ShellCheck and test execution into the workflow.

Changes

Risk label migration

Layer / File(s) Summary
CLI validation and PR discovery
scripts/pr-risk/migrate-risk-labels.sh
The CLI validates arguments and required tools, manages temporary data, defines the R0–R3 mappings, and discovers paginated pull requests by legacy label.
Verified label migration
scripts/pr-risk/migrate-risk-labels.sh
Apply mode adds and verifies each target label before removing the source label. It reports migration failures and residual assignments through its exit status.
Test and workflow coverage
scripts/pr-risk/tests/test_migrate_risk_labels.sh, .github/workflows/test-pr-risk.yml, scripts/pr-risk/README.md
Tests cover preview mode, successful migration, label preservation, operation order, and add failures. The workflow runs ShellCheck and the test suite. The README documents the CLI modes and behavior.

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant MigrateRiskLabels
  participant GitHub
  Operator->>MigrateRiskLabels: Run preview or --apply
  MigrateRiskLabels->>GitHub: List pull requests by legacy label
  GitHub-->>MigrateRiskLabels: Return paginated pull requests
  MigrateRiskLabels->>GitHub: Add and verify target label
  MigrateRiskLabels->>GitHub: Remove source label
  MigrateRiskLabels->>GitHub: Check residual source labels
  GitHub-->>MigrateRiskLabels: Return final migration status
Loading

Suggested reviewers: mattmillerai

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cx/risk-label-migration-cli
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch cx/risk-label-migration-cli

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

@coderabbitai
coderabbitai Bot requested a review from mattmillerai September 2, 2026 20:41
@huang47
huang47 deleted the cx/risk-label-migration-cli branch September 2, 2026 20:42
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.

2 participants