-
Notifications
You must be signed in to change notification settings - Fork 2
fix(pr-risk): retire default labels after remap #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,6 +122,12 @@ fail the caller's next run at startup. | |
| | `repo_map_path` | `.github/risk.json` | Consumer risk-map override, read from the PR **base ref**. | | ||
| | `repo_runbooks_path` | `.github/risk-runbooks.json` | Consumer runbook-registry override, read from the PR **base ref**. | | ||
|
|
||
| To show `risk:low` through `risk:xhigh`, pass this `label_map` in the caller: | ||
| `R0=risk:low,R1=risk:medium,R2=risk:high,R3=risk:xhigh,unknown=risk:unknown`. | ||
| The next grade removes a default `risk:R0`..`risk:R3` or `risk:ungraded` label | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Low — "The next grade removes a default ... label" reads as one-time migration cleanup, but the code makes those five names grader-owned permanently: after adopting a custom map a caller can never keep |
||
| and leaves only the mapped label. Custom names from an older map still need | ||
| one-time cleanup. | ||
|
|
||
| ## Gotchas | ||
|
|
||
| **Fork PRs need `pull_request_target`, not `pull_request`.** A fork PR under a | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,11 +36,9 @@ | |
| # before-snapshot and the after-read, so the diff that would have to catch it is empty by | ||
| # construction. | ||
| # | ||
| # ONE MORE LIMIT, on a different axis: ownership is defined by the CURRENT LABEL_MAP. Change a | ||
| # caller's `label_map` and labels applied under the old map are, by definition, no longer owned — | ||
| # they are carried through every future PUT beside the new target, and nothing here will clean them | ||
| # up. Remapping is a one-time repo-side cleanup (delete the retired label names), not something a | ||
| # re-grade heals. | ||
| # ONE MORE LIMIT, on a different axis: ownership is defined by the CURRENT LABEL_MAP plus the five | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Low — This rewritten paragraph contradicts the OWNERSHIP CONTRACT at the top of the same file (line 5 still says the script owns "EXACTLY the label names in LABEL_MAP's values", with non-owned labels carried through untouched). That contract is the stated safety justification for the destructive whole-set PUT, so line 5 needs the same "plus the five default names" qualifier or the next maintainer reasons about this write from an invariant that no longer holds. |
||
| # default labels. A remap retires those defaults on the first re-grade. Custom names from an | ||
| # older map are unknowable and still need one-time repo-side cleanup. | ||
| # | ||
| # The label is applied with the plain GITHUB_TOKEN on purpose: GITHUB_TOKEN-applied labels do | ||
| # not fire `labeled` workflow triggers, which makes the shadow check incapable of starting a | ||
|
|
@@ -107,6 +105,7 @@ for t in R0 R1 R2 R3 unknown; do | |
| [ -n "$l" ] || die "LABEL_MAP maps tier '$t' to an empty label" | ||
| OWNED+=("$l") | ||
| done | ||
| OWNED+=("risk:R0" "risk:R1" "risk:R2" "risk:R3" "risk:ungraded") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium — The five default names are appended to OWNED unconditionally and permanently, so in a repo enrolled with a custom There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Low — This list hardcodes the values already held in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Nit — The append does not dedup, so under the default map — the common case, where these names are already in OWNED from the map — each is held twice. Set semantics downstream are unaffected, but the in-sync loop spawns up to ten |
||
| TARGET="$(label_for "$TIER")" | ||
|
|
||
| # Colors keyed by TIER (not label text, which callers may remap): green .. red, gray unknown. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Nit — "the first remapped grade retires the default
risk:R0..risk:R3andrisk:ungradedlabels" overstates two ways: a remap that keeps a default name as a live target (the 1-indexed scheme documented in this same file keepsunknown=risk:ungraded) does not retire that name, and retirement happens per-PR on that PR's next grade, not globally on the first remapped grade.Raised by 1 of 6 reviewers (kimi-k3-high edge-case).