Repository navigation
feat(filters): channel probe — pre-add quality card from a LIVE sample - #1622
Merged
Merged
Conversation
Scenario 3+4 followup: before adding a discovered channel, sample its recent posts straight from Telegram and judge the quality — no DB write, no channel row. - tg_agent/filters/probe.py: pure function over ProbeMessage snapshots (text/views/forward/urls) + participants_count; thresholds are IMPORTED from criteria.py so a probe flag and a post-collect `filter analyze` flag mean the same thing. Sample guard: <30 posts = insufficient (the analyzer's own 30-post statistics guard). DB-history metrics (cross_channel_spam, low_subscriber_ratio) are reported as not_checked. - `channel probe <id|@username> [--limit 300] [--json]`: live read via the session pool (floodgate-wrapped), subscribers via GetFullChannelRequest; resolves without fetch_channel_meta so no phone-map/dialog-cache writes. Default N=300 — the analyzer's calibrated quick-sample size (99.65% agreement with the full scan); 100 is the engagement/forward window. - discovery.md step 3.5: probe every short-list candidate before user approval; forwarder/auto_feed/low_engagement flags sink the candidate. - command_manifest: channel probe = safe_ro (live read, no DB write). Co-Authored-By: Claude Code <noreply@anthropic.com>
CI on #1622 caught probe_impl in three regression guards: - test_real_telegram_policy: a parser leaf needs live coverage or an excluded-manifest entry — safe_ro/test_channel_probe.py covers it (real_tg_safe, gated, mirrors `messages read --live`) - test_cli_pool_classification: probe_impl classified RUNS_ANYWAY (read-only live card, no worker-queue equivalent) - test_client_pool_lease_stress: probe_impl joins the lease-ownership allowlist (one-shot CLI; disconnect_all() in finally clears the lease) Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
Что и зачем
Ответ на вопрос владельца «сколько постов нужно, чтобы определить качество канала?» — из
калибровок самого кода: 300 (quick-сэмпл анализатора, 99.65% совпадения с полным сканом),
окно engagement/forward — 100, минимум статистики — 30. Фича:
channel probe— карточкакачества канала по живым последним постам до добавления в базу (сценарии 3+4: discovery
шорт-лист → probe → одобрение владельца).
tg_agent/filters/probe.py— чистая функция над снапшотами постов: low_engagement(views vs подписчики, окно-100), forwarder (label-only), auto_feed (короткие+ссылка,
masked-ссылки из entities), low_uniqueness, non_cyrillic (label-only), chat_noise,
suspicious_username, low_subscribers (min_subscribers_filter). Пороги импортируются из
criteria.py — probe-флаг и пост-коллект-флаг означают одно и то же. <30 постов =
insufficient. Метрики, требующие собранной истории (cross_channel_spam,
low_subscriber_ratio), — в
not_checked.channel probe <id|@username> [--limit 300] [--json]— live-чтение через session pool(floodgate), подписчики через GetFullChannelRequest; резолв мимо fetch_channel_meta, чтобы
не писать phone-map/dialog-cache. Никаких записей в channels/messages.
forwarder/auto_feed/low_engangement топят кандидата.
channel probe= safe_ro.Тесты
tests/test_filters_probe.py: каждая метрика pos/neg, guard <30, порогииз criteria (12 passed); policy + test_levels зелёные.
на известном мусорном канале.
🤖 Generated with Claude Code