Skip to content

fix: paginate bulk-move message fetch to respect discord api limit - #1776

Merged
LucasSantana-Dev merged 7 commits into
mainfrom
fix/1763-bulk-move-fetch-limit
Jul 12, 2026
Merged

LucasSantana-Dev merged 7 commits into
mainfrom
fix/1763-bulk-move-fetch-limit

Conversation

@LucasSantana-Dev

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

Copy link
Copy Markdown
Owner

Summary

  • Fixed count estimation in /bulk-move-messages command to paginate correctly through Discord API
  • Command was requesting fetch({ limit: 500 }) but Discord caps limit at 100, causing validation error
  • Now fetches in pages of ≤100 using before cursor, accumulating up to 500-message sample

Implementation

  • Replaced single fetch with pagination loop mirroring pattern in channelMoveExecutor
  • Updated test to assert proper pagination (limit ≤100, multiple pages) instead of encoding the bug

Fixes #1763


Summary by cubic

Fixes the /bulk-move-messages count estimate by paginating message fetches to respect Discord’s 100-per-request limit. Prevents discord.js validation errors and samples up to 500 messages. Fixes #1763.

  • Bug Fixes
    • Fetch messages in pages of ≤100 using a before cursor, accumulating up to 500 for the sample (mirrors channelMoveExecutor).
    • Tests assert pagination: limit ≤100 per call, multiple calls, first call without cursor, later calls with before.

Written for commit f4c21b7. Summary will update on new commits.

Review in cubic

The /bulk-move-messages command's count estimation was requesting
fetch({ limit: 500 }), but Discord's message-fetch API caps limit at 100
per request, causing discord.js to throw a validation error.

Fixed by implementing proper pagination: fetch in pages of ≤100 messages
using a before cursor, accumulating up to 500 messages for the sample.
This mirrors the pattern already used correctly in channelMoveExecutor.

Updated test to assert proper pagination behavior instead of encoding
the bug: verifies limit ≤100 per request and multiple pages are fetched
to reach the 500-message sample target.

Fixes #1763
@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) July 10, 2026 18:03
@coderabbitai

coderabbitai Bot commented Jul 10, 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: 32 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: 411a08b7-2fd4-4b2d-8368-4b4b3572ac42

📥 Commits

Reviewing files that changed from the base of the PR and between 2c2260c and f4c21b7.

📒 Files selected for processing (2)
  • packages/bot/src/functions/moderation/commands/bulkMoveMessages.spec.ts
  • packages/bot/src/functions/moderation/commands/bulkMoveMessages.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1763-bulk-move-fetch-limit

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

@github-actions github-actions Bot added size/m dependencies Pull requests that update a dependency file bot labels Jul 10, 2026
@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 494 kB

ℹ️ View Unchanged
Filename Size
packages/frontend/dist/assets/AddStyledRoleForm-v1ulostW.js 3.11 kB
packages/frontend/dist/assets/Admin-BAh-aBXV.js 2.3 kB
packages/frontend/dist/assets/AdminSupport-B80PU1PM.js 1.6 kB
packages/frontend/dist/assets/api-B1lHOZZ9.js 4.01 kB
packages/frontend/dist/assets/AutoMessages-ChVXWS4W.js 2.65 kB
packages/frontend/dist/assets/AutoMod-CLFXaNLP.js 4.19 kB
packages/frontend/dist/assets/badge-D8yxgsYA.js 502 B
packages/frontend/dist/assets/BatchJobs-CSYhMKSK.js 3.72 kB
packages/frontend/dist/assets/Card-2ohobfr8.js 503 B
packages/frontend/dist/assets/Changelog-PZm9GMIg.js 56.9 kB
packages/frontend/dist/assets/CommandsConfig-4aL0zOkM.js 1.5 kB
packages/frontend/dist/assets/Config-DxlcmdN8.js 1.91 kB
packages/frontend/dist/assets/CustomCommands-DngFf3ZB.js 2.12 kB
packages/frontend/dist/assets/DashboardOverview-D9ZxaVWi.js 3.95 kB
packages/frontend/dist/assets/dialog-F4mOCYwj.js 958 B
packages/frontend/dist/assets/Docs-3gN88C8N.js 17.6 kB
packages/frontend/dist/assets/DocsShell-B8XXtRBD.js 1.42 kB
packages/frontend/dist/assets/EmbedBuilder-CoYNs__l.js 3.28 kB
packages/frontend/dist/assets/Features-DvDe_b_N.js 756 B
packages/frontend/dist/assets/GuildAutomation-2dfOW0TX.js 2.89 kB
packages/frontend/dist/assets/index-BUBowxD1.js 70.9 kB
packages/frontend/dist/assets/index-DY6JagVQ.css 17.6 kB
packages/frontend/dist/assets/input-DJFYQ76Y.js 466 B
packages/frontend/dist/assets/label-Cc-a7ndm.js 473 B
packages/frontend/dist/assets/Landing-Dj13helJ.js 5.2 kB
packages/frontend/dist/assets/LastFm-nm085zQe.js 1.74 kB
packages/frontend/dist/assets/legalNav-B6k3CWsW.js 274 B
packages/frontend/dist/assets/Levels-9hch6eDK.js 2.27 kB
packages/frontend/dist/assets/Login-C2gy518P.js 2.49 kB
packages/frontend/dist/assets/Lyrics-DZ-SqK7X.js 1.34 kB
packages/frontend/dist/assets/Moderation-C5-mjoyk.js 3.78 kB
packages/frontend/dist/assets/Music-tPAdBD4C.js 5.97 kB
packages/frontend/dist/assets/MusicConfig-iBfqVvYx.js 1.69 kB
packages/frontend/dist/assets/PreferredArtists-ttS7XIan.js 3.72 kB
packages/frontend/dist/assets/PrivacyPolicy-B9dBxIAF.js 1.78 kB
packages/frontend/dist/assets/ReactionRoles-D6PVlYQ_.js 7.04 kB
packages/frontend/dist/assets/RoleGroups-QN0S5QQz.js 2.23 kB
packages/frontend/dist/assets/Roles-CTxqefNc.js 3.34 kB
packages/frontend/dist/assets/rolldown-runtime-Cyuzqnbw.js 471 B
packages/frontend/dist/assets/routeMeta-BZjtwMbs.js 595 B
packages/frontend/dist/assets/SectionHeader-BVODr-qt.js 892 B
packages/frontend/dist/assets/select-BoP8UX_S.js 1.23 kB
packages/frontend/dist/assets/sentry-DhXOA89y.js 3.76 kB
packages/frontend/dist/assets/ServerLogs-f80xOP6o.js 3.04 kB
packages/frontend/dist/assets/ServerSettings-DxFAj1FK.js 3.99 kB
packages/frontend/dist/assets/ServersPage-58ReJnxm.js 3.04 kB
packages/frontend/dist/assets/Skeleton-COW48cWg.js 237 B
packages/frontend/dist/assets/Spotify-CSENofKi.js 1.75 kB
packages/frontend/dist/assets/Starboard-B9QOBUL7.js 1.82 kB
packages/frontend/dist/assets/StatTile-CENVj9O3.js 639 B
packages/frontend/dist/assets/Support-D1AoxwZa.js 1.55 kB
packages/frontend/dist/assets/switch-BpgCWX_1.js 542 B
packages/frontend/dist/assets/TermsOfService-zYrbwzxD.js 1.59 kB
packages/frontend/dist/assets/TrackHistory-CVI8G7BL.js 2.32 kB
packages/frontend/dist/assets/TwitchNotifications-BtKTRAle.js 2.44 kB
packages/frontend/dist/assets/useActiveHeading-BJ8rluFw.js 1.36 kB
packages/frontend/dist/assets/useFeatures-Ca4d__jP.js 2.06 kB
packages/frontend/dist/assets/usePageMetadata-DTv-6eVb.js 327 B
packages/frontend/dist/assets/vendor-forms-C-bof8GF.js 25.9 kB
packages/frontend/dist/assets/vendor-radix-qkfmDH9H.js 39.9 kB
packages/frontend/dist/assets/vendor-react-B7C34xnu.js 55.7 kB
packages/frontend/dist/assets/vendor-state-Dw4-MN6C.js 24.2 kB
packages/frontend/dist/assets/vendor-ui-BBN61NBD.js 66.2 kB

compressed-size-action

@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 6 files

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

Re-trigger cubic

Comment thread .release-please-manifest.json
@github-actions github-actions Bot removed the dependencies Pull requests that update a dependency file label Jul 12, 2026
@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 f4c21b7

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 5b5d2fc into main Jul 12, 2026
44 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the fix/1763-bulk-move-fetch-limit branch July 12, 2026 17:01
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.

fix(bot): bulk-move-messages fetch limit 500 exceeds Discord's 100-message cap

1 participant