Skip to content

feat: Enhanced rate limit display showing both GraphQL and REST API limits#25

Merged
wiiiimm merged 4 commits into
mainfrom
feature/enhanced-rate-limit
Sep 4, 2025
Merged

feat: Enhanced rate limit display showing both GraphQL and REST API limits#25
wiiiimm merged 4 commits into
mainfrom
feature/enhanced-rate-limit

Conversation

@wiiiimm
Copy link
Copy Markdown
Owner

@wiiiimm wiiiimm commented Sep 3, 2025

Summary

This PR enhances the rate limit display to show both GraphQL and REST API limits simultaneously, helping users better understand their API usage - especially useful for enterprise users who have different limits.

Changes

  • Added RestRateLimitInfo and CombinedRateLimitInfo types for REST API rate limits
  • Created fetchRestRateLimits() function to query GitHub's REST API /rate_limit endpoint
  • Updated UI to display both rate limits in a single compact line
  • Shows real-time delta changes with color coding (green for increases, red for decreases)
  • Low rate warning now triggers if either limit falls below 10%

Display Format

The new format shows:

GraphQL: 4500/5000 (-2) | REST: 14000/15000 (-1)

This is particularly helpful for:

  • Enterprise users who get 15,000 REST API calls vs 5,000 GraphQL calls
  • Understanding which API type is being consumed by different operations
  • Tracking rate limit changes in real-time with colored deltas

Testing

  • Built and tested locally
  • Rate limits display correctly for both personal and enterprise accounts
  • Delta tracking works as expected with proper color coding

Summary by CodeRabbit

  • New Features
    • Added dual rate limit monitoring (REST + GraphQL) with real-time deltas and improved low‑quota alerts.
  • Refactor
    • Removed repository rename and copy URL modals and related keyboard shortcuts; simplified input and footer/help hints.
  • Documentation
    • Updated guides to reflect removal of rename/URL-copy features and highlight enhanced rate limit monitoring; reorganised installation order.
  • Chores
    • Rolled version back to 1.19.2; removed an unused clipboard dependency.
  • Tests
    • Expanded archive flow coverage; removed tests tied to the deprecated rename modal.

…imits

- Add RestRateLimitInfo and CombinedRateLimitInfo types
- Create fetchRestRateLimits function to query REST API rate limits
- Update UI to display both GraphQL and REST rate limits side by side
- Show rate limit changes with color-coded deltas (red/green)
- Update low rate warning to trigger on either limit being low
- Display as 'API: GraphQL/5000 | REST/15000' in compact format
- Remove delta indicators for cleaner single-line display
- Maintain low rate warning color coding
- Show 'GraphQL: X/5000 (+/-N) | REST: Y/15000 (+/-N)' format
- Display delta changes with color coding (green for increase, red for decrease)
- Keep everything on single line for compact display
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR removes repository rename and URL-copy features from docs, UI, API helpers, exports, and tests; reverts version to 1.19.2; drops the clipboardy dependency; adds REST rate-limit types and a fetchRestRateLimits function; and updates RepoList to display combined GraphQL + REST rate limits with new props for organisation context.

Changes

Cohort / File(s) Summary of changes
Documentation cleanup
AGENTS.md, CHANGELOG.md, README.md
Removed references to repository rename and URL-copy features; updated rate-limit descriptions to include GraphQL & REST; reordered install instructions; pruned modals list; changelog top versions (1.22.0–1.20.0) removed.
Versioning & deps
package.json
Version set to 1.19.2; removed dependency "clipboardy": "^4.0.0".
Types for REST rate limits
src/types.ts
Added RestRateLimitInfo and CombinedRateLimitInfo interfaces.
GitHub API module updates
src/github.ts
Added fetchRestRateLimits(token) for REST rate-limit data; removed renameRepositoryById and updateCacheAfterRename; adjusted error handling/logging.
RepoList UI & props
src/ui/RepoList.tsx
Integrated REST rate-limit fetching and display; added props onOrgContextChange and initialOrgSlug; removed rename and copy-URL modal logic, inputs, and UI hints.
Modals removal
src/ui/components/modals/RenameModal.tsx, src/ui/components/modals/index.ts
Deleted RenameModal component; removed re-exports for RenameModal and CopyUrlModal.
Tests — API
tests/github.test.ts
Removed tests for rename helpers and cache update; kept other tests.
Tests — UI
tests/ui/RenameModal.test.tsx, tests/ui/ArchiveModal.test.tsx
Deleted RenameModal test suite; refined ArchiveModal test to ensure inputs are ignored during in-progress actions and simplified mocking.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant RL as RepoList (UI)
  participant GQL as GitHub GraphQL API
  participant REST as GitHub REST API (/rate_limit)

  User->>RL: Open / paginate / refresh
  RL->>GQL: Fetch repos + GraphQL rate limit
  GQL-->>RL: Repos + rateLimit
  RL->>REST: fetchRestRateLimits(token)
  REST-->>RL: REST rate limits (core + graphql) or null
  RL->>RL: Update state (GraphQL + REST limits, deltas)
  RL-->>User: Render repos + combined rate-limit display
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

A hop, a skip, I prune the vine,
Shed old names, let menus shine.
REST and GraphQL now side by side—
I count the limits, whiskers wide.
Clipboards gone, the gardens neat,
Version rolled back—tidy feet.
(\_/) tap tap new beats complete. 🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 652bbf8 and aebabf2.

📒 Files selected for processing (12)
  • AGENTS.md (0 hunks)
  • CHANGELOG.md (0 hunks)
  • README.md (4 hunks)
  • package.json (1 hunks)
  • src/github.ts (2 hunks)
  • src/types.ts (1 hunks)
  • src/ui/RepoList.tsx (9 hunks)
  • src/ui/components/modals/RenameModal.tsx (0 hunks)
  • src/ui/components/modals/index.ts (0 hunks)
  • tests/github.test.ts (0 hunks)
  • tests/ui/ArchiveModal.test.tsx (1 hunks)
  • tests/ui/RenameModal.test.tsx (0 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/enhanced-rate-limit

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@wiiiimm wiiiimm merged commit 1220a0f into main Sep 4, 2025
1 of 3 checks passed
Comment thread src/ui/RepoList.tsx
const modalOpen = deleteMode || archiveMode || syncMode || logoutMode || infoMode || visibilityMode || renameMode || sortMode || changeVisibilityMode || copyUrlMode;
const lowRate = (rateLimit && rateLimit.remaining <= Math.ceil(rateLimit.limit * 0.1)) ||
(restRateLimit && restRateLimit.core.remaining <= Math.ceil(restRateLimit.core.limit * 0.1));
const modalOpen = deleteMode || archiveMode || syncMode || logoutMode || infoMode || visibilityMode;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Modal Calculation Excludes Sort and Visibility Modes

The modalOpen calculation doesn't include sortMode and changeVisibilityMode. Since these modals are still active, the UI doesn't dim properly and the header styling is incorrect when they're open.

Fix in Cursor Fix in Web

wiiiimm pushed a commit that referenced this pull request Sep 4, 2025
# [1.23.0](v1.22.0...v1.23.0) (2025-09-04)

### Features

* Enhanced rate limit display showing both GraphQL and REST API limits ([#25](#25)) ([1220a0f](1220a0f))
@wiiiimm
Copy link
Copy Markdown
Owner Author

wiiiimm commented Sep 4, 2025

🎉 This PR is included in version 1.23.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines 6 to 7
export { default as VisibilityModal } from './VisibilityModal';
export { default as SortModal } from './SortModal';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Restores old codebase and drops rename/copy actions

This commit adds REST rate-limit fetching but simultaneously removes the RenameModal and CopyUrlModal exports along with the supporting UI, cache update helpers, tests, and the clipboard dependency. As a result the Ctrl+R and C key bindings that previously allowed users to rename a repository or copy clone URLs no longer exist anywhere in the app, so those actions cannot be performed at all. This is a user-facing regression unrelated to the rate limit feature and will surprise anyone relying on the existing rename/URL copy functionality. Unless the feature was intentionally deprecated, the removal should be reverted or split into a dedicated change that clearly documents the deprecation.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant