Skip to content

fix: show rate limit error with reset time in CI Analytics (#244)#602

Open
mallya-m wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
mallya-m:fix/rate-limit-feedback-244
Open

fix: show rate limit error with reset time in CI Analytics (#244)#602
mallya-m wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
mallya-m:fix/rate-limit-feedback-244

Conversation

@mallya-m
Copy link
Copy Markdown
Contributor

Summary

Closes #244

Fixes the CI Analytics refresh button silently failing when GitHub API is rate-limited (403). Users now see a clear yellow warning with the exact reset time, and the button is disabled until the rate limit resets automatically.

Type of Change

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

Changes Made

  • Check for res.status === 403 before generic error handling in CIAnalytics.tsx
  • Parse X-RateLimit-Reset header and convert Unix timestamp to local HH:MM using toLocaleTimeString()
  • Show yellow-tinted error box: "GitHub API rate limit reached. Resets at HH:MM. Try again later."
  • Disable Refresh button with label "Retry at HH:MM" while rate limited
  • Auto-clears error and re-enables button via setTimeout when reset time passes
  • No new dependencies added

How to Test

  1. Run npm run dev
  2. Open the CI Analytics card on the dashboard
  3. To simulate 403: temporarily return 403 from the API route with an X-RateLimit-Reset header
  4. Verify yellow warning appears with reset time
  5. Verify button is disabled and shows "Retry at HH:MM"
  6. After reset time passes, verify button re-enables automatically

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

…-byte-coder#244)

- Check for 403 status before generic error handling
- Parse X-RateLimit-Reset header and convert to local time
- Show yellow warning with reset time instead of silent failure
- Disable Refresh button until rate limit resets
- Auto-clears error and re-enables button after reset time passes
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

@mallya-m 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 type:devops GSSoC type bonus: devops (+15 pts) labels May 21, 2026
@github-actions
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

@mallya-m
Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder!

PR is ready for review. Here's what was fixed:

  • Detects 403 rate-limit responses separately from other errors
  • Reads X-RateLimit-Reset header and converts to local HH:MM time
  • Shows a yellow warning instead of silent failure
  • Disables the Refresh button with label "Retry at HH:MM" until reset passes
  • Auto-re-enables the button via setTimeout — no manual refresh needed

Could you please add:

  • gssoc:approved
  • level:intermediate
  • quality:clean
  • type:bug
  • type:devops

Thanks!

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

Please fix before merging:

  1. Missing EOF newline — all changed files must end with \n
  2. Hardcoded Tailwind colors — replace with CSS vars:
    • text-yellow-400text-[var(--warning)] or text-[var(--muted-foreground)]
    • border-yellow-500/20border-[var(--border)]
    • text-red-400text-[var(--destructive)]
    • border-red-500/30border-[var(--border)]

The rate limit display feature itself looks good — just needs these polish fixes.

@Priyanshu-byte-coder Priyanshu-byte-coder added the level:intermediate GSSoC: Intermediate difficulty (35 pts) label May 22, 2026
@mallya-m
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder both issues fixed:

  1. Replaced all hardcoded Tailwind colors with CSS vars:
    • Rate limit warning: text-[var(--warning)], border-[var(--border)], bg-[var(--control)]
    • Error state: text-[var(--destructive)], border-[var(--destructive)]/20, bg-[var(--destructive)]/10
  2. EOF newline added to CIAnalytics.tsx
  3. Resolved merge conflict with latest main

Ready for merge!

@mallya-m
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder the E2E failure is the same pre-existing landing.spec.js bug unrelated to this PR — the landing page now has two headings matching "DevTrack" from a recent merge to main. My changes only touch src/components/CIAnalytics.tsx. Ready for merge!

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

Labels

gssoc26 GSSoC 2026 contribution level:intermediate GSSoC: Intermediate difficulty (35 pts) type:bug GSSoC type bonus: bug fix type:devops GSSoC type bonus: devops (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] DashboardHeader sync button gives no user feedback when GitHub API is rate-limited

2 participants