Compare commits

..

No commits in common. "138bb519975407d4ea0dc1478d897d451ef05dab" and "bb095608b7743a1507be70d46b11f8867b295684" have entirely different histories.

17 changed files with 167 additions and 111 deletions

View File

@ -26,7 +26,7 @@ These are the main components of the Recommendation Algorithm included in this r
| Tweet mixing & filtering | [home-mixer](home-mixer/README.md) | Main service used to construct and serve the Home Timeline. Built on [product-mixer](product-mixer/README.md). |
| | [visibility-filters](visibilitylib/README.md) | Responsible for filtering Twitter content to support legal compliance, improve product quality, increase user trust, protect revenue through the use of hard-filtering, visible product treatments, and coarse-grained downranking. |
| | [timelineranker](timelineranker/README.md) | Legacy service which provides relevance-scored tweets from the Earlybird Search Index and UTEG service. |
| Software framework | [navi](navi/README.md) | High performance, machine learning model serving written in Rust. |
| Software framework | [navi](navi/navi/README.md) | High performance, machine learning model serving written in Rust. |
| | [product-mixer](product-mixer/README.md) | Software framework for building feeds of content. |
| | [twml](twml/README.md) | Legacy machine learning framework built on TensorFlow v1. |

View File

@ -6,6 +6,8 @@ import com.twitter.search.earlybird.thriftscala.EarlybirdService
import com.twitter.search.earlybird.thriftscala.ThriftSearchQuery
import com.twitter.util.Time
import com.twitter.search.common.query.thriftjava.thriftscala.CollectorParams
import com.twitter.search.common.ranking.thriftscala.ThriftAgeDecayRankingParams
import com.twitter.search.common.ranking.thriftscala.ThriftLinearFeatureRankingParams
import com.twitter.search.common.ranking.thriftscala.ThriftRankingParams
import com.twitter.search.common.ranking.thriftscala.ThriftScoringFunctionType
import com.twitter.search.earlybird.thriftscala.ThriftSearchRelevanceOptions
@ -95,7 +97,7 @@ object EarlybirdTensorflowBasedSimilarityEngine {
// Whether to collect conversation IDs. Remove it for now.
// collectConversationId = Gate.True(), // true for Home
rankingMode = ThriftSearchRankingMode.Relevance,
relevanceOptions = Some(getRelevanceOptions),
relevanceOptions = Some(getRelevanceOptions(query.useTensorflowRanking)),
collectorParams = Some(
CollectorParams(
// numResultsToReturn defines how many results each EB shard will return to search root
@ -114,11 +116,13 @@ object EarlybirdTensorflowBasedSimilarityEngine {
// The specific values of recap relevance/reranking options correspond to
// experiment: enable_recap_reranking_2988,timeline_internal_disable_recap_filter
// bucket : enable_rerank,disable_filter
private def getRelevanceOptions: ThriftSearchRelevanceOptions = {
private def getRelevanceOptions(useTensorflowRanking: Boolean): ThriftSearchRelevanceOptions = {
ThriftSearchRelevanceOptions(
proximityScoring = true,
maxConsecutiveSameUser = Some(2),
rankingParams = Some(getTensorflowBasedRankingParams),
rankingParams =
if (useTensorflowRanking) Some(getTensorflowBasedRankingParams)
else Some(getLinearRankingParams),
maxHitsToProcess = Some(500),
maxUserBlendCount = Some(3),
proximityPhraseWeight = 9.0,
@ -127,12 +131,41 @@ object EarlybirdTensorflowBasedSimilarityEngine {
}
private def getTensorflowBasedRankingParams: ThriftRankingParams = {
ThriftRankingParams(
getLinearRankingParams.copy(
`type` = Some(ThriftScoringFunctionType.TensorflowBased),
selectedTensorflowModel = Some("timelines_rectweet_replica"),
minScore = -1.0e100,
applyBoosts = false,
authorSpecificScoreAdjustments = None
)
}
private def getLinearRankingParams: ThriftRankingParams = {
ThriftRankingParams(
`type` = Some(ThriftScoringFunctionType.Linear),
minScore = -1.0e100,
retweetCountParams = Some(ThriftLinearFeatureRankingParams(weight = 20.0)),
replyCountParams = Some(ThriftLinearFeatureRankingParams(weight = 1.0)),
reputationParams = Some(ThriftLinearFeatureRankingParams(weight = 0.2)),
luceneScoreParams = Some(ThriftLinearFeatureRankingParams(weight = 2.0)),
textScoreParams = Some(ThriftLinearFeatureRankingParams(weight = 0.18)),
urlParams = Some(ThriftLinearFeatureRankingParams(weight = 2.0)),
isReplyParams = Some(ThriftLinearFeatureRankingParams(weight = 1.0)),
favCountParams = Some(ThriftLinearFeatureRankingParams(weight = 30.0)),
langEnglishUIBoost = 0.5,
langEnglishTweetBoost = 0.2,
langDefaultBoost = 0.02,
unknownLanguageBoost = 0.05,
offensiveBoost = 0.1,
inTrustedCircleBoost = 3.0,
multipleHashtagsOrTrendsBoost = 0.6,
inDirectFollowBoost = 4.0,
tweetHasTrendBoost = 1.1,
selfTweetBoost = 2.0,
tweetHasImageUrlBoost = 2.0,
tweetHasVideoUrlBoost = 2.0,
useUserLanguageInfo = true,
ageDecayParams = Some(ThriftAgeDecayRankingParams(slope = 0.005, base = 1.0))
)
}
}

View File

@ -15,6 +15,28 @@ object RelevanceSearchUtil {
`type` = Some(scr.ThriftScoringFunctionType.TensorflowBased),
selectedTensorflowModel = Some("timelines_rectweet_replica"),
minScore = -1.0e100,
retweetCountParams = Some(scr.ThriftLinearFeatureRankingParams(weight = 20.0)),
replyCountParams = Some(scr.ThriftLinearFeatureRankingParams(weight = 1.0)),
reputationParams = Some(scr.ThriftLinearFeatureRankingParams(weight = 0.2)),
luceneScoreParams = Some(scr.ThriftLinearFeatureRankingParams(weight = 2.0)),
textScoreParams = Some(scr.ThriftLinearFeatureRankingParams(weight = 0.18)),
urlParams = Some(scr.ThriftLinearFeatureRankingParams(weight = 2.0)),
isReplyParams = Some(scr.ThriftLinearFeatureRankingParams(weight = 1.0)),
favCountParams = Some(scr.ThriftLinearFeatureRankingParams(weight = 30.0)),
langEnglishUIBoost = 0.5,
langEnglishTweetBoost = 0.2,
langDefaultBoost = 0.02,
unknownLanguageBoost = 0.05,
offensiveBoost = 0.1,
inTrustedCircleBoost = 3.0,
multipleHashtagsOrTrendsBoost = 0.6,
inDirectFollowBoost = 4.0,
tweetHasTrendBoost = 1.1,
selfTweetBoost = 2.0,
tweetHasImageUrlBoost = 2.0,
tweetHasVideoUrlBoost = 2.0,
useUserLanguageInfo = true,
ageDecayParams = Some(scr.ThriftAgeDecayRankingParams(slope = 0.005, base = 1.0)),
selectedModels = Some(Map("home_mixer_unified_engagement_prod" -> 1.0)),
applyBoosts = false,
)

View File

@ -494,9 +494,6 @@ visibility_library_enable_trends_representative_tweet_safety_level:
visibility_library_enable_trusted_friends_user_list_safety_level:
default_availability: 10000
visibility_library_enable_twitter_delegate_user_list_safety_level:
default_availability: 10000
visibility_library_enable_tweet_detail_safety_level:
default_availability: 10000
@ -761,7 +758,7 @@ visibility_library_enable_short_circuiting_from_blender_visibility_library:
visibility_library_enable_short_circuiting_from_search_visibility_library:
default_availability: 0
visibility_library_enable_nsfw_text_high_precision_drop_rule:
visibility_library_enable_nsfw_text_topics_drop_rule:
default_availability: 10000
visibility_library_enable_spammy_tweet_rule_verdict_logging:

View File

@ -535,9 +535,6 @@ private[visibility] object DeciderKey extends DeciderKeyEnum {
val EnableTrustedFriendsUserListSafetyLevel: Value = Value(
"visibility_library_enable_trusted_friends_user_list_safety_level"
)
val EnableTwitterDelegateUserListSafetyLevel: Value = Value(
"visibility_library_enable_twitter_delegate_user_list_safety_level"
)
val EnableTweetDetailSafetyLevel: Value = Value(
"visibility_library_enable_tweet_detail_safety_level"
)
@ -872,8 +869,8 @@ private[visibility] object DeciderKey extends DeciderKeyEnum {
"visibility_library_enable_short_circuiting_from_search_visibility_library"
)
val EnableNsfwTextHighPrecisionDropRule: Value = Value(
"visibility_library_enable_nsfw_text_high_precision_drop_rule"
val EnableNsfwTextTopicsDropRule: Value = Value(
"visibility_library_enable_nsfw_text_topics_drop_rule"
)
val EnableSpammyTweetRuleVerdictLogging: Value = Value(

View File

@ -198,7 +198,6 @@ private[visibility] object VisibilityDeciders {
TopicRecommendations -> DeciderKey.EnableTopicRecommendationsSafetyLevel,
TrendsRepresentativeTweet -> DeciderKey.EnableTrendsRepresentativeTweetSafetyLevel,
TrustedFriendsUserList -> DeciderKey.EnableTrustedFriendsUserListSafetyLevel,
TwitterDelegateUserList -> DeciderKey.EnableTwitterDelegateUserListSafetyLevel,
TweetDetail -> DeciderKey.EnableTweetDetailSafetyLevel,
TweetDetailNonToo -> DeciderKey.EnableTweetDetailNonTooSafetyLevel,
TweetEngagers -> DeciderKey.EnableTweetEngagersSafetyLevel,
@ -288,7 +287,7 @@ private[visibility] object VisibilityDeciders {
RuleParams.EnableDropAllTrustedFriendsTweetsRuleParam -> DeciderKey.EnableDropAllTrustedFriendsTweetsRule,
RuleParams.EnableDropTrustedFriendsTweetContentRuleParam -> DeciderKey.EnableDropTrustedFriendsTweetContentRule,
RuleParams.EnableDropAllCollabInvitationTweetsRuleParam -> DeciderKey.EnableDropCollabInvitationTweetsRule,
RuleParams.EnableNsfwTextHighPrecisionDropRuleParam -> DeciderKey.EnableNsfwTextHighPrecisionDropRule,
RuleParams.EnableNsfwTextTopicsDropRuleParam -> DeciderKey.EnableNsfwTextTopicsDropRule,
RuleParams.EnableLikelyIvsUserLabelDropRule -> DeciderKey.EnableLikelyIvsUserLabelDropRule,
RuleParams.EnableCardUriRootDomainCardDenylistRule -> DeciderKey.EnableCardUriRootDomainDenylistRule,
RuleParams.EnableCommunityNonMemberPollCardRule -> DeciderKey.EnableCommunityNonMemberPollCardRule,

View File

@ -85,7 +85,7 @@ private[visibility] object RuleParams {
object EnableDropAllCollabInvitationTweetsRuleParam extends RuleParam(false)
object EnableNsfwTextHighPrecisionDropRuleParam extends RuleParam(false)
object EnableNsfwTextTopicsDropRuleParam extends RuleParam(false)
object EnableLikelyIvsUserLabelDropRule extends RuleParam(false)

View File

@ -186,7 +186,6 @@ private[visibility] object SafetyLevelParams {
object EnableTopicRecommendationsSafetyLevelParam extends SafetyLevelParam(false)
object EnableTrendsRepresentativeTweetSafetyLevelParam extends SafetyLevelParam(false)
object EnableTrustedFriendsUserListSafetyLevelParam extends SafetyLevelParam(false)
object EnableTwitterDelegateUserListSafetyLevelParam extends SafetyLevelParam(false)
object EnableTweetDetailSafetyLevelParam extends SafetyLevelParam(false)
object EnableTweetDetailNonTooSafetyLevelParam extends SafetyLevelParam(false)
object EnableTweetDetailWithInjectionsHydrationSafetyLevelParam extends SafetyLevelParam(false)

View File

@ -143,7 +143,7 @@ class VisibilityRuleEngine private[VisibilityRuleEngine] (
builder.withRuleResult(rule, RuleResult(builder.verdict, ShortCircuited))
} else {
if (failedFeatureDependencies.nonEmpty && rule.fallbackActionBuilder.nonEmpty) {
if (rule.fallbackActionBuilder.nonEmpty) {
metricsRecorder.recordRuleFallbackAction(rule.name)
}

View File

@ -194,7 +194,6 @@ object SafetyLevel {
ThriftSafetyLevel.TopicsLandingPageTopicRecommendations -> TopicsLandingPageTopicRecommendations,
ThriftSafetyLevel.TrendsRepresentativeTweet -> TrendsRepresentativeTweet,
ThriftSafetyLevel.TrustedFriendsUserList -> TrustedFriendsUserList,
ThriftSafetyLevel.TwitterDelegateUserList -> TwitterDelegateUserList,
ThriftSafetyLevel.GryphonDecksAndColumns -> GryphonDecksAndColumns,
ThriftSafetyLevel.TweetDetail -> TweetDetail,
ThriftSafetyLevel.TweetDetailNonToo -> TweetDetailNonToo,
@ -773,9 +772,6 @@ object SafetyLevel {
case object TrustedFriendsUserList extends SafetyLevel {
override val enabledParam: SafetyLevelParam = EnableTrustedFriendsUserListSafetyLevelParam
}
case object TwitterDelegateUserList extends SafetyLevel {
override val enabledParam: SafetyLevelParam = EnableTwitterDelegateUserListSafetyLevelParam
}
case object TweetDetail extends SafetyLevel {
override val enabledParam: SafetyLevelParam = EnableTweetDetailSafetyLevelParam
}

View File

@ -379,6 +379,13 @@ object SafetyLevelGroup {
)
}
case object ProfileMixer extends SafetyLevelGroup {
override val levels: Set[SafetyLevel] = Set(
ProfileMixerMedia,
ProfileMixerFavorites,
)
}
case object Reactions extends SafetyLevelGroup {
override val levels: Set[SafetyLevel] = Set(
SignalsReactions,
@ -509,10 +516,6 @@ object SafetyLevelGroup {
SafetyLevel.TimelineProfile,
TimelineProfileAll,
TimelineProfileSpaces,
TimelineMedia,
ProfileMixerMedia,
TimelineFavorites,
ProfileMixerFavorites
)
}

View File

@ -36,8 +36,8 @@ object SpaceSafetyLabelType extends SafetyLabelType {
s.SpaceSafetyLabelType.HatefulHighRecall -> HatefulHighRecall,
s.SpaceSafetyLabelType.ViolenceHighRecall -> ViolenceHighRecall,
s.SpaceSafetyLabelType.HighToxicityModelScore -> HighToxicityModelScore,
s.SpaceSafetyLabelType.DeprecatedSpaceSafetyLabel14 -> Deprecated,
s.SpaceSafetyLabelType.DeprecatedSpaceSafetyLabel15 -> Deprecated,
s.SpaceSafetyLabelType.UkraineCrisisTopic -> UkraineCrisisTopic,
s.SpaceSafetyLabelType.DoNotPublicPublish -> DoNotPublicPublish,
s.SpaceSafetyLabelType.Reserved16 -> Deprecated,
s.SpaceSafetyLabelType.Reserved17 -> Deprecated,
s.SpaceSafetyLabelType.Reserved18 -> Deprecated,
@ -69,6 +69,10 @@ object SpaceSafetyLabelType extends SafetyLabelType {
case object ViolenceHighRecall extends SpaceSafetyLabelType
case object HighToxicityModelScore extends SpaceSafetyLabelType
case object UkraineCrisisTopic extends SpaceSafetyLabelType
case object DoNotPublicPublish extends SpaceSafetyLabelType
case object Deprecated extends SpaceSafetyLabelType
case object Unknown extends SpaceSafetyLabelType

View File

@ -3,7 +3,6 @@ package com.twitter.visibility.rules
import com.twitter.spam.rtf.thriftscala.SafetyResultReason
import com.twitter.util.Memoize
import com.twitter.visibility.common.actions.AppealableReason
import com.twitter.visibility.common.actions.AvoidReason.MightNotBeSuitableForAds
import com.twitter.visibility.common.actions.LimitedEngagementReason
import com.twitter.visibility.common.actions.SoftInterventionDisplayType
import com.twitter.visibility.common.actions.SoftInterventionReason
@ -441,6 +440,36 @@ object FreedomOfSpeechNotReachActions {
}
}
case class ConversationSectionAbusiveQualityAction(
violationLevel: ViolationLevel = DefaultViolationLevel)
extends FreedomOfSpeechNotReachActionBuilder[ConversationSectionAbusiveQuality.type] {
override def actionType: Class[_] = ConversationSectionAbusiveQuality.getClass
override val actionSeverity = 5
private def toRuleResult: Reason => RuleResult = Memoize { r =>
RuleResult(ConversationSectionAbusiveQuality, Evaluated)
}
def build(evaluationContext: EvaluationContext, featureMap: Map[Feature[_], _]): RuleResult = {
val appealableReason =
FreedomOfSpeechNotReach.extractTweetSafetyLabel(featureMap).map(_.labelType) match {
case Some(label) =>
FreedomOfSpeechNotReach.eligibleTweetSafetyLabelTypesToAppealableReason(
label,
violationLevel)
case _ =>
AppealableReason.Unspecified(violationLevel.level)
}
toRuleResult(Reason.fromAppealableReason(appealableReason))
}
override def withViolationLevel(violationLevel: ViolationLevel) = {
copy(violationLevel = violationLevel)
}
}
case class SoftInterventionAvoidAction(violationLevel: ViolationLevel = DefaultViolationLevel)
extends FreedomOfSpeechNotReachActionBuilder[TweetInterstitial] {
@ -633,9 +662,6 @@ object FreedomOfSpeechNotReachRules {
override def enabled: Seq[RuleParam[Boolean]] =
Seq(EnableFosnrRuleParam, FosnrRulesEnabledParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
case class ViewerIsNonFollowerNonAuthorAndTweetHasViolationOfLevel(
@ -652,9 +678,6 @@ object FreedomOfSpeechNotReachRules {
override def enabled: Seq[RuleParam[Boolean]] =
Seq(EnableFosnrRuleParam, FosnrRulesEnabledParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
case class ViewerIsNonAuthorAndTweetHasViolationOfLevel(
@ -669,9 +692,6 @@ object FreedomOfSpeechNotReachRules {
override def enabled: Seq[RuleParam[Boolean]] =
Seq(EnableFosnrRuleParam, FosnrRulesEnabledParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
case object TweetHasViolationOfAnyLevelFallbackDropRule

View File

@ -188,7 +188,6 @@ object RuleBase {
TopicRecommendations -> TopicRecommendationsPolicy,
TrendsRepresentativeTweet -> TrendsRepresentativeTweetPolicy,
TrustedFriendsUserList -> TrustedFriendsUserListPolicy,
TwitterDelegateUserList -> TwitterDelegateUserListPolicy,
TweetDetail -> TweetDetailPolicy,
TweetDetailNonToo -> TweetDetailNonTooPolicy,
TweetDetailWithInjectionsHydration -> TweetDetailWithInjectionsHydrationPolicy,

View File

@ -144,9 +144,6 @@ object NsfwCardImageAvoidAllUsersTweetLabelRule
action = Avoid(Some(AvoidReason.ContainsNsfwMedia)),
) {
override def enabled: Seq[RuleParam[Boolean]] = Seq(EnableAvoidNsfwRulesParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
object NsfwCardImageAvoidAdPlacementAllUsersTweetLabelRule
@ -250,9 +247,6 @@ object GoreAndViolenceHighPrecisionAvoidAllUsersTweetLabelRule
TweetSafetyLabelType.GoreAndViolenceHighPrecision
) {
override def enabled: Seq[RuleParam[Boolean]] = Seq(EnableAvoidNsfwRulesParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
object GoreAndViolenceHighPrecisionAllUsersTweetLabelRule
@ -272,9 +266,6 @@ object NsfwReportedHeuristicsAvoidAllUsersTweetLabelRule
TweetSafetyLabelType.NsfwReportedHeuristics
) {
override def enabled: Seq[RuleParam[Boolean]] = Seq(EnableAvoidNsfwRulesParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
object NsfwReportedHeuristicsAvoidAdPlacementAllUsersTweetLabelRule
@ -283,9 +274,6 @@ object NsfwReportedHeuristicsAvoidAdPlacementAllUsersTweetLabelRule
TweetSafetyLabelType.NsfwReportedHeuristics
) {
override def enabled: Seq[RuleParam[Boolean]] = Seq(EnableAvoidNsfwRulesParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
object NsfwReportedHeuristicsAllUsersTweetLabelRule
@ -306,9 +294,6 @@ object GoreAndViolenceReportedHeuristicsAvoidAllUsersTweetLabelRule
TweetSafetyLabelType.GoreAndViolenceReportedHeuristics
) {
override def enabled: Seq[RuleParam[Boolean]] = Seq(EnableAvoidNsfwRulesParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
object GoreAndViolenceReportedHeuristicsAvoidAdPlacementAllUsersTweetLabelRule
@ -317,9 +302,6 @@ object GoreAndViolenceReportedHeuristicsAvoidAdPlacementAllUsersTweetLabelRule
TweetSafetyLabelType.GoreAndViolenceReportedHeuristics
) {
override def enabled: Seq[RuleParam[Boolean]] = Seq(EnableAvoidNsfwRulesParam)
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
object GoreAndViolenceHighPrecisionAllUsersTweetLabelDropRule
@ -809,7 +791,7 @@ object SkipTweetDetailLimitedEngagementTweetLabelRule
object DynamicProductAdDropTweetLabelRule
extends TweetHasLabelRule(Drop(Unspecified), TweetSafetyLabelType.DynamicProductAd)
object NsfwTextHighPrecisionTweetLabelDropRule
object NsfwTextTweetLabelTopicsDropRule
extends RuleWithConstantAction(
Drop(Reason.Nsfw),
And(
@ -821,7 +803,7 @@ object NsfwTextHighPrecisionTweetLabelDropRule
)
)
with DoesLogVerdict {
override def enabled: Seq[RuleParam[Boolean]] = Seq(EnableNsfwTextHighPrecisionDropRuleParam)
override def enabled: Seq[RuleParam[Boolean]] = Seq(EnableNsfwTextTopicsDropRuleParam)
override def actionSourceBuilder: Option[RuleActionSourceBuilder] = Some(
TweetSafetyLabelSourceBuilder(TweetSafetyLabelType.NsfwTextHighPrecision))
}
@ -850,10 +832,7 @@ object DoNotAmplifyTweetLabelAvoidRule
extends TweetHasLabelRule(
Avoid(),
TweetSafetyLabelType.DoNotAmplify
) {
override val fallbackActionBuilder: Option[ActionBuilder[_ <: Action]] = Some(
new ConstantActionBuilder(Avoid(Some(MightNotBeSuitableForAds))))
}
)
object NsfaHighPrecisionTweetLabelAvoidRule
extends TweetHasLabelRule(

View File

@ -776,10 +776,7 @@ case object MagicRecsPolicy
tweetRules = MagicRecsPolicyOverrides.union(
RecommendationsPolicy.tweetRules.filterNot(_ == SafetyCrisisLevel3DropRule),
NotificationsIbisPolicy.tweetRules,
Seq(
NsfaHighRecallTweetLabelRule,
NsfwHighRecallTweetLabelRule,
NsfwTextHighPrecisionTweetLabelDropRule),
Seq(NsfaHighRecallTweetLabelRule, NsfwHighRecallTweetLabelRule),
Seq(
AuthorBlocksViewerDropRule,
ViewerBlocksAuthorRule,
@ -1174,7 +1171,7 @@ case object ReturningUserExperiencePolicy
NsfwHighRecallTweetLabelRule,
NsfwVideoTweetLabelDropRule,
NsfwTextTweetLabelDropRule,
NsfwTextHighPrecisionTweetLabelDropRule,
NsfwTextTweetLabelTopicsDropRule,
SpamHighRecallTweetLabelDropRule,
DuplicateContentTweetLabelDropRule,
GoreAndViolenceTweetLabelRule,
@ -1788,14 +1785,6 @@ case object TimelineListsPolicy
NsfwReportedHeuristicsAllUsersTweetLabelRule,
GoreAndViolenceReportedHeuristicsAllUsersTweetLabelRule,
NsfwCardImageAllUsersTweetLabelRule,
NsfwHighPrecisionTweetLabelAvoidRule,
NsfwHighRecallTweetLabelAvoidRule,
GoreAndViolenceHighPrecisionAvoidAllUsersTweetLabelRule,
NsfwReportedHeuristicsAvoidAllUsersTweetLabelRule,
GoreAndViolenceReportedHeuristicsAvoidAllUsersTweetLabelRule,
NsfwCardImageAvoidAllUsersTweetLabelRule,
DoNotAmplifyTweetLabelAvoidRule,
NsfaHighPrecisionTweetLabelAvoidRule,
) ++ LimitedEngagementBaseRules.tweetRules
)
@ -2143,13 +2132,7 @@ case object TimelineHomePolicy
userRules = Seq(
ViewerMutesAuthorRule,
ViewerBlocksAuthorRule,
DeciderableAuthorBlocksViewerDropRule,
ProtectedAuthorDropRule,
SuspendedAuthorRule,
DeactivatedAuthorRule,
ErasedAuthorRule,
OffboardedAuthorRule,
DropTakendownUserRule
DeciderableAuthorBlocksViewerDropRule
),
policyRuleParams = SensitiveMediaSettingsTimelineHomeBaseRules.policyRuleParams
)
@ -2188,13 +2171,7 @@ case object BaseTimelineHomePolicy
userRules = Seq(
ViewerMutesAuthorRule,
ViewerBlocksAuthorRule,
DeciderableAuthorBlocksViewerDropRule,
ProtectedAuthorDropRule,
SuspendedAuthorRule,
DeactivatedAuthorRule,
ErasedAuthorRule,
OffboardedAuthorRule,
DropTakendownUserRule
DeciderableAuthorBlocksViewerDropRule
)
)
@ -2278,13 +2255,7 @@ case object TimelineHomeLatestPolicy
userRules = Seq(
ViewerMutesAuthorRule,
ViewerBlocksAuthorRule,
DeciderableAuthorBlocksViewerDropRule,
ProtectedAuthorDropRule,
SuspendedAuthorRule,
DeactivatedAuthorRule,
ErasedAuthorRule,
OffboardedAuthorRule,
DropTakendownUserRule
DeciderableAuthorBlocksViewerDropRule
),
policyRuleParams = SensitiveMediaSettingsTimelineHomeBaseRules.policyRuleParams
)
@ -3312,7 +3283,7 @@ case object TopicRecommendationsPolicy
tweetRules =
Seq(
NsfwHighRecallTweetLabelRule,
NsfwTextHighPrecisionTweetLabelDropRule
NsfwTextTweetLabelTopicsDropRule
)
++ RecommendationsPolicy.tweetRules,
userRules = RecommendationsPolicy.userRules
@ -3565,17 +3536,6 @@ case object TrustedFriendsUserListPolicy
)
)
case object TwitterDelegateUserListPolicy
extends VisibilityPolicy(
userRules = Seq(
ViewerBlocksAuthorRule,
ViewerIsAuthorDropRule,
DeactivatedAuthorRule,
AuthorBlocksViewerDropRule
),
tweetRules = Seq(DropAllRule)
)
case object QuickPromoteTweetEligibilityPolicy
extends VisibilityPolicy(
tweetRules = TweetDetailPolicy.tweetRules,

View File

@ -100,6 +100,30 @@ object TweetRuleGenerator {
FreedomOfSpeechNotReachActions.SoftInterventionAvoidLimitedEngagementsAction(
limitedActionStrings = Some(level3LimitedActions))
)
.addSafetyLevelRule(
SafetyLevel.TimelineMedia,
FreedomOfSpeechNotReachActions
.SoftInterventionAvoidLimitedEngagementsAction(limitedActionStrings =
Some(level3LimitedActions))
)
.addSafetyLevelRule(
SafetyLevel.ProfileMixerMedia,
FreedomOfSpeechNotReachActions
.SoftInterventionAvoidLimitedEngagementsAction(limitedActionStrings =
Some(level3LimitedActions))
)
.addSafetyLevelRule(
SafetyLevel.TimelineFavorites,
FreedomOfSpeechNotReachActions
.SoftInterventionAvoidLimitedEngagementsAction(limitedActionStrings =
Some(level3LimitedActions))
)
.addSafetyLevelRule(
SafetyLevel.ProfileMixerFavorites,
FreedomOfSpeechNotReachActions
.SoftInterventionAvoidLimitedEngagementsAction(limitedActionStrings =
Some(level3LimitedActions))
)
.build,
UserType.Author -> TweetVisibilityPolicy
.builder()
@ -135,6 +159,30 @@ object TweetRuleGenerator {
.InterstitialLimitedEngagementsAvoidAction(limitedActionStrings =
Some(level3LimitedActions))
)
.addSafetyLevelRule(
SafetyLevel.TimelineMedia,
FreedomOfSpeechNotReachActions
.InterstitialLimitedEngagementsAvoidAction(limitedActionStrings =
Some(level3LimitedActions))
)
.addSafetyLevelRule(
SafetyLevel.ProfileMixerMedia,
FreedomOfSpeechNotReachActions
.InterstitialLimitedEngagementsAvoidAction(limitedActionStrings =
Some(level3LimitedActions))
)
.addSafetyLevelRule(
SafetyLevel.TimelineFavorites,
FreedomOfSpeechNotReachActions
.InterstitialLimitedEngagementsAvoidAction(limitedActionStrings =
Some(level3LimitedActions))
)
.addSafetyLevelRule(
SafetyLevel.ProfileMixerFavorites,
FreedomOfSpeechNotReachActions
.InterstitialLimitedEngagementsAvoidAction(limitedActionStrings =
Some(level3LimitedActions))
)
.build,
),
)