From 6e44154d56d9c704fc5060cf6a61c2ab74d18531 Mon Sep 17 00:00:00 2001 From: "S. B. | Software Developer" <87614560+SB2318@users.noreply.github.com> Date: Fri, 11 Sep 2026 07:34:43 +0530 Subject: [PATCH] chore(ranking_scorer): add negative weight assertions and document quote tweet boost eligibility --- home-mixer/scorers/ranking_scorer.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/home-mixer/scorers/ranking_scorer.rs b/home-mixer/scorers/ranking_scorer.rs index b0e9bbd4..6a83368e 100644 --- a/home-mixer/scorers/ranking_scorer.rs +++ b/home-mixer/scorers/ranking_scorer.rs @@ -149,6 +149,16 @@ impl ScoringWeights { } fn recompute_sums(&mut self) { + // Negative action weights are configured as negative floats (e.g., -43.2). + // Asserting non-positive magnitude prevents sign inversion misconfigurations. + debug_assert!( + self.not_interested <= 0.0 + && self.block_author <= 0.0 + && self.mute_author <= 0.0 + && self.report <= 0.0 + && self.not_dwelled <= 0.0, + "Negative action weights must be non-positive values" + ); let positive_sum = self.favorite + self.reply + self.retweet @@ -241,6 +251,10 @@ impl ScoringWeights { !self.post_unexplored_in_network_only || candidate.in_network == Some(true) } + /// Determines if a post candidate is eligible for the mutual follow boost. + /// Excludes replies (`in_reply_to_tweet_id`) and retweets (`retweeted_tweet_id`). + /// Note: Quote tweets are intentionally eligible because they contain new original commentary + /// authored by the mutual-follow user. fn bidirectional_boost_eligible(candidate: &PostCandidate) -> bool { candidate.in_reply_to_tweet_id.is_none() && candidate.retweeted_tweet_id.is_none()