RFR: 1925: When archiving a comment, mlbridgeBot would strip everything after the first command
Zhao Song
zsong at openjdk.org
Thu Jun 1 22:32:51 UTC 2023
On Thu, 1 Jun 2023 22:22:25 GMT, Zhao Song <zsong at openjdk.org> wrote:
> A user reported that there is no email generated for this comment.
> https://github.com/openjdk/jdk/pull/14114#issuecomment-1562126987
>
> It is caused by the initial `/csr needed` command. The root cause is that in `ArchiveWorkItem#ignoreComment`, any command would be treated as a multiline command.
>
> The logic about filtering out commands from a comment differs between `ArchiveWorkItem#ignoreComment` and `CommandExtractor#extractCommands`.
>
> In this patch, I make the logic consistent in this two methods.
>
> 1. Any line starts with '/' followed by lowercase characters will be recognized as a command line. The command line will be stripped.
> 2. Check whether this command is a multiline command. If so, the following lines will be considered as arguments of the command and the argument lines will be stripped until the bot found another command line.
bots/common/src/main/java/org/openjdk/skara/bots/common/CommandNameEnum.java line 62:
> 60: return isMultiLine;
> 61: }
> 62:
Introduced a field called `isMultiLine` here because `CommandHandler` is coupled in PR bot and it is very difficult to extract it to the bots::common package.
bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/ArchiveWorkItem.java line 143:
> 141: }
> 142:
> 143: private boolean ignoreComment(HostUser author, String body, ZonedDateTime createdTime, ZonedDateTime lastDraftTime, boolean isComment) {
Introduced argument `isComment` to this method because I think in any case, no review should be ignored. But according to the previous logic, if a review whose body only contains command, the review would be ignored.
-------------
PR Review Comment: https://git.openjdk.org/skara/pull/1524#discussion_r1213742171
PR Review Comment: https://git.openjdk.org/skara/pull/1524#discussion_r1213739659
More information about the skara-dev
mailing list