Skip to content

feat(telegram): /linkrepo, /unlinkrepo and /repos commands (5/5) - #16

Merged
TOMOKI977 merged 2 commits into
mainfrom
feat/github-alerts-commands
Sep 26, 2026
Merged

TOMOKI977 merged 2 commits into
mainfrom
feat/github-alerts-commands

Conversation

@TOMOKI977

Copy link
Copy Markdown
Contributor

Summary

Last PR of the github-alerts chain. It adds the commands that link a repo to a forum topic. After this merges, alerts reach Telegram for linked repos.

  • /linkrepo owner/repo:
    • Admin-only, and must run inside the topic that should receive the repo's alerts. Outside a topic it refuses with the same guidance as /datachannel.
    • Only works for repos of the team's claimed org.
    • Re-linking moves the repo, and the reply says from topic A to topic B.
  • /unlinkrepo owner/repo: admin-only, inside a topic.
  • /repos:
    • Read-only, for any registered team member, anywhere in the group. In a DM it uses the existing team picker.
    • The reply is capped below Telegram's 4096 characters: whole lines, then ...and N more.
  • Each refusal (bad format, unclaimed org, not admin, not a member) gets its own reply through errorReplies. Anything unlisted, such as a D1 failure, still reaches the 500 boundary.

Size exception: about 520 lines. Production code is about 180 of them and tests about 200; the rest is apply-progress notes.

Review

Full review with four lenses, since these commands gate who can link what. No blocker or critical findings. The risk lens found nothing: the admin, member and claimed-org checks are enforced in the domain use cases, and names are lowercased before comparison. The warnings were fixed:

  • /repos had no length cap. Past 4096 characters the reply throws, the error is unrecognized, the route answers 500, and Telegram retries the update forever. A 300-link test produced 7,689 characters and failed first.
  • The re-link test now pins the exact reply, including the move direction. There is a new test for /repos with zero links.
  • /linkrepo and /unlinkrepo now have separate handlers with a small shared helper, instead of one loop that branched on the command name.

A scoped fix-delta validator approved the correction, including the removal of an errorReplies entry that unlinkRepo can never throw.

Test plan

  • npx vitest run: 334/334 pass
  • npx tsc --noEmit: no errors

After merge

Operator steps still pending: 6.1 (GITHUB_WEBHOOK_SECRET) and 6.2 (org webhook). Then run /linkrepo inside a topic to start receiving alerts.

/linkrepo and /unlinkrepo are admin-only and must run inside the forum topic that should receive the repo's alerts; linking is limited to the team's claimed org and re-linking moves the repo. /repos lists the team's links for any member and caps the reply below Telegram's 4096-char limit.
@TOMOKI977 TOMOKI977 added the size:exception PR over the 400-line review budget, accepted explicitly label Sep 25, 2026
@TOMOKI977
TOMOKI977 merged commit 834d60d into main Sep 26, 2026
2 checks passed
@TOMOKI977
TOMOKI977 deleted the feat/github-alerts-commands branch September 26, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:exception PR over the 400-line review budget, accepted explicitly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant