Commit 0d1494d
authored
ops(broadcast): ghost-user recovery script (#223)
* ops(broadcast): one-shot ghost-user recovery script
Targets users registered in the last 12 months who never had a single
meme delivered (no row in user_meme_reaction). They were silently
locked out by onboarding bugs — most via the kitchen deep_link path
that returned before init_user_languages_from_tg_user (fixed forward
in PR #222), some via other early-return drift.
Sega (#370728472) was case zero — registered 2026-04-01 via
?start=kitchen, no language rows, "мемы кончились" on every /start.
After manual backfill + apology DM he immediately produced a healthy
session (4 likes / 1 dislike / 7 sent in 22 min, 80% positive).
Scope:
- 66 candidates total (40 RU, 26 EN) at the time of writing
- Filtered: blocked_bot_at IS NULL, type NOT IN blocked/banned/waitlist
- Dedup: reuses send_broadcast Redis-set marker per broadcast_id
- Default 0.5s delay (~2/s) — very conservative for a small list
Run:
PYTHONPATH=/src python scripts/broadcast_ghost_recovery.py \
ghost-recovery-2026-05 --dry-run
PYTHONPATH=/src python scripts/broadcast_ghost_recovery.py \
ghost-recovery-2026-05
Same shape as scripts/broadcast_wrapped.py — no new infra.
* ops(broadcast): drop dead 'banned' filter from ghost recovery query
UserType has no 'banned' value (src/tgbot/constants.py) — the filter is
a no-op. Drop it so the WHERE clause reflects actual reachable types.
Branch was also rebased onto production to pull in PR #222's lazy
language-init in handle_start. The recommended SE fix B (repair-on-start)
is now active for both new and existing users (start.py:124-125), so the
broadcast's "/start" CTA will trigger language backfill and unblock the
recommendation queue for ghost recipients.
Addresses Staff Engineer review on #223.1 parent ffc0309 commit 0d1494d
1 file changed
Lines changed: 94 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
0 commit comments