Skip to content

Do not apply labels in autolabel when opening a draft PR #1968

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented May 6, 2025

After #1963, it doesn't make sense to apply S-waiting-on-review to PRs opened as a draft. According to https://github.com/search?type=code&q=org%3Arust-lang+%22new_pr+%3D+true%22, this option is only ever used for adding S-waiting-on-review in the rust-lang org, so I don't think that we need to complicate the settings by adding some "new_nondraft_pr" setting or something like that.

@Kobzol Kobzol requested a review from Urgau May 6, 2025 07:11
@Kobzol Kobzol marked this pull request as draft May 6, 2025 07:14
@Kobzol
Copy link
Contributor Author

Kobzol commented May 6, 2025

Actually, this won't work on its own, because when a draft PR is opened, it won't get S-waiting-on-review, and once it's converted from draft, it will get assigned someone, but it won't have that label.

Maybe we should modify autolabel to treat both "opened as non draft" and "converted from draft" as triggering new_pr = true?

@apiraino
Copy link
Contributor

apiraino commented May 6, 2025

I'm thinking if it makes sense applying any kind of post-processing to draft PRs. Is there anything the triagebot needs to do on drafts?

Would it be too radical to set a global is_draft() gate on all handlers and just skip everything?

@Kobzol
Copy link
Contributor Author

Kobzol commented May 6, 2025

We might go in that direction, yeah. In theory we could just ignore draft PRs completely, and the first time they are converted from draft to open, we could treat it in triagebot as them opening at that very moment. But that would probably require some larger changes.

@Urgau
Copy link
Member

Urgau commented May 6, 2025

Maybe we should modify autolabel to treat both "opened as non draft" and "converted from draft" as triggering new_pr = true?

Make sense to me.

@Kobzol Kobzol force-pushed the autolabel-draft branch from f46e21c to f9aa4a8 Compare May 7, 2025 08:06
@Kobzol Kobzol marked this pull request as ready for review May 7, 2025 08:06
@Kobzol
Copy link
Contributor Author

Kobzol commented May 7, 2025

Ok, I changed the logic, let me know what do you think.

Comment on lines 14 to 18
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
struct AutolabelState {
new_pr_labels_applied: bool,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
struct AutolabelState {
new_pr_labels_applied: bool,
}
#[derive(Debug, Default, serde::Deserialize, serde::Serialize)]
struct AutolabelState {
has_new_labels: bool,
}

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds a bit confusing/not fully accurate to me, because these labels might not necessarily exist on the PR right now, we just remember that we have already tried to apply the new_pr labels already. I added a comment to explain this, let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

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

we just remember that we have already tried to apply the new_pr labels already

I see. So in plain English it would be:

This flag registers if a PR was previously labeled with the predefined set of labels we apply to all new PRs"

Is that correct? Then maybe already_autolabeled (or similar)? But I agree, a bit hard to summarize in a short variable name.

(btw, this flag purpose would be more clearer if named is_new_pr or similar)

Copy link
Contributor Author

@Kobzol Kobzol May 8, 2025

Choose a reason for hiding this comment

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

  • new_pr_already_autolabeled
  • have_new_pr_labels_been_applied

Do you like any of these? 😆 I think that the comment is enough, we probably can't find a completely perfect name for this flag.

@Kobzol Kobzol force-pushed the autolabel-draft branch from 5636716 to 8394cc9 Compare May 7, 2025 12:20
@Kobzol Kobzol force-pushed the autolabel-draft branch from 8394cc9 to ed0084f Compare May 7, 2025 12:20
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