From 6c471e37118ae3582aa85fc821bbac17e2ebf0dc Mon Sep 17 00:00:00 2001 From: jnadeau207-collab Date: Wed, 2 Sep 2026 21:05:59 -0400 Subject: [PATCH] botmaker: isolate duplicate-reply cluster failures --- .../bot/BBQDuplicateTextRepliesProd.bot | 56 +++++++++++++------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/botmaker-rules/scarecrow/bot/BBQDuplicateTextRepliesProd.bot b/botmaker-rules/scarecrow/bot/BBQDuplicateTextRepliesProd.bot index 23795a56..ffa94464 100644 --- a/botmaker-rules/scarecrow/bot/BBQDuplicateTextRepliesProd.bot +++ b/botmaker-rules/scarecrow/bot/BBQDuplicateTextRepliesProd.bot @@ -14,23 +14,36 @@ action: | val :prodJobName = Concat(jobName, "_prod"); val :eligibleTweets = Filter( :tweetId, - { - !HasBigQuerytoBotmakerLabel(:prodJobName, ToString(:tweetId)) && - !Contains(GetTweetRtfLabels(:tweetId), "COPYPASTA_SPAM") && - TryOrElse(GetTweet(:tweetId).card2.name != "promo_video_convo", FALSE) && - TryOrElse(GetTweet(:tweetId).card2.name != "promo_image_convo", FALSE) - }, + TryOrElse( + { + !HasBigQuerytoBotmakerLabel(:prodJobName, ToString(:tweetId)) && + !Contains(GetTweetRtfLabels(:tweetId), "COPYPASTA_SPAM") && + TryOrElse(GetTweet(:tweetId).card2.name != "promo_video_convo", FALSE) && + TryOrElse(GetTweet(:tweetId).card2.name != "promo_image_convo", FALSE) + }, + { + IncrementStat("BBQDuplicateTextRepliesProd_eligibility_lookup_failed", 1); + FALSE + } + ), StringIdListToLongList(entityId) ); val :actionableTweets = Filter( :tweetId, - { - val :tweetAuthor = GetTweetAuthorId(:tweetId); - !IsTestUser(:tweetAuthor) && - !IsHighPageRankUser(:tweetAuthor) && - !Contains(GetLongList(`AutoExpiringTempSkipList`), :tweetAuthor) && - !IsUserGrayVerified(:tweetAuthor) - }, + TryOrElse( + { + val :tweetAuthor = GetTweetAuthorId(:tweetId); + :tweetAuthor != -1 && + !IsTestUser(:tweetAuthor) && + !IsHighPageRankUser(:tweetAuthor) && + !Contains(GetLongList(`AutoExpiringTempSkipList`), :tweetAuthor) && + !IsUserGrayVerified(:tweetAuthor) + }, + { + IncrementStat("BBQDuplicateTextRepliesProd_exemption_lookup_failed", 1); + FALSE + } + ), :eligibleTweets ); val :unactionableTweets = SetDiff(ToSet(:eligibleTweets), ToSet(:actionableTweets)); @@ -41,15 +54,26 @@ action: | RateLimited( { for (:tweetId in :actionableTweets) { - TweetRtfApplyLabel("COPYPASTA_SPAM", :tweetId); - SetBigQuerytoBotmakerLabel(:prodJobName, ToString(:tweetId)); - } + TryOrElse( + { + TweetRtfApplyLabel("COPYPASTA_SPAM", :tweetId); + SetBigQuerytoBotmakerLabel(:prodJobName, ToString(:tweetId)); + TRUE + }, + { + IncrementStat("BBQDuplicateTextRepliesProd_action_failed", 1); + FALSE + } + ); + }; + TRUE }, :rateLimitTimePeriod, :rateLimitThreshold, jobName, { Log("BBQDuplicateTextRepliesProd_rate_limited", :actionableTweets); + FALSE } ); }