jira_sync: re-check the Fixes reference when a PR body changes - #212
Conversation
|
@coderabbitai full-review |
|
@coderabbitai please review |
|
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Comment |
| if enforce_backport_fixes_on_body_change( | ||
| pr_title, pr_body, pr_number, owner_repo, gh_token, jira_auth, | ||
| ): | ||
| print("Backport label(s) removed: the PR body must link a valid issue before re-labelling.") |
There was a problem hiding this comment.
The message is not clear IMO.
Suggest the following:
"Backport label(s) removed. Please add to the PR body a link ('Fixes:') to a valid Jira issue and only then re-label the PR for backport."
enforce_backport_fixes_reference only runs on the 'labeled' event, so a PR that was labelled while its body linked a valid issue keeps the backport label even if the reference is later edited away. The missing "Fixes:" then surfaces only when the backport runs, after the merge - exactly the confusing late failure RELENG-81 asks us to move to the beginning of the process. Add enforce_backport_fixes_on_body_change, which reads the backport labels currently on the PR and, when at least one backport/<release> label is present, applies the same enforcement. Wire it as step 0 of manage_opened_gh_event, which serves both the 'opened' and 'edited' events, before extract_jira_keys returns early on a body with no keys. PRs with no backport label, or only backport/none, are never asked for a Fixes: reference, so feature and cleanup PRs are unaffected. A failure to read the label list fails open. Fixes: RELENG-81 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Fan1bYR7CTpK82DjfedrZ
13c236b to
13d66a5
Compare
Summary
enforce_backport_fixes_reference(RELENG-175) only runs on thelabeledevent. A PR that was labelled while its body linked a valid issue therefore keeps the backport label even if the reference is later edited away, and the missingFixes:surfaces only when the backport runs, after the merge — exactly the late, confusing failure RELENG-81 asks us to move to the beginning of the process.enforce_backport_fixes_on_body_changereads the backport labels currently on the PR and, when at least onebackport/<release>label is present, applies the existing enforcement (comment once, strip the backport labels).manage_opened_gh_event, which serves both theopenedandeditedevents. It has to run before step 1, becauseextract_jira_keysreturns early precisely in the case we care about.scylladb'scall_jira_sync.ymlalready sendsedited, so no workflow change is needed.backport/none, are never asked for aFixes:reference, so feature and cleanup PRs are unaffected. A failure to read the label list fails open.Testing
Four new cases in
test_enforce_backport_fixes.py: no-label noop, valid reference allowed, reference edited away is enforced, label-lookup failure fails open. Full suite: 448 passed.Related PRs
Fixes:requirement to the earlyPR require backport labeljob, coveringopened/labeled/synchronize. Together the two close the whole window.Fixes: RELENG-81