Skip to content

Conversation

@apiraino
Copy link
Contributor

@apiraino apiraino commented Jan 7, 2026

Do not allow nominating for backport a PR that is already backport approved.
Revert the -nominated label that was added on GitHub.

r? @Kobzol

thanks

Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

I'm not sure if I understand the change, to be honest 😅 Is it about beta nomination not being triggered when the PR is already stable nominated, and vice versa?

I would expect that if we receive IssuesAction::Labeled { label: FOO }, then pr.labels will already contain FOO. Have you checked whether that's the case or not? 🤔

View changes since this review

@apiraino apiraino force-pushed the fix-backport-handling branch from 265da83 to 502c371 Compare January 12, 2026 16:32
@apiraino
Copy link
Contributor Author

apiraino commented Jan 12, 2026

I'm not sure if I understand the change, to be honest 😅 Is it about beta nomination not being triggered when the PR is already stable nominated, and vice versa?

I would expect that if we receive IssuesAction::Labeled { label: FOO }, then pr.labels will already contain FOO. Have you checked whether that's the case or not? 🤔

The fix here basically is:

  • we have a beta-accepted PR
  • we add stable-nominated
  • then we add stable-accepted
  • bug: the backport.rs handler will return without triggering the Zulip notification handler (notify_zulip.rs) because the label check here does not treat beta and stable backport labels separately.

makes sense?

@Kobzol
Copy link
Member

Kobzol commented Jan 14, 2026

Ah, makes sense, thanks! I think that in the latest commit you just changed the code so that it will simply ignore all labels? pr_labels needs to be checked.

@apiraino apiraino force-pushed the fix-backport-handling branch 2 times, most recently from 26e7bca to fb54275 Compare January 14, 2026 11:36
@apiraino
Copy link
Contributor Author

ah yes you're right, I thought we didn't need it but ofc we do.

Thanks for the review!

if let IssuesAction::Labeled { label } = &event.action
&& BACKPORT_ACCEPTED_LABELS.contains(&label.name.as_str())
{
if contains_any(&pr_labels, &BACKPORT_ACCEPTED_LABELS) {
Copy link
Member

Choose a reason for hiding this comment

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

This will have the same bug as before, right? If the PR is already beta-accepted, it will stop the handler here once stable-accepted is added.

You'll need to separate the labels on the axis of beta/stable, rather than nominated/accepted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm ... you're right but the solution is more complex that separating on another axis. I'm afraid I'll need to map all possible cases (4 labels = 16 cases) and then see if I can reduce to a couple of ifs.

In any case, I want to keep it simple: if this does not work, I have another patch to add "negated labels" when sending zulip notification, that would solve the issue from another point of view.

I'll be back on this.

Copy link
Member

Choose a reason for hiding this comment

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

Can't just remove this:

if contains_any(&pr_labels, &BACKPORT_LABELS) {
    log::debug!("PR #{} already has a backport label", pr.number);
    return Ok(None);
}

? Seems like the bug is just caused by this.

Btw, I tested that once you receive the Labeled { label: "foo" } event, then pr.labels() already contains foo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, I am confused by your comment: isn't that chunk of code removed in this patch? Or did you mean to just remove that code without adding anything else?

In the latter case, I think that not checking labels would open up to confusion when adding regression labels (which was the point of this patch).

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I meant remove without adding anything else. Say that we remove the original check - what will be the problematic situations that could be caused in that case? Adding -nominated once there is already -accepted? Or something else? I don't know what is a "regression label", it wasn't mentioned in this PR so far 😅

@apiraino apiraino force-pushed the fix-backport-handling branch from fb54275 to 66063d5 Compare January 22, 2026 17:56
Do not allow nominating for backport a PR that is already backport approved.
Revert the label that was added on GitHub.
@apiraino apiraino force-pushed the fix-backport-handling branch from 66063d5 to 6516a34 Compare January 22, 2026 17:58
@apiraino apiraino changed the title Fix backport handler Fix backport label handler Jan 22, 2026
@apiraino
Copy link
Contributor Author

ok @Kobzol I've reworked this patch and tried to simplify as much as possible to keep the scope small and clear (I have edited title and commit desc to reflect this).

Now hopefully the logic should be clearer: with this patch I want to avoid that a backport accepted PR be nominated again. If a -nominated label is added, the handler will revert that. As you suggested I am now checking on the naminated/accepted "axis" instead of the beta/stable.

Note: this won't block creating the Zulip backport poll but it can only be handled in the notify_zulip.rs (another patch will follow).

Let me know if now sounds better. Thanks.

@apiraino apiraino requested a review from Kobzol January 22, 2026 18:07
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