Skip to content

fix: Use BaseURL relative path for rate limit category - #4644

Open
auraseb wants to merge 1 commit into
google:masterfrom
auraseb:fix/ghes-rate-limit-category
Open

auraseb wants to merge 1 commit into
google:masterfrom
auraseb:fix/ghes-rate-limit-category

Conversation

@auraseb

@auraseb auraseb commented Oct 18, 2026

Copy link
Copy Markdown

bareDo passed req.URL.Path to GetRateLimitCategory, so on a client whose BaseURL has a path (GitHub Enterprise Server, /api/v3/) no prefix rule matched and search, code search, SCIM, source import, snapshot, SBOM and app manifest requests were all filed under CoreCategory. An exhausted code search limit then blocked unrelated core requests until it reset.

This strips the BaseURL path before categorizing. github.com clients are unaffected since their BaseURL path is /.

Tests:

  • TestDo_rateLimitCategory_baseURLPath fails without the change: an exhausted search/code limit lands in rateLimits[CoreCategory] and blocks a following GET user.
  • The existing search, SCIM, SBOM, snapshot, source import and app manifest tests used CoreCategory with the test server's /api-v3/ base path, which only worked because of this bug. They now pass their real category to testNewRequestAndDoFailureCategory.

Fixes #4643

@gmlewis gmlewis changed the title Use BaseURL relative path for rate limit category fix: Use BaseURL relative path for rate limit category Oct 18, 2026
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Oct 18, 2026
@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.62%. Comparing base (fef0352) to head (9dd7286).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4644   +/-   ##
=======================================
  Coverage   98.61%   98.62%           
=======================================
  Files         199      199           
  Lines       18694    18700    +6     
=======================================
+ Hits        18436    18442    +6     
  Misses        258      258           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
@auraseb
auraseb force-pushed the fix/ghes-rate-limit-category branch from 745ddfd to 9dd7286 Compare October 18, 2026 13:23

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @auraseb!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @Not-Dhananjay-Mishra

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

Labels

NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rate limit category is wrong when BaseURL has a path prefix (GitHub Enterprise Server)

2 participants