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

Fix #201 (Controllable auto-close/postpone behavior) #204

Merged
merged 9 commits into from
May 15, 2018

Conversation

Centril
Copy link
Contributor

@Centril Centril commented May 15, 2018

See title.

This might not work right now due to -> impl Trait, in which case I'll need to bump the nightly version... ;)

@Centril Centril requested a review from anp May 15, 2018 06:23
src/teams.rs Outdated
// FIXME: The two following first fields don't seem to be used anywhere...
// If this is intended, document why.
name: String,
ping: String,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anp Double check this FIXME :)

Copy link
Member

Choose a reason for hiding this comment

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

I think this code might predate pub(crate) and so I didn't notice when those fields stopped being used :).

Feel free to remove them, I don't think this struct is used in API responses.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commented them out for now so that they are not wasting (a small bit of) RAM :)
Keeping them in rfcbot.toml in case we find future uses for them (maybe in better public messages, etc...)

Copy link
Member

@anp anp left a comment

Choose a reason for hiding this comment

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

Fantastic!

General thought: if we're going to be using repositories a bunch in fn signatures, maybe they should be newtyped in a followup?

rfcbot.toml Outdated
postpone = true

[fcp_behaviors."rust-lang/rust"]
#close = false
Copy link
Member

Choose a reason for hiding this comment

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

Is this intentionally commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was part of the WIP to test that it doesn't matter functionally; but I'll comment it in for clarity :)

match disposition {
FcpDisposition::Merge => {
// TODO: This one will require a lot of work to
// auto-merge RFCs and create the tracking issue.
},
FcpDisposition::Close => {
FcpDisposition::Close if can_ffcp_close(issue) => {
Copy link
Member

Choose a reason for hiding this comment

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

that's a cool pattern that's new to me -- someone should write up all the fun things you can do in rust bindings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The newest great thing is slice patterns, https://blog.rust-lang.org/2018/05/10/Rust-1.26.html

match disposition {
FcpDisposition::Merge => {}
FcpDisposition::Close if can_ffcp_close(issue) => {
msg.push_str("\n\nBy the power vested in me by Rust, I hereby close this RFC.");
Copy link
Member

Choose a reason for hiding this comment

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

it would definitely be too much to add gifs to these, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it is closing an RFC a gif could be considered gloating; but on merge, I think we can make a big splash :)

Copy link
Member

Choose a reason for hiding this comment

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

Oh yeah, good catch -- definitely would only want to do on merge!


impl RfcbotConfig {
/// Retrive an iterator over all the team labels.
pub fn team_labels(&self) -> impl Iterator<Item = &TeamLabel> {
Copy link
Member

Choose a reason for hiding this comment

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

😍

src/teams.rs Outdated
}

/// Are we allowed to auto-close issues after F-FCP in this repo?
pub fn ffcp_auto_close(&self, repo: &str) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

It's not clear to me from the function name that it's answering a question. Maybe something like should_finished_fcp_auto_close? I'm sure that without the abbreviation lots of things will be too long, but in this case the extra characters would make it much more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with the compromise should_ffcp_auto_close; 5 words is a bit too long for me ^,-

src/teams.rs Outdated
teams
};
/// Are we allowed to auto-postpone issues after F-FCP in this repo?
pub fn ffcp_auto_postpone(&self, repo: &str) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as I wrote above for ffcp_auto_close.

src/teams.rs Outdated
// FIXME: The two following first fields don't seem to be used anywhere...
// If this is intended, document why.
name: String,
ping: String,
Copy link
Member

Choose a reason for hiding this comment

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

I think this code might predate pub(crate) and so I didn't notice when those fields stopped being used :).

Feel free to remove them, I don't think this struct is used in API responses.

{
Ok(_) => (),
Err(why) => {
error!("unable to find {} in database: {:?}", member_login, why);
Copy link
Member

Choose a reason for hiding this comment

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

This makes me think switching to failure would be nice, would just be a single line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think we need to do something about these at some point; but I'd like to follow up with cleanup at a later point since I'm not very familiar with failure right now ;)

@Centril Centril merged commit c466689 into rust-lang:master May 15, 2018
@Centril Centril deleted the various-improvements branch May 15, 2018 22:44
anoadragon453 pushed a commit to matrix-org/mscbot that referenced this pull request Jul 6, 2018
Fix rust-lang#201 (Controllable auto-close/postpone behavior)

Former-commit-id: c466689
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