Fix: exclude blocked users from ghost monitor#299
Merged
Conversation
Member
Author
|
STAFF ENGINEER REVIEW: APPROVED — Structural diff review, Codex review, targeted CSO pass, and narrow SQL verification are clean. No new SQL interpolation, recommendation-weight change, or secret exposure found. Ready to queue squash auto-merge if required checks are not red. |
Member
Author
|
✅ Approved + merged. |
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.
Fixes FFM-1409.
What
u.blocked_bot_at IS NULLto the ghost-user monitor candidate filter.Why
PR #297 preserved normal user roles when users block the bot, moving current block state to
blocked_bot_at. The ghost monitor still only excluded legacytype = blocked_bot, so new users who blocked the bot before receiving a meme could produce false WARN/ERROR alerts.Verification
ruff check --fix src/ tests/ruff format src/ tests/DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/db REDIS_URL=redis://localhost:6379/0 CORS_ORIGINS=["*"] CORS_HEADERS=["*"] TELEGRAM_BOT_TOKEN=123456:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgh python3 -c "from src.flows.monitors.ghost_users import _ghost_count_sql; sql = _ghost_count_sql(); assert 'u.blocked_bot_at IS NULL' in sql; assert \"u.type NOT IN ('blocked_bot', 'banned', 'waitlist')\" in sql; print('ghost SQL excludes blocked_bot_at users')"