You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: let API clients request features and report bugs - #1543
On the web, /feature and /bug in the composer open a GitHub issue through the app, crediting the reporter. The signed API can only search issues for composer suggestions, so a device client has to send people to the web to report anything.
This adds signed POST api/v1/issues, which opens the issue through the same CreateIssue action, with the web's rules, timeout check and per-minute throttle. It answers 201 {number, url}. The request shares its rules with the web's through CreateIssueRequest::issueRules().
The web's limit of 10 opened issues a day lived inside IssueController, so a second route would have had its own count, letting a user double it by switching clients. It's now a ThrottleIssues middleware on both routes, with one count per user, like ThrottleCommits does for commits. Only issues GitHub opened count. Once a user reaches the limit, an app gets rate_limited with Retry-After, and the web gets the same 429 as before. Because the check now runs before validation, an invalid draft sent at the limit gets 429 on the web instead of 422.
When GitHub fails, the API answers 502 with one of two new codes. github_issue_refused means GitHub refused it, so trying again is safe. github_issue_unanswered means GitHub didn't answer, so the issue may already exist. Both use the web's messages.
Summary by CodeRabbit
New Features
Added an authenticated API endpoint for submitting feature requests and bug reports.
API issue submissions now share a daily limit of 10 successfully opened issues with web submissions.
Bug Fixes
Failed requests and rejected drafts do not count toward the daily limit.
Added clearer API errors when issue submissions are refused or the service cannot be reached.
The pull request adds an authenticated API endpoint for creating feature and bug issues. It shares issue validation and a daily limit of ten successful submissions across API and web routes. GitHub refusal and connection failures return distinct API errors.
The API request normalizes the body and reuses the web request’s validation rules and environment filtering.
API issue creation app/Enums/ApiErrorCode.php, app/Exceptions/ApiException.php, app/Http/Controllers/Api/IssueController.php, tests/Feature/Controllers/Api/IssueControllerTest.php
The controller creates issues and maps GitHub request and connection failures to distinct 502 errors. Tests cover successful requests, authorization, validation, timeouts, and GitHub failures.
The middleware shares a ten-successful-issues-per-day limit across API and web submissions. It counts responses with status 201 and returns rate-limit responses when the limit is reached.
dev-null-sh/dev-null.sh#653: Both pull requests add the signed issue API endpoint and shared daily issue throttling.
Suggested reviewers:nunomaduro
Merge Risk: Minimal · up to 739a3
The change adds a signed API endpoint for opening issues and shares the daily limit with the web. No merge-blocking defect was established. Concurrent requests could briefly exceed the limit, as they already could on the web. The 502 error classification for GitHub server errors may deserve a later look.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the web,
/featureand/bugin the composer open a GitHub issue through the app, crediting the reporter. The signed API can only search issues for composer suggestions, so a device client has to send people to the web to report anything.This adds signed
POST api/v1/issues, which opens the issue through the sameCreateIssueaction, with the web's rules, timeout check and per-minute throttle. It answers201 {number, url}. The request shares its rules with the web's throughCreateIssueRequest::issueRules().The web's limit of 10 opened issues a day lived inside
IssueController, so a second route would have had its own count, letting a user double it by switching clients. It's now aThrottleIssuesmiddleware on both routes, with one count per user, likeThrottleCommitsdoes for commits. Only issues GitHub opened count. Once a user reaches the limit, an app getsrate_limitedwithRetry-After, and the web gets the same 429 as before. Because the check now runs before validation, an invalid draft sent at the limit gets 429 on the web instead of 422.When GitHub fails, the API answers 502 with one of two new codes.
github_issue_refusedmeans GitHub refused it, so trying again is safe.github_issue_unansweredmeans GitHub didn't answer, so the issue may already exist. Both use the web's messages.Summary by CodeRabbit