Skip to content
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

glacier: Append random sequence to branch name to make it unique #1041

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

Conversation

camelid
Copy link
Member

@camelid camelid commented Dec 10, 2020

Sometimes the user (me) will make a mistake (e.g. leave out
/rust-play/ from the URL) when invoking @rustbot glacier
that means the automatically-created PR has to be closed.

However, there was no way to try again, because the branch name
would conflict and triagebot would crash. Now, we append an
8-character random alphanumeric string to the branch name so that
the branch names are unique and you can try again.

This adds a dependency on rand, which is probably the most downloaded
crate all-time, but we already depended on it through other crates.

r? @Mark-Simulacrum

@camelid camelid force-pushed the glacier-rand-branch branch 3 times, most recently from 775f20f to d09920f Compare December 10, 2020 00:37
@Mark-Simulacrum
Copy link
Member

I'd prefer we use the API to delete the old branch or something like that instead.

@camelid
Copy link
Member Author

camelid commented Dec 10, 2020

Ideally that's what we'd do, but it's not necessarily easy to figure out when the branch should be deleted. We'd need to listen to the PR events and only delete it when the PR is closed or merged. I think it's better to just go with something simple for now so that it's not a pain if you make a typo when invoking the command.

Sometimes the user (me) will make a mistake (e.g. leave out
`/rust-play/` from the URL) when invoking `@rustbot glacier`
that means the automatically-created PR has to be closed.

However, there was no way to try again, because the branch name
would conflict and triagebot would crash. Now, we append an
8-character random alphanumeric string to the branch name so that
the branch names are unique and you can try again.

This adds a dependency on `rand`, which is probably the most downloaded
crate all-time, but we already depended on it through other crates.
@Mark-Simulacrum
Copy link
Member

I mean that we'd always delete it or "force push" or whatever to the branch? Like, I'd want repeated invocations to update the open PR ideally

@camelid
Copy link
Member Author

camelid commented Dec 10, 2020

Hmm... that seems like it might be confusing. I also think it would require significant changes to the current code, and I don't know octocrab etc. well enough to make those changes.

@kellda
Copy link
Contributor

kellda commented Sep 10, 2021

What about creating the file and the pull request as currently done if the branch was created successfully (i.e. it didn't exist), and just updating the file if the branch already exists? See https://docs.rs/octocrab/0.12.0/octocrab/repos/struct.RepoHandler.html#method.update_file

@camelid
Copy link
Member Author

camelid commented Sep 12, 2021

What about creating the file and the pull request as currently done if the branch was created successfully (i.e. it didn't exist), and just updating the file if the branch already exists? See https://docs.rs/octocrab/0.12.0/octocrab/repos/struct.RepoHandler.html#method.update_file

That could work, but probably triagebot should only do that if there's no PR open for that branch (i.e., the PR was closed). Otherwise there could be confusion if two people do @rustbot glacier with different MCVEs around the same time.

@kellda
Copy link
Contributor

kellda commented Sep 12, 2021

Otherwise there could be confusion if two people do @rustbot glacier with different MCVEs around the same time.

Didn't think of that, but what is the probability that it will happend ? Especially since only a limited number of people are allowed to issue the command ?

Which is better ? Having to close the PR to fix it or avoiding that potential confusion ?

What about duplicates PR for the same ICE ?

@rustbot
Copy link
Collaborator

rustbot commented Sep 12, 2021

Error: Parsing glacier command in comment failed: ...'acier with' | error: invalid link - must be from a playground gist at >| ' different'...

Please let @rust-lang/release know if you're having trouble with this bot.

@kellda
Copy link
Contributor

kellda commented Sep 12, 2021

P.S. ok, definitely need to ignore commands in quoted text. I'll try to implement that

@camelid
Copy link
Member Author

camelid commented Sep 12, 2021

Otherwise there could be confusion if two people do @rustbot glacier with different MCVEs around the same time.

Didn't think of that, but what is the probability that it will happend ? Especially since only a limited number of people are allowed to issue the command ?

Which is better ? Having to close the PR to fix it or avoiding that potential confusion ?

What about duplicates PR for the same ICE ?

Personally, I think it would be best to start out by only updating the branch if there's no open PR, and then we can always lift that restriction in the future if it causes problems.

@rustbot
Copy link
Collaborator

rustbot commented Sep 12, 2021

Error: Parsing glacier command in comment failed: ...'acier with' | error: invalid link - must be from a playground gist at >| ' different'...

Please let @rust-lang/release know if you're having trouble with this bot.

@kellda
Copy link
Contributor

kellda commented Sep 12, 2021

As you see fit. The question then is what to do when the a PR is open ? Emit a warning / error ? Or open a concurrent PR ?

I still think it's unlikely that two persons issue the command with different MCVEs but for same ICE / on the same issue. Anyway…

@camelid
Copy link
Member Author

camelid commented Sep 12, 2021

As you see fit. The question then is what to do when the a PR is open ? Emit a warning / error ? Or open a concurrent PR ?

I still think it's unlikely that two persons issue the command with different MCVEs but for same ICE / on the same issue. Anyway…

It's probably not a big deal. I guess I'm just thinking of if someone tried to spam the open PR, but it's probably unlikely.

So maybe updating the branch even if a PR is open is fine. Maybe @Mark-Simulacrum has thoughts on what makes sense here?

@Mark-Simulacrum
Copy link
Member

Spam is not something we're trying to solve too much.

I think either updating the branch in place or generating a new branch and updating that will both be fine. I think generally leaning towards one PR per invocation is probably better; PRs are relatively cheap and if need be could also be edited in place by reviewers.

@Mark-Simulacrum
Copy link
Member

It might be a little cleaner to associate the branch with a single (user, issue) pair and update that in place to provide an easy way to amend PRs, perhaps. But either way seems ok.

@camelid
Copy link
Member Author

camelid commented Sep 13, 2021

It might be a little cleaner to associate the branch with a single (user, issue) pair and update that in place to provide an easy way to amend PRs, perhaps. But either way seems ok.

That sounds like a good idea. E.g., if I used it on issue 123, the branch would be named triagebot-ice-camelid-123 or something like that. Then we wouldn't need to check if it's the same user because the branch name would do it for us.

@Mark-Simulacrum
Copy link
Member

Right. We'd still need the create if not exists & update logic, but hopefully that's not too hard to pull off.

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.

4 participants