Skip to content

feat: let API clients request features and report bugs - #1543

Merged
nunomaduro merged 3 commits into
dev-null-sh:productionfrom
WendellAdriel:feat/api-issues
Nov 11, 2026
Merged

nunomaduro merged 3 commits into
dev-null-sh:productionfrom
WendellAdriel:feat/api-issues

Conversation

@WendellAdriel

@WendellAdriel WendellAdriel commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

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.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

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.

Changes: Signed API issue submission

Layer / File(s) Summary
Shared issue request validation
app/Http/Requests/CreateIssueRequest.php, app/Http/Requests/CreateApiIssueRequest.php
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.
Shared daily issue limit
app/Http/Middleware/ThrottleIssues.php, app/Http/Controllers/IssueController.php, routes/api.php, routes/web.php, tests/Feature/Controllers/IssueControllerTest.php, tests/Feature/Controllers/Api/IssueControllerTest.php, KNOWLEDGE_BASE.md
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.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant CreateApiIssueRequest
  participant IssueController
  participant CreateIssue
  Client->>CreateApiIssueRequest: Submit issue command, body, and environment
  CreateApiIssueRequest->>IssueController: Provide validated request
  IssueController->>CreateIssue: Create issue for current user
  CreateIssue-->>IssueController: Return issue or GitHub exception
  IssueController-->>Client: Return 201 issue or mapped 502 error
Loading

Possibly related issues

Possibly related PRs

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.

Share

@nunomaduro
nunomaduro merged commit 6020ace into dev-null-sh:production Nov 11, 2026
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.

2 participants