Skip to content

feat(remind): channel and role broadcast reminders (#1767) - #1807

Merged
LucasSantana-Dev merged 8 commits into
mainfrom
feat/1767-reminder-scope
Jul 12, 2026
Merged

LucasSantana-Dev merged 8 commits into
mainfrom
feat/1767-reminder-scope

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Jul 12, 2026 •

Copy link
Copy Markdown
Owner

What

Extends /remind beyond personal reminders with two new subcommands:

  • /remind channel <tempo> <mensagem> <canal> — posts a reminder embed to a channel.
  • /remind role <tempo> <mensagem> <cargo> <canal> — posts to a channel and pings a role.

Both are gated by a runtime ManageGuild check; personal set/list/delete stay ungated.

Delivery semantics

Broadcasts are fire-once: unlike personal reminders (DM-first, 12-attempt 5-min backoff), a broadcast has no future scheduled run to retry against. On failure the scheduler logs a WARN and sets deliveryFailed = true for operator visibility, then marks it done — no retry storm. Role pings are hard-scoped with allowedMentions: { roles: [roleId] } so a ping can never expand to @everyone.

Schema

Reminder gains targetType (user|channel|role, default user), roleId, and deliveryFailed. Migration 20260712010000_reminder_scope is additive (ADD COLUMN with defaults, safe on the populated table) plus a targetType CHECK constraint. Verified by prisma-migration-verifier: schema↔SQL↔generated-client parity, no destructive ops, no new index needed (the fields drive dispatch, not query filters).

Permission tier

Per ADR decisions/2026-07-12-reminder-scope-permission-tier.md (uniform ManageGuild). The ADR is amended here to document the subcommand exception: setDefaultMemberPermissions is command-level only and can't gate individual subcommands without also gating personal reminders, so the ManageGuild intent is realized via a runtime permissions.has() check on the gated subcommands.

Tests

  • reminderScheduler.spec.ts — channel post (no ping, parse: []), role ping (<@&id> + scoped allowedMentions), fire-once failure flags deliveryFailed and does not retry.
  • remind.spec.ts — ManageGuild gate rejects non-managers; channel/role subcommands create with the right targetType/roleId.
  • ReminderService.spec.ts — default create writes targetType: 'user'; options path writes role scope; markDeliveryFailed sets deliveryFailed + delivered.

Full type:check (4 packages), eslint, and all affected jest suites green.

Closes #1767


Summary by cubic

Adds channel-wide and role-wide reminders to /remind so moderators can post to a channel or ping a role. Broadcasts deliver once with scoped mentions and flag failures; personal reminders stay the same. Closes #1767.

  • New Features

    • New subcommands: /remind channel <tempo> <mensagem> <canal> and /remind role <tempo> <mensagem> <cargo> <canal>.
    • Gated at runtime by Manage Server; personal set/list/delete stay open. ADR amended to document the mixed-permission subcommand exception.
    • Scheduler sends broadcasts once; role pings use allowedMentions: { roles: [roleId] } with <@&roleId>; channel posts never ping and use parse: []. Failures set deliveryFailed and are not retried.
  • Migration

    • Adds targetType (user|channel|role), roleId, and deliveryFailed to Reminder, plus a targetType CHECK constraint. Additive with defaults; existing reminders default to user.

Written for commit 116db68. Summary will update on new commits.

Review in cubic

Add channel-wide and role-wide reminders to /remind as new subcommands,
gated by a runtime ManageGuild check (personal set/list/delete stay
ungated). Broadcasts are fire-once: no retry backoff, and a delivery
failure sets deliveryFailed for operator visibility. Role pings scope
the mention with allowedMentions: { roles: [roleId] }.

Schema: Reminder gains targetType, roleId, deliveryFailed (additive
migration + targetType CHECK constraint). ADR amended to record the
mixed-permission-subcommand runtime-check exception.

Closes #1767
@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 59 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aee3dd06-7f1c-42f8-94b9-bea4704469d5

📥 Commits

Reviewing files that changed from the base of the PR and between 08ba25e and 116db68.

📒 Files selected for processing (10)
  • decisions/2026-07-12-reminder-scope-permission-tier.md
  • packages/bot/src/functions/general/commands/remind.spec.ts
  • packages/bot/src/functions/general/commands/remind.ts
  • packages/bot/src/utils/general/reminderScheduler.spec.ts
  • packages/bot/src/utils/general/reminderScheduler.ts
  • packages/shared/src/services/ReminderService.spec.ts
  • packages/shared/src/services/ReminderService.ts
  • packages/shared/src/services/index.ts
  • prisma/migrations/20260712010000_reminder_scope/migration.sql
  • prisma/schema.prisma
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1767-reminder-scope

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

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@github-actions

github-actions Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Warnings
⚠️

User-facing change without a CHANGELOG.md update. Add a line under ## [Unreleased] if this should appear in release notes. (Or apply the skip-changelog label if this PR does not affect end users.)

Generated by 🚫 dangerJS against 116db68

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 10 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/bot/src/functions/general/commands/remind.ts
Comment thread prisma/schema.prisma
Comment thread packages/shared/src/services/ReminderService.ts
Comment thread packages/bot/src/utils/general/reminderScheduler.ts
Comment thread prisma/migrations/20260712010000_reminder_scope/migration.sql
Comment thread prisma/schema.prisma
Comment thread packages/shared/src/services/ReminderService.ts
@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) July 12, 2026 12:35
@LucasSantana-Dev

Copy link
Copy Markdown
Owner Author

Cubic review dispositions (commit 1524f164):

  • P1 remind.ts:97 (canal accepts non-text channels): ✅ FIXED — restricted canal to GuildText/GuildAnnouncement on both subcommands.
  • P2 reminderScheduler.ts:142 (broadcast double-send): ✅ FIXED — mark delivered before the send (fire-once); a transient DB failure can no longer re-ping next tick.
  • P2 schema:1320 / ReminderService:39 (role without roleId): Accepted — the /remind role handler always sets roleId; a cross-column CHECK (targetType='role' ⇒ roleId NOT NULL) isn't expressible in schema.prisma and is low-value given command enforcement.
  • P2 migration.sql:8 (ACCESS EXCLUSIVE on ADD CONSTRAINT): Accepted — reminders is a small, low-traffic table; the brief validation lock is negligible. Would use NOT VALID+VALIDATE at scale.
  • P3 schema:1319 / ReminderService:17 (targetType widened to string): Accepted — values are enforced by the migration's CHECK (user|channel|role) + runtime; the string client type is a Prisma generator limitation.

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 83ade79 into main Jul 12, 2026
45 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the feat/1767-reminder-scope branch July 12, 2026 20:43
LucasSantana-Dev added a commit that referenced this pull request Jul 13, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>2.35.0</summary>

##
[2.35.0](v2.34.0...v2.35.0)
(2026-07-13)


### Features

* **bot:** /bulk-kick — proof-of-pattern for the bulk-* command family
([#1802](#1802))
([1c11f3e](1c11f3e))
* **bot:** add lucky_bot_gateway_connected zombie-detection gauge
([#1774](#1774))
([6cc5287](6cc5287))
* **bot:** playback progress bar in nowplaying/songinfo embed
([#1797](#1797))
([1138b59](1138b59))
* **bot:** post server-count stats to Top.gg for listing visibility
([#1789](#1789))
([e8ca6b9](e8ca6b9))
* **bot:** temporary support ticket channels (/ticket)
([#1803](#1803))
([49601a1](49601a1))
* **live-notif:** youtube polling, message ttl cleanup, api backoff
([#1762](#1762))
([a99b85a](a99b85a))
* **remind:** channel and role broadcast reminders
([#1767](#1767))
([#1807](#1807))
([83ade79](83ade79))


### Bug Fixes

* **backend:** artist suggestions 503 not 500 on upstream timeout
([#1787](#1787))
([eadc20e](eadc20e))
* **bot:** guard skipReason telemetry against null prisma client
([#1773](#1773))
([d73421e](d73421e))
* **ci:** stop auto-update workflow racing on merge push
([#1811](#1811))
([2ddd202](2ddd202))
* **csp:** allow Cloudflare Insights beacon in script-src/connect-src
([#1788](#1788))
([f20c4cf](f20c4cf))
* **deps:** bump eslint in lock to satisfy npm@12 ci (unblock release)
([#1809](#1809))
([68fd0be](68fd0be))
* paginate bulk-move message fetch to respect discord api limit
([#1776](#1776))
([5b5d2fc](5b5d2fc))
* **weekly-digest:** trigger on Sunday and add new-guides RSS section
([#1761](#1761))
([f429fc6](f429fc6))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
This was referenced Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(bot): expand /remind to support channel-wide and role-wide targets

1 participant