Handle compact GitHub issue repo paths#20
Conversation
|
Warning Review limit reached
More reviews will be available in 29 minutes and 4 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces support for compact GitHub repository path layouts (owner__repo) in addition to the standard nested structure, updating path parsing functions and adding corresponding unit tests. The review feedback highlights a potential parsing bug when repository names contain underscores, suggesting the use of non-greedy matching ([^/]+?) for the owner group in the regular expressions to ensure correct splitting.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const match = path.match( | ||
| /^\/github\/repos\/([^/]+)\/([^/]+)\/issues\/(?:(?:by-id\/)?(\d+)\.json|(\d+)(?:__([^/]+))?\/(?:meta|metadata)\.json)$/u, | ||
| /^\/github\/repos\/(?:([^/]+)\/([^/]+)|([^/]+)__([^/]+))\/issues\/(?:(?:by-id\/)?(\d+)\.json|(\d+)(?:__([^/]+))?\/(?:meta|metadata)\.json)$/u, | ||
| ) |
There was a problem hiding this comment.
GitHub usernames and organization names are restricted to alphanumeric characters and hyphens, meaning they can never contain underscores (_). However, GitHub repository names are allowed to contain underscores.
In the compact layout owner__repo, if a repository name contains underscores (e.g., my_awesome_repo), the greedy match ([^/]+)__([^/]+) will incorrectly split the path, greedily matching up to the last __ and attributing part of the repository name to the owner.
Using a non-greedy match ([^/]+?) for the compact owner group ensures the regex correctly splits at the first __ delimiter.
| const match = path.match( | |
| /^\/github\/repos\/([^/]+)\/([^/]+)\/issues\/(?:(?:by-id\/)?(\d+)\.json|(\d+)(?:__([^/]+))?\/(?:meta|metadata)\.json)$/u, | |
| /^\/github\/repos\/(?:([^/]+)\/([^/]+)|([^/]+)__([^/]+))\/issues\/(?:(?:by-id\/)?(\d+)\.json|(\d+)(?:__([^/]+))?\/(?:meta|metadata)\.json)$/u, | |
| ) | |
| const match = path.match( | |
| /^\/github\/repos\/(?:([^/]+)\/([^/]+)|([^/]+?)__([^/]+))\/issues\/(?:(?:by-id\/)?(\d+)\.json|(\d+)(?:__([^/]+))?\/(?:meta|metadata)\.json)$/u, | |
| ) |
There was a problem hiding this comment.
Fixed in 786198e. The compact owner segment now uses GitHub owner characters ([A-Za-z0-9-]+) so repo names can contain underscores/double underscores without shifting into the owner. Added regression coverage for /github/repos/AgentWorkforce__cloud__platform/issues/by-id/2174.json and slugged meta paths.
|
|
||
| const githubIssueDirectoryPathParts = (path: string): { owner: string; repo: string; number: number; slug?: string } | undefined => { | ||
| const match = path.match(/^\/github\/repos\/([^/]+)\/([^/]+)\/issues\/(\d+)(?:__([^/]+))?$/u) | ||
| const match = path.match(/^\/github\/repos\/(?:([^/]+)\/([^/]+)|([^/]+)__([^/]+))\/issues\/(\d+)(?:__([^/]+))?$/u) |
There was a problem hiding this comment.
Similar to githubIssuePathParts, using a non-greedy match ([^/]+?) for the compact owner group prevents incorrect parsing when the repository name contains underscores.
| const match = path.match(/^\/github\/repos\/(?:([^/]+)\/([^/]+)|([^/]+)__([^/]+))\/issues\/(\d+)(?:__([^/]+))?$/u) | |
| const match = path.match(/^\/github\/repos\/(?:([^/]+)\/([^/]+)|([^/]+?)__([^/]+))\/issues\/(\d+)(?:__([^/]+))?$/u) |
There was a problem hiding this comment.
Fixed in 786198e with the same compact owner restriction in githubIssueDirectoryPathParts(). The backfill dedupe test now uses a compact directory path with a repo containing double underscores, so the private directory parser is covered too.
Summary
Closes #19
Tests