chore: back-merge master → develop (dedup #4852 prod cherry-picks)#4854
Open
mashbean wants to merge 4 commits into
Open
chore: back-merge master → develop (dedup #4852 prod cherry-picks)#4854mashbean wants to merge 4 commits into
mashbean wants to merge 4 commits into
Conversation
…ify-only)
A high spam score alone can't separate true spam from false positives: on
matters_prod (7-day, >=0.94 band) precision is only ~60% — escort ads (0.996)
score the same as 中文 creative writing (0.992) and short genuine replies.
Account age doesn't separate either (an escort account was 818d old / 883
articles). What cleanly partitions them (ZERO false positives on the real
high-score set) is a compound gate:
Tier A (auto): score>=threshold AND contact-channel AND solicitation-keyword
→ escort / paid-services / account-selling / betting promo.
Tier B (ring): author repeats near-identical content across comments.
Tier C (review): high score but neither → surface to humans, never auto-act
(creative writing / opinions / replies land here).
This wires the gate into detectSpam and surfaces all three tiers to the admin
Telegram chat by reusing the existing report-alert SQS → reportTelegramAlert
pipeline (new source 'spam_detection'). NOTIFY-ONLY: it never hides a comment —
auto-action stays behind the separate, still-off commentSpamAutoCollapse flag —
so we validate the gate's precision in production before enabling enforcement.
Gated by MATTERS_COMMENT_SPAM_ALERT (default off).
Signal logic lives in a pure, fully unit-tested module (commentSpamSignals.ts);
the ring check is one bounded read of the author's recent comments, run only for
the rare high-score comments.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The ring near-duplicate check only stripped bare digits, so a rotated contact token (sk3826, abc123) left a letter remnant (sk, abc) and otherwise-identical spam templates failed to match. Drop whole alphanumeric tokens containing a digit instead — the IDs/phone numbers spammers rotate — while keeping pure-letter words so English templates still ring-match. Fixes the two failing ring tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…prod deploy(comment-spam): 3-tier telegram alerting to prod (notify-only, curated)
…ter-after-4852 # Conflicts: # src/connectors/commentService.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4854 +/- ##
========================================
Coverage 72.68% 72.68%
========================================
Files 1068 1068
Lines 21246 21246
Branches 4641 4641
========================================
Hits 15442 15442
Misses 5325 5325
Partials 479 479 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的(git hygiene,延續 #4850)
#4852 將三層告警 curated cherry-pick 上
master生產後,master又多出 3 個develop沒有的 commit(內容與 develop 經 #4851 進來的相同,但 hash 不同)。若不處理,下次七日書批次develop→master發布會與這些 cherry-pick 衝突/產生重複歷史。本 PR back-merge
master → develop,使master重新成為develop的祖先,去重 lineage。與 #4850 同樣手法。內容
src/connectors/commentService.ts的CampaignServiceimport——master(deploy(comment-spam): 3-tier telegram alerting to prod (notify-only, curated) #4852 解衝突時)丟掉了它,但develop的七日書(campaign discussion)在commentService.ts:707用到它。保留 import。master為祖先;七日書檔案(putQuote.ts等)完整未被影響。無新增程式碼,純 lineage 合併。
🤖 Generated with Claude Code