Repository navigation
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
People needs who administers each Telegram group, and Telegram is the only source (RFC v3 decision 2). The bot keeps a cache of getChatAdministrators (without bots) in Redis and answers the backend's getGroupAdmins over the socket; the backend stores nothing. The cache is refreshed when someone becomes or stops being an admin, once a burst of changes settles; 30 seconds after the bot is promoted in a group; and for every group 2 minutes after startup and every 6 hours, one Telegram request at a time. Entries expire after a day, so a group the bot can no longer read becomes unknown instead of stale. Needs @polinetwork/backend with getGroupAdmins (PoliNetworkOrg/backend#98).
BIA3IA
force-pushed
the
feat/sync-group-admins
branch
from
October 26, 2026 19:59
91a99ab to
ff078fc
Compare
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.
Summary
Bot side of PoliNetworkOrg/backend#98. People needs who administers each Telegram group, and Telegram is the only source (RFC v3 decision 2). The backend stores nothing: it asks the bot.
getChatAdministrators(without bots) in Redis (group_admins:<chatId>, throughRedisFallbackAdapter, so it falls back to memory when Redis is down). Entries expire after a day, so a group the bot can no longer read becomes unknown instead of stale.getGroupAdminsreturns the cached admins of the requested groups, leaving out groups not read yet.chat_member), once a burst of changes in that chat settles (5 s);The middleware runs right after
BotMembershipHandler, before the moderation handlers that end the chain onchat_member. The logic is insrc/lib/group-adminswith injected dependencies, so it is tested without Telegram, Redis or the backend.getGroupAdminsis not in the published@polinetwork/backendsocket types yet, so CI typecheck fails on this branch. After backend#98 is merged and released, bump@polinetwork/backendhere, then mark ready. Deploy the bot together with or before the backend: an older bot just doesn't answer, and People shows groups without admins.Verification
Against the SDK built locally from backend#98:
pnpm typecheck,biome check,pnpm build: OK.pnpm test: 192 passed, 1 skipped. New tests: who counts as an admin, which updates trigger a refresh, debouncing, failures keeping the previous entry, the full refresh, and the answer to the backend.