You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❌ Patch coverage is 93.81663% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.83%. Comparing base (8f3ee6a) to head (0406276).
✅ All tests successful. No failed tests found.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Awaitable validation bypasses normal hook and sieve failure handling and can leave tasks tracked, while new return-type aliases reject supported post-hook and capability results.
This PR adds explicit return types throughout CloudBot’s hook system, carrying them from decorators through hook execution and updating related plugins and tests.
Changes:
Define per-hook return types and synchronous/asynchronous callable overloads.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Outgoing hook changes break empty-result suppression and leave irc_raw unset, allowing suppressed messages to send and existing hooks to receive None instead of the outgoing line.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Outgoing hooks receive None for irc_raw
cloudbot/clients/irc.py:504
Passing only line leaves the inherited Event.irc_raw at its default None; IrcOutEvent does not copy line into that field. Outgoing hooks requesting the existing irc_raw argument therefore receive None instead of the current outgoing line, breaking that event-field contract. Please populate irc_raw alongside the new line argument.
Empty hook results no longer suppress outgoing messages
cloudbot/clients/irc.py:522
This changes the existing suppression behavior for outgoing hooks returning "" or b"": they previously stopped the send, but now subsequent filters run. For example, an empty result followed by truncate_line writes a bare CRLF instead of suppressing the message. Please retain the falsy-result check so empty results stop the chain as before.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The unconditional UTF-8 decode can raise UnicodeDecodeError for non-UTF-8 connections, aborting remaining outgoing hooks and the fallback send instead of respecting the connection’s configured encoding and error policy.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Invalid outgoing-hook bytes under strict decoding can abort sending before any write and bypass the existing error fallback, even when the next hook only needs line.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Event initialization shadows the irc_raw compatibility accessor with None, causing outgoing hooks that use it to receive the wrong value and potentially fail into the fallback send path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add hook return types, clean up other return type annotations, and update related code accordingly