Skip to content

feat(groups): regenerate all invite links - #149

Merged
lorenzocorallo merged 1 commit into
mainfrom
feat/regenerate-group-links
Sep 6, 2026
Merged

lorenzocorallo merged 1 commit into
mainfrom
feat/regenerate-group-links

Conversation

@lorenzocorallo

Copy link
Copy Markdown
Member

Summary

  • add the private, owner/direttivo-only /regenerate_group_links confirm command
  • regenerate every stored group primary invite link through Telegram, which revokes each previous primary link
  • persist regenerated links in bounded backend batches so /search, /invite, and link lookups use the replacements
  • log operation start, completion, counts, and bounded failure details in the Group Management topic of Gestione Bot - PoliNetwork

Safety and performance

  • require an explicit confirm argument before the irreversible operation
  • abort before rotating links unless the required start audit entry is delivered
  • prevent overlapping runs within the single-replica bot process
  • pace Telegram calls to about 10 request starts per second with concurrency 3 and coordinated retry_after handling
  • fetch groups once and upsert links in batches of 50, retrying transient and partial backend failures without repeating confirmed updates
  • include hidden groups because their existing links can still be abused

Failure behavior

  • continue past per-group Telegram failures and report them
  • retry backend synchronization three times and distinguish regenerated links from successfully synchronized links
  • record an aborted task in Group Management when a fatal precondition fails
  • never include regenerated invite URLs in application or Telegram logs

Verification

  • pnpm run typecheck
  • pnpm run test — 21 files, 154 tests
  • pnpm run check
  • pnpm run build
  • git diff --check

No command-specific tests were added because this is a narrow orchestration command and the existing suite remains green.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 6ce963dc-5844-43a3-91c6-9ddba7983d24

📥 Commits

Reviewing files that changed from the base of the PR and between 6be2a9c and 55061cc.

📒 Files selected for processing (4)
  • src/commands/management/groups.ts
  • src/lib/group-management/index.ts
  • src/modules/tg-logger/index.ts
  • src/modules/tg-logger/types.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The change adds an authorized regenerate_group_links command. It regenerates Telegram invite links in batches, synchronizes them with the backend, prevents concurrent runs, and logs lifecycle results.

Changes

Group link regeneration

Layer / File(s) Summary
Regeneration contracts and lifecycle logging
src/modules/tg-logger/types.ts, src/modules/tg-logger/index.ts
The logger types now include regeneration start, completion, and aborted events. TgLogger.groupManagement formats these events and returns null when delivery fails.
Regeneration and backend synchronization
src/lib/group-management/index.ts
GroupManagement throttles and retries Telegram requests, regenerates links in bounded batches, retries backend synchronization, records per-group failures, and blocks concurrent runs.
Authorized regeneration command
src/commands/management/groups.ts
The command requires confirm and owner or direttivo permissions. It reports running, error, and completion states with regeneration counts.

Sequence Diagram(s)

sequenceDiagram
  participant Command
  participant GroupManagement
  participant Telegram
  participant Backend
  participant TgLogger
  Command->>GroupManagement: regenerateInviteLinks(requester)
  GroupManagement->>TgLogger: log regeneration start
  GroupManagement->>Telegram: regenerate invite links in batches
  Telegram-->>GroupManagement: regenerated links or failures
  GroupManagement->>Backend: synchronize successful links
  Backend-->>GroupManagement: synchronization results
  GroupManagement->>TgLogger: log completion or abort
  GroupManagement-->>Command: regeneration response
  Command-->>Command: reply with counts or error
Loading

Merge Risk: ⚪ Minimal · up to 55061

The authorized command adds bounded invite-link regeneration, backend synchronization, and lifecycle reporting. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding functionality to regenerate all group invite links.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@lorenzocorallo
lorenzocorallo merged commit 19416d6 into main Sep 6, 2026
2 checks passed
@lorenzocorallo
lorenzocorallo deleted the feat/regenerate-group-links branch September 6, 2026 12:32
toto04 added a commit that referenced this pull request Sep 13, 2026
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.

1 participant