Skip to content

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

Merged
Urgau merged 1 commit into
rust-lang:masterfrom
ismailarilik:feat/notify-zulip/support-notify-zulip-label-getting-mapped-to-multiple-actions
Apr 25, 2025
Merged

feat(notify-zulip): support notify-zulip.<label> getting mapped to multiple actions#1853
Urgau merged 1 commit into
rust-lang:masterfrom
ismailarilik:feat/notify-zulip/support-notify-zulip-label-getting-mapped-to-multiple-actions

Conversation

@ismailarilik

@ismailarilik ismailarilik commented Nov 5, 2024

Copy link
Copy Markdown
Contributor

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. =)

@apiraino

apiraino commented Nov 5, 2024

Copy link
Copy Markdown
Contributor

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

EDIT: created the Zulip channel for the T-compiler backport notifications
Link: https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports
Channel id: 474880

@aDotInTheVoid

aDotInTheVoid commented Nov 5, 2024

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor 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
Copy Markdown
Contributor Author

@rustbot review

@rustbot

rustbot commented Nov 6, 2024

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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

apiraino commented Nov 6, 2024

Copy link
Copy Markdown
Contributor

@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

Comment thread src/config.rs Outdated
@apiraino

apiraino commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

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

@GuillaumeGomez

Copy link
Copy Markdown
Member

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

Another rustdoc point of view: I agree. :)

@apiraino

apiraino commented Dec 20, 2024

Copy link
Copy Markdown
Contributor

@ismailarilik I am working on making it possible for the triagebot using another Zulip instance for local testing. See my work-in-progress patch, feel free to test it, if you like (I didn't yet).

Edit: my patch has been merged

apiraino added a commit to apiraino/test-triagebot that referenced this pull request Dec 27, 2024
@apiraino

Copy link
Copy Markdown
Contributor

I've tested this on a test Zulip instance (by manually applying this patch) and it seems to work.

Comment thread src/handlers/notify_zulip.rs Outdated
Comment thread src/handlers/notify_zulip.rs Outdated
Comment thread src/handlers/notify_zulip.rs Outdated
Comment thread src/handlers/notify_zulip.rs Outdated
Comment thread src/handlers/notify_zulip.rs Outdated
@Urgau Urgau self-assigned this Apr 15, 2025

@Urgau Urgau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@Urgau

Urgau commented Apr 24, 2025

Copy link
Copy Markdown
Member

Thanks for the continued effort.

I intend to merge it tomorrow (or Saturday).

cc @Kobzol (in case you want to take a look)

Comment thread src/handlers/notify_zulip.rs
@Urgau
Urgau added this pull request to the merge queue Apr 25, 2025
Merged via the queue into rust-lang:master with commit 4d54d43 Apr 25, 2025
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.

7 participants