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

feat(notify-zulip): support notify-zulip.<label> getting mapped to multiple actions #1853

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

Conversation

ismailarilik
Copy link

@ismailarilik ismailarilik commented Nov 5, 2024

This is a requested feature in the Rust project: https://github.com/rust-lang/rust/blob/master/triagebot.toml#L492 (Notice FIXME comments there)

With this PR, multiple notify-zulip tables are possible. For example:

[notify-zulip."beta-nominated"]
required_labels = ["T-rustdoc"]
zulip_stream = 266220
topic = "beta-nominated: #{number}"
message_on_add = "PR #{number}'s beta-nomination has been added."
message_on_remove = "PR #{number}'s beta-nomination has been removed."
message_on_close = "PR #{number} has been closed. Thanks for participating!"
message_on_reopen = "PR #{number} has been reopened. Pinging @*T-rustdoc*."

[notify-zulip."beta-nominated".compiler]
required_labels = ["T-compiler"]
zulip_stream = 266221
topic = "beta-nominated: #{number}"
message_on_add = "PR #{number}'s beta-nomination has been added."
message_on_remove = "PR #{number}'s beta-nomination has been removed."
message_on_close = "PR #{number} has been closed. Thanks for participating!"
message_on_reopen = "PR #{number} has been reopened. Pinging @*T-compiler*."

[notify-zulip."beta-nominated".miri]
required_labels = ["T-miri"]
zulip_stream = 266222
topic = "beta-nominated: #{number}"
message_on_add = "PR #{number}'s beta-nomination has been added."
message_on_remove = "PR #{number}'s beta-nomination has been removed."
message_on_close = "PR #{number} has been closed. Thanks for participating!"
message_on_reopen = "PR #{number} has been reopened. Pinging @*T-miri*."

According to the config above, for example, if an issue with the labels beta-nominated, T-rustdoc and T-miri opened, the streams 266220 and 266222 would be notified simultaneously.

It is backward-compatible, there is no need to change any current configuration. New notify-zulip items should have names like above.

Note: This is just a draft PR. I believe my approach is right but I am not confident on the implementation so I need your feedback. Another thing is that I forgot to update the docs. =)

@ismailarilik ismailarilik force-pushed the feat/notify-zulip/support-notify-zulip-label-getting-mapped-to-multiple-actions branch from d97c5ea to 1fb8344 Compare November 5, 2024 17:23
@apiraino
Copy link
Contributor

apiraino commented Nov 5, 2024

hey @ismailarilik thank you for this contribution. This was actually something we in T-compiler wanted (was on my TODO list...), see Zulip discussion.

One thing I can spot at a first look is that our discussion was favorable to publish these notification in a substream (e.g. T-compiler/backports instead of T-compiler). Let's remember about this detail when this change is merged and deployed, a specific stream needs to be created (maybe I can even do that, need to check my permissions) 🙂

cc @rust-lang/rustdoc so they can express their preference either

@aDotInTheVoid
Copy link
Member

aDotInTheVoid commented Nov 5, 2024

From a rustdoc side, my personal preference would be to keep those notifications in the main stream. It's low trafic enough I don't think it's worth (us) making a new stream for it, although I can imagine this being different for a larger/higher traffic team like compiler.

Also relevant context: rust-lang/rust#116957

@ismailarilik
Copy link
Author

I was thinking that the docs were in that repo but it seems that they are in the Forge. I will update it after this PR is merged. BTW, here is the related page in Forge: https://forge.rust-lang.org/triagebot/zulip-notifications.html

@ismailarilik ismailarilik marked this pull request as ready for review November 6, 2024 06:26
@ismailarilik
Copy link
Author

@rustbot review

@rustbot
Copy link
Collaborator

rustbot commented Nov 6, 2024

Error: The feature shortcut is not enabled in this repository.
To enable it add its section in the triagebot.toml in the root of the repository.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@ismailarilik
Copy link
Author

How can I request a review? =)
I couldn't see a CONTRIBUTING.md so couldn't figure this out. Maybe I should just wait someone to pick this up and review. Sorry if that is the case.

@ismailarilik
Copy link
Author

Sorry for the noise but do you know how I can test this appropriately? I setup triagebot in my local by following README and tried this implementation; it seems that it is working. But of course, I didn't try to send any Zulip notification to a team. Even if I tried this, I couldn't totally ensure that it would work on production.

@apiraino
Copy link
Contributor

apiraino commented Nov 6, 2024

@ismailarilik I'll have a look at your patch later. Maintainers of this repo are listed here (not an obvious place), you can ping any of them. Please allow some time for a review.

how I can test this appropriately

To test the Zulip part one needs a Zulip instance. The quickest way is probably to register a new free instance for testing purposes.

r? @ehuss

#[derive(PartialEq, Eq, Debug, serde::Deserialize)]
pub(crate) struct NotifyZulipNameConfig {
#[serde(flatten)]
pub(crate) default: Option<NotifyZulipLabelConfig>,
Copy link
Contributor

@apiraino apiraino Nov 8, 2024

Choose a reason for hiding this comment

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

@ismailarilik can you put a comment explaining what this field is (is this a label?) and why is it needed?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@apiraino
Copy link
Contributor

apiraino commented Nov 8, 2024

I gave a first look and this looks good to me :)

@ismailarilik ismailarilik force-pushed the feat/notify-zulip/support-notify-zulip-label-getting-mapped-to-multiple-actions branch from 1fb8344 to 6260313 Compare November 9, 2024 11:34
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