Skip to content

fix: show a rate limit message when the GitHub or GitLab API limit is reached - #43

Merged
codxbrexx merged 1 commit into
metacall:masterfrom
rishiraj38:fix/38-rate-limit-message
Oct 23, 2026
Merged

codxbrexx merged 1 commit into
metacall:masterfrom
rishiraj38:fix/38-rate-limit-message

Conversation

@rishiraj38

@rishiraj38 rishiraj38 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

When the unauthenticated GitHub or GitLab API rate limit is reached, the Deploy Repository page now says so instead of showing the generic "GitHub API error." / "GitLab API error.".

A small rateLimitMessage helper treats GitHub's 403 with X-RateLimit-Remaining: 0 and any 429 (GitLab, or GitHub's secondary limit) as a rate limit. It reads X-RateLimit-Reset / RateLimit-Reset (or Retry-After) to show when to try again, for example "GitHub API rate limit reached. Try again after 05:56 PM.", and falls back to "Try again later." when there's no reset header. Both the repository request and the branches request are checked, so a limited branches call no longer quietly turns into an empty branch list. 404 still shows "Repository not found." and other errors keep the existing message.

Notes:

  • I didn't add the optional token. A VITE_* variable is compiled into the public bundle, so a GitHub PAT there is visible to anyone who loads the page, and the app doesn't have a GitHub/GitLab OAuth session to reuse. If you want authenticated requests, a FaaS-side proxy seems safer.
  • gitlab.com doesn't list RateLimit-Reset in Access-Control-Expose-Headers, so in the browser the GitLab message usually ends with "Try again later." GitHub exposes X-RateLimit-Reset, so the GitHub message shows the time.

Fixes #38

Type of Change

  • fix: Bug fix (non-breaking change which fixes an issue)
  • feat: New feature (non-breaking change which adds functionality)
  • refactor: Code refactor (no functional changes, no API changes)
  • docs: Documentation update
  • test: Adding or updating tests
  • chore: Maintenance (CI, dependencies, tooling)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Screenshots / Recordings

API responses intercepted with a Playwright route (GitHub: 403 + x-ratelimit-remaining: 0, GitLab: 429).

Before After
GitHub before-github after-github
GitLab before-gitlab after-gitlab

Checklist

  • I have linked the related issue above.
  • My code follows the coding standards of this project.
  • I have added tests that prove my fix is effective or my feature works.
  • New and existing tests pass locally (npm run unit and npm run test).
  • My changes generate no new lint warnings or errors (npm run lint).
  • My PR title follows Conventional Commits (e.g., fix: resolve login redirect).

npm run unit passes (142 tests, including 5 new ones in deploy_repository_page_test.tsx covering a GitHub 403 limit, a limited branches request, a non-rate-limit 403, a GitLab 429 and a 404). I didn't run the Playwright suite (npm run test). format:check, typecheck and build also pass.

@codxbrexx

Copy link
Copy Markdown
Collaborator

LGTM! Thanks for the clean fix and comprehensive tests @rishiraj38.

Checking both the repo and branch responses avoids the silent empty-branch bug, and omitting the client-side PAT token was the right security decision for a public Vite bundle.

Merging now!

@codxbrexx
codxbrexx merged commit 6bfbf6a into metacall:master Oct 23, 2026
1 check passed
@KanishJebaMathewM

Copy link
Copy Markdown
Contributor

Hi @codxbrexx , I also came across your recent work reviewing PRs in MetaCall Launchpad, particularly the rate-limit handling improvements. I'm interested in getting involved with MetaSSR and would appreciate your suggestions on where I could start contributing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Branch and repository metadata are fetched directly from the GitHub and GitLab public REST APIs without an auth token:

3 participants