Skip to content

refactor(telegram): use backend SDK v4 and drop legacy actor and role checks - #158

Merged
toto04 merged 2 commits into
mainfrom
chore/backend-sdk-v2
Oct 26, 2026
Merged

toto04 merged 2 commits into
mainfrom
chore/backend-sdk-v2

Conversation

@BIA3IA

@BIA3IA BIA3IA commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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: uses actorTgId only. Migration 0021 copied admin_id into actor_tg_id for older rows, and the Phase 5 backend always writes it.
  • Socket logGrantCreate / logGrantInterrupt: the grantor comes from actor, which the backend always sends. adminId is no longer read. A missing actor can no longer fail the log; only a missing target can.
  • Socket leaveChat: logs performer only, without performerId.
  • Role-based command checks removed from src/lib/managed-commands: allowedRoles / excludedRoles, the getUserRoles option, the "role" outcome of PermissionCheck and the TRole type parameter (CommandsCollection<string, …> → CommandsCollection<…>).
    • Dead code since Phase 5: the bot never passed getUserRoles and no command declared roles, so behaviour does not change.
    • Commands keep declaring 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.

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`.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 43cdf55e-4c06-4d65-af75-5ff2070cd342
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…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.
@BIA3IA BIA3IA changed the title refactor(telegram): use backend SDK v2 and drop legacy actor fallbacks refactor(telegram): use backend SDK v4 and drop legacy actor and role checks Oct 26, 2026
@toto04
toto04 merged commit c46b6a1 into main Oct 26, 2026
2 checks passed
@toto04
toto04 deleted the chore/backend-sdk-v2 branch October 26, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants