RFR: 1843: mlbridge bot bridge emails generated by itself.

Zhao Song zsong at openjdk.org
Thu Mar 16 15:50:46 UTC 2023


On Thu, 16 Mar 2023 15:27:31 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> Hi all,
>> 
>> This patch filters both `github.com` (by `authenticatedUrl()`) and `git.openjdk.com` (by `url()`) in `MailingListArchiveReaderBot::inspect` to avoid the bot posting the unnecessary comments to the PRs. Please see SKARA-1843 [1] for more information.
>> 
>> But I can't write a test case for it now, because the current URLs of the repositories in test code are fake and their host are empty, which means both `pr.repository().url().getHost()` and `pr.repository().authenticatedUrl().getHost()` always return `null`.
>> 
>> Thanks for the review.
>> 
>> Best Regards,
>> -- Guoxiong
>> 
>> [1] https://bugs.openjdk.org/browse/SKARA-1843
>
> bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/MailingListArchiveReaderBot.java line 118:
> 
>> 116:         }
>> 117:         var bridgeIdStr = "^[^.]+\\.[^.]+@(?:" + pr.repository().url().getHost() + "|" + pr.repository().authenticatedUrl().getHost() + ")$";
>> 118:         var bridgeIdPattern = Pattern.compile(bridgeIdStr);
> 
> I think the correct fix is to just get the host from `authenticatedUrl`. Perhaps there should be a different method for this kind of usecase that better describes what we need here (the raw actual host, without the pattern rewrite), but at least for now, I think changing this to `authenticatedUrl` is a good enough fix. Thanks for figuring this out.

Just a reminder, If so, we should also change `return EmailAddress.from(encodedCommon + "." + UUID.randomUUID() + "@" + pr.repository().url().getHost())` in `ReviewArchive::getUniqueMessageId ` to `return EmailAddress.from(encodedCommon + "." + UUID.randomUUID() + "@" + pr.repository().authenticatedUrl().getHost())`

-------------

PR Review Comment: https://git.openjdk.org/skara/pull/1485#discussion_r1138918907


More information about the skara-dev mailing list