Skip to content

πŸ› github: don't let prow's WIP mirror label shield hive drafts from the stale-draft rule - #16248

Merged
clubanderson merged 2 commits into
v5from
fix-stale-draft-wip
Nov 2, 2026
Merged

clubanderson merged 2 commits into
v5from
fix-stale-draft-wip

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Problem

fetchPRsWithDetails runs the exempt-label check before the draft branch, and PermanentExemptLabels prefix-matches do-not-merge. Prow's wip plugin adds do-not-merge/work-in-progress to every draft, so every hive-authored draft was filtered as "Exempt label" and the 48h stale-draft rule never ran. The scanner never saw such PRs in "YOUR STALE DRAFT PRs", while the linked issue stayed suppressed as covered_by_open_pr β€” a deadlock, observed on #15890 / #15540 (2 days parked after the PR it was stacked on merged).

Fix

A draft whose only exempt label is the WIP mirror now falls through to the draft branch (counted as Draft, eligible for StaleDrafts). Any other do-not-merge/* or configured exempt label still filters it; do-not-merge/hold keeps its earlier "Held draft" path.

Tests: TestFetchPRs_StaleAppDraftWithWIPMirrorLabelIsSurfaced, TestFetchPRs_StaleAppDraftWithOtherExemptLabelStaysExempt.

Closes #16246

…he stale-draft rule

fetchPRsWithDetails checked exempt labels before the draft branch, and
PermanentExemptLabels prefix-matches do-not-merge, so the
do-not-merge/work-in-progress label prow adds to every draft filtered every
hive-authored draft as "Exempt label". The 48h stale-draft rule never ran,
the scanner never saw the PR in "YOUR STALE DRAFT PRs", and the linked issue
stayed suppressed as covered_by_open_pr β€” a deadlock (#15890/#15540).

A draft whose only exempt label is the WIP mirror now falls through to the
draft branch; any other do-not-merge/* or configured exempt label still
filters it.

Closes #16246

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 2, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 2, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • relative links and anchors resolve

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Review findings from reviewer (folded here because this head already carries its hive review):

Read fetchPRsWithDetails at 96f4d93 around the changed condition rather than just the hunk. Looks correct to me:

  • The hold-label branch (src/pkg/github/client.go ~2180-2240) runs before the exempt check, so a draft carrying do-not-merge/hold still lands in "Held draft" exactly as before; this change only affects what reaches the isExempt line at client.go:2245.
  • HasExemptLabel (client.go:3887) prefix-matches do-not-merge, which is why prow's do-not-merge/work-in-progress mirror was swallowing every draft. isDraftExemptOnlyByWIPMirror (client.go:3874) strips only that exact label (EqualFold, matching the comparison style of HasExemptLabel) and re-runs isExempt on the remainder, so any other do-not-merge/* or configured exempt label keeps the PR filtered. The len(rest) != len(labels) guard means a draft that is exempt for some other reason and has no WIP label is unaffected.
  • Non-drafts short-circuit to false, so a prow WIP:-titled non-draft PR that received the same label stays filtered.
  • The fall-through draft hits the existing pr.GetDraft() branch, where the appBotLogin + staleDraftAfter check still gates staleDrafts; the stale-draft rule is unchanged, it just now sees the PR.

One side effect worth knowing, not a defect: human-authored drafts whose only exempt label is the WIP mirror now count as breakdown.Draft / "Draft" instead of breakdown.Filtered / "Exempt label". That is arguably the more accurate bucket, and both remain sidelined.

build (linux/amd64) is green at this head; I did not run the package tests locally.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the change against the tree at 96f4d93; this looks correct to me.

  • The bug is real: HasExemptLabel matches PermanentExemptLabels by prefix (src/pkg/github/client.go:3890), so prow's do-not-merge/work-in-progress mirror label satisfied isExempt and every hive draft was sidelined as "Exempt label" at client.go:2245 before reaching the draft branch.
  • With the guard, a draft whose only exempt label is the mirror falls through to client.go:2251-2259, where the existing appBotLogin + staleDraftAfter check populates staleDrafts. Drafts carrying any other exempt/hold label still filter, because isDraftExemptOnlyByWIPMirror re-runs isExempt on the remaining labels (client.go:3883). Held drafts are already handled earlier by the HoldLabels branch, so ordering is unaffected.
  • The scale-envelope.md citation update to client.go:5040-5050 matches RankActionableIssues at this head (func at 5040, comparator at 5048).

One edge worth knowing, not a defect: if an operator lists do-not-merge/work-in-progress itself in exemptLabels, the guard strips it before the isExempt(rest) check, so that configured exemption would no longer shield drafts. Given the label is prow-applied rather than operator intent, that seems acceptable.

Comment only; I have not approved or changed anything.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@clubanderson
clubanderson merged commit 02d2a0c into v5 Nov 2, 2026
76 of 80 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix-stale-draft-wip branch November 2, 2026 16:12
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› Hive-authored draft PRs carrying prow's do-not-merge/work-in-progress label bypass the stale-draft rule (deadlock with covered_by_open_pr)

1 participant