Skip to content

Conversation

@Urgau
Copy link
Member

@Urgau Urgau commented Sep 30, 2025

As we discussed in #2172 and in #t-compiler/contrib-private > RFC: triagebot parsing command aliases the way labels are applied in relabel is weird when the same label is used multiple times.

This PR makes the behavior more user friendly by pre-computing a "final state" where all the label deltas are applied from left to right, meaning that +label -label/-label +label would cancel each other instead of using the issue state.

Best reviewed commit by commit.

@Urgau Urgau requested a review from Kobzol September 30, 2025 12:43
let mut add = BTreeSet::new();
let mut remove = BTreeSet::new();

for delta in deltas {
Copy link
Member

Choose a reason for hiding this comment

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

Just a note to myself: this implementation means that doing +foo -foo -foo will actually remove foo from the issue. This is probably useful for something like alias -foo, where alias does +foo -foo.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, and it also means that +foo +foo -foo does nothing (+foo +foo -> +foo and +foo -foo cancels each other out).

@Urgau Urgau added this pull request to the merge queue Sep 30, 2025
Merged via the queue into rust-lang:master with commit a46114b Sep 30, 2025
3 checks passed
@Urgau Urgau deleted the relabel-deltas-left-right branch September 30, 2025 13:09
Comment on lines +30 to +32
let Some(issue) = event.issue() else {
anyhow::bail!("event is not an issue");
};
Copy link
Contributor

Choose a reason for hiding this comment

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

@Urgau why did you introduce this block?

I don't know for other people but I need to be able to edit labels on both pull requests and issues.

Copy link
Member

Choose a reason for hiding this comment

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

PRs are also issues, so this should work fine. The code before did an unwrap on event.issue() anyway.

Copy link
Contributor

@apiraino apiraino Oct 16, 2025

Choose a reason for hiding this comment

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

ah wait maybe I am misunderstanding: Issue here is meant as both a "ticket" and a pull request so Event::Issue covers both.

But I still don't understand why adding this check: what other event are you preventing to happen?

The error message at least is confusing, I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

why did you introduce this block?

Because the code below was asserting the presence of it. It's better return a message than panic and block all the other handlers.

We should indeed probably change the message to be explicitly about PRs since it's now a user message.

Copy link
Contributor

@apiraino apiraino Oct 16, 2025

Choose a reason for hiding this comment

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

We should indeed probably change the message to be explicitly about PRs since it's now a user message.

I'm working on #2172 I will change that as well

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.

3 participants