Skip to content

fix: enforce rate limits in maintainer actions#266

Merged
jakharmonika364 merged 1 commit into
Coder-s-OG-s:mainfrom
AbhishekMauryaGEEK:fix/maintainer-rate-limit-enforcement
Jun 6, 2026
Merged

fix: enforce rate limits in maintainer actions#266
jakharmonika364 merged 1 commit into
Coder-s-OG-s:mainfrom
AbhishekMauryaGEEK:fix/maintainer-rate-limit-enforcement

Conversation

@AbhishekMauryaGEEK

Copy link
Copy Markdown
Contributor

Summary

Enforces rate limits in maintainer actions that previously called rateLimit() but ignored the result.

Related Issue

Closes #265

Type of Change

  • Bug fix
  • Security / Abuse prevention
  • Test coverage improvement

What Changed?

The following maintainer actions were calling rateLimit() but did not check limited.ok, allowing requests to continue even after the configured limit was exceeded:

  • getRepoHealthOverview()
  • getStaleIssues()
  • getTopContributors()
  • getFlaggedAccounts()

Updated each function to:

  • Capture the rateLimit() result
  • Return err('rate_limited', 'slow down', true) when the limit is exceeded
  • Stop further processing when rate limiting is triggered

Added regression tests covering all four actions to ensure rate limits are enforced consistently.

Why?

Most maintainer actions correctly enforce rate limits by checking limited.ok.

These four functions were inconsistent and effectively bypassed rate limiting because the result of rateLimit() was discarded.

This change makes rate-limit enforcement consistent across maintainer actions and prevents unnecessary database work after limits have been exceeded.

Validation

  • npx vitest run src/app/actions/maintainer.test.ts
  • npm run typecheck
  • npm test

Checklist

  • My code follows the project structure and conventions
  • I tested the changes locally
  • Added regression tests
  • No breaking changes introduced

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

@AbhishekMauryaGEEK is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mergeship Ready Ready Preview, Comment Jun 6, 2026 9:54am

@jakharmonika364 jakharmonika364 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Correctly enforces the rate-limiting result on the maintainer actions and adds solid unit test coverage for it. All tests and checks pass cleanly.

@jakharmonika364 jakharmonika364 added level:advanced Advanced level difficulty quality:clean Clean, well-structured contribution type:bug Bug fix gssoc:approved Approved by GSSOC admin mentor:Ayush-Patel-56 Replace Ayush-Patel-56 with mentor's GitHub handle to credit them labels Jun 6, 2026
@jakharmonika364 jakharmonika364 merged commit b21892b into Coder-s-OG-s:main Jun 6, 2026
5 checks passed
@AbhishekMauryaGEEK AbhishekMauryaGEEK deleted the fix/maintainer-rate-limit-enforcement branch June 6, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved by GSSOC admin level:advanced Advanced level difficulty mentor:Ayush-Patel-56 Replace Ayush-Patel-56 with mentor's GitHub handle to credit them quality:clean Clean, well-structured contribution type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Rate limit results are ignored in multiple maintainer actions

2 participants