Skip to content

fix: surface GitHub API rate limit errors on dashboard#2012

Merged
Priyanshu-byte-coder merged 4 commits into
Umbrella-io:mainfrom
bhavyajain0810:fix/github-rate-limit-errors-1072
Jun 5, 2026
Merged

fix: surface GitHub API rate limit errors on dashboard#2012
Priyanshu-byte-coder merged 4 commits into
Umbrella-io:mainfrom
bhavyajain0810:fix/github-rate-limit-errors-1072

Conversation

@bhavyajain0810

Copy link
Copy Markdown
Contributor

Summary

Fixed GitHub API rate-limit handling so dashboard users are clearly informed when GitHub rate limits are reached.

This PR detects GitHub 403/429 rate-limit responses using the x-ratelimit-remaining and x-ratelimit-reset headers, returns a structured GITHUB_RATE_LIMITED API response, and displays a dashboard toast with the reset time.

Closes #1072


Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added shared GitHub rate-limit detection helper
  • Detected GitHub rate-limit responses before generic API errors
  • Returned structured 429 responses with:
    • error: "GITHUB_RATE_LIMITED"
    • user-friendly message
    • reset timestamp
  • Surfaced rate-limit errors on the dashboard using a sonner toast
  • Preserved existing dashboard 401 session-expiry handling
  • Improved contribution metrics route error handling for rate-limit cases

How to Test

Steps for the reviewer to verify this works:

  1. Run npm run lint
  2. Run npm run type-check
  3. Run npx vitest run test/github-fetch.test.ts test/ContributionGraph.test.ts
  4. Trigger or mock a GitHub rate-limit response from the contribution metrics API
  5. Verify the API returns a structured GITHUB_RATE_LIMITED response
  6. Verify the dashboard shows a toast with the GitHub reset time

Screenshots (if UI change)

N/A
The change is mainly API/error-handling related. The dashboard now shows a toast when a GitHub rate-limit response is received.


Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Targeted tests pass locally
  • Self-reviewed the diff
  • Existing session-expiry handling is preserved
  • Added/updated tests if applicable

Test Note

The full npm run test suite currently has unrelated baseline failures in existing test files. I verified this before implementing the issue changes.

Relevant targeted checks pass:

  • npm run lint
  • npm run type-check
  • npx vitest run test/github-fetch.test.ts test/ContributionGraph.test.ts

Accessibility Checklist

  • Toast notification uses the existing sonner system
  • No keyboard navigation changes introduced
  • No layout or responsive UI changes introduced

Additional Notes

This PR keeps the fix focused on GitHub rate-limit detection, structured API responses, and dashboard-level user feedback without modifying unrelated dashboard widgets or existing session handling.

@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

@bhavyajain0810 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix labels Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@bhavyajain0810

Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder, I have opened a PR for the issue #1072

The PR adds GitHub rate-limit detection, returns a structured GITHUB_RATE_LIMITED response with reset time, and surfaces the error on the dashboard using a sonner toast while preserving the existing session-expiry handling.

PR: #2012

Thank you!

@bhavyajain0810

Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder, I have updated this branch with the latest main again using the Update branch option.

The branch seems to be becoming out-of-date repeatedly because new commits are being added to main frequently. Please let me know if I should continue updating the branch whenever GitHub shows it as out-of-date, or if I should wait until review/workflow approval before updating again.

I have already verified the relevant local checks for this PR, and the remaining pending workflow/status check appears to require maintainer/workflow approval.

For this PR, I verified:

  • npm run lint
  • npm run type-check
  • npx vitest run test/github-fetch.test.ts test/ContributionGraph.test.ts

Thank you!

@Priyanshu-byte-coder Priyanshu-byte-coder added gssoc:approved GSSoC: PR approved for scoring level2 GSSoC Level 2 - Medium complexity (25 points) quality:clean GSSoC: Clean quality multiplier (×1.2) labels Jun 5, 2026
@Priyanshu-byte-coder Priyanshu-byte-coder merged commit 1d23cd8 into Umbrella-io:main Jun 5, 2026
3 checks passed
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

🎉 Merged! Thanks for contributing to DevTrack.

If the project has been useful to you, a ⭐ star on the repo is the easiest way to support it — it helps DevTrack get discovered by more developers.

Keep an eye on open issues for your next contribution!

@bhavyajain0810

Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder,

Four of my approved and merged DevTrack PRs are still not appearing on either my official GSSoC profile or the community PR tracker, even though it has been more than a week:

All four PRs were assigned to me, merged, and have the gssoc:approved label.

It appears that GSSoC may still have DevTrack registered under the previous repository path, Priyanshu-byte-coder/devtrack, while the repository is now under Umbrella-io/devtrack.

Could you please confirm whether the repository transfer was reported to the GSSoC team and whether the registered repository URL can be updated? This may be preventing PRs merged after the transfer from being tracked.

GitHub username: bhavyajain0810

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level2 GSSoC Level 2 - Medium complexity (25 points) quality:clean GSSoC: Clean quality multiplier (×1.2) type:bug GSSoC type bonus: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: API rate limit errors from GitHub not surfaced to user

2 participants