Repository navigation
refactor(telegram): use backend SDK v4 and drop legacy actor and role checks - #158
Merged
Merged
Conversation
Moves @polinetwork/backend from ^1.4.0 to ^2.3.0. The backend has sent the actor on every grant log and leaveChat event since Phase 5, and migration 0021 copied admin_id into actor_tg_id for older audit rows, so the bot no longer reads `adminId` or `performerId`.
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
toto04
approved these changes
Oct 26, 2026
…ecks Backend 4.0.0 (RFC v3 Phase 6) removed the legacy login and permission tables; the bot already authorizes commands with IdP permissions. The managed-commands library still carried the old role model: `allowedRoles` / `excludedRoles`, the `getUserRoles` option and the `TRole` type parameter. The bot never passed `getUserRoles` and no command declared roles, so the check always fell through. Remove them; the built-in check keeps only the group admin shortcut, and commands declare `requiredPermissions` through the bot's access control.
toto04
approved these changes
Oct 26, 2026
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
Telegram side of RFC v3 Phase 6.
@polinetwork/backend:^1.4.0→^4.0.0, the release that drops the backend's legacy login and permission tables. None of the removed exports (AUTH_PATH,USER_ROLE,TelegramPlugin) are used by the bot./audit: usesactorTgIdonly. Migration 0021 copiedadmin_idintoactor_tg_idfor older rows, and the Phase 5 backend always writes it.logGrantCreate/logGrantInterrupt: the grantor comes fromactor, which the backend always sends.adminIdis no longer read. A missing actor can no longer fail the log; only a missing target can.leaveChat: logsperformeronly, withoutperformerId.src/lib/managed-commands:allowedRoles/excludedRoles, thegetUserRolesoption, the"role"outcome ofPermissionCheckand theTRoletype parameter (CommandsCollection<string, …>→CommandsCollection<…>).getUserRolesand no command declared roles, so behaviour does not change.requiredPermissions(IdP permissions) and the group admin shortcut (allowGroupAdmins).Compatible with the backend in production, so it can be merged at any time.
Verification
pnpm typecheck,pnpm check,pnpm build: OK.pnpm test: 184 passed, 1 skipped.