#1644

feat: write the API guides

Draftjubianchiwants to merge intofrom

WARNING

Depends on #1643, still open. Until it merges, this diff also shows its changes and #1642's; this pull request's own changes.

Summary

The API docs get the guides that tell what a reference can't: Authentication, Rate limits, Pagination and Errors. Third of five pull requests splitting #1533.

Changes

  1. Authentication. Public and signed requests, getting a key approved with PKCE, and signing a request, with a helper for the shell, Laravel and Node.js (ApiExamples::signing()) under tabs that keep the client picked.
  2. Rate limits and Errors read their budgets and code meanings from the limiters, routes and ApiErrorCode, so they change with them. On a phone, an error's meaning reads under its code instead of in a column past the edge. The limits move to where they are enforced: commits a minute to Commit, issues a day to CreateIssue, failed signatures a minute to SignedRequests.
  3. Pagination says which lists page differently. The Introduction now points to Pagination and Authentication.

A few sentences of Authentication mention the reference, which lands in #1646. The signing helpers sit under curl, Laravel and fetch tabs (the Node.js helper is what the fetch examples call), so the client picked here is the one the reference shows.

#Pull requestDepends on
0#1642 the console layoutproduction
1#1643 the API docs page and its Introduction0
2this one1
3#1645 the OpenAPI spec2
4#1646 the endpoint reference and search3

Validation

CheckResult
pest --parallel --coverage --exactly=100.0 (full suite)6495 passed, 100.0%
pest --type-coverage --min=100100.0%
pint --test, rector --dry-run, phpstanclean
TSX tests, tsc1133 passed, clean
Errors at 390each meaning under its code, no page overflow

ApiSigningGuideTest signs a read, a write without a body and a write with one through each helper exactly as the guide shows it, with a key made by ssh-keygen, and the API accepts them.

Visual evidence

Playwright (Chromium) against a local dev server on this branch, emulated viewports, Inertia SSR off. Each guide was captured at 1440×900, 1366×650 and 390×844, light and dark: layout shift (CLS) 0 on load, no horizontal overflow, no console error. Arrow keys on the signing tabs move focus and the selection together.

Authentication, 1440 light390 darkRate limits, 1440 light1366 dark
Pagination, 1440 darkErrors, 1440 lightFocus on the signing tabs, 1440 dark
Error codes, 1440 dark390 light, each meaning under its code

Device verification

Emulation only (390×844, DPR 2, touch): no hardware or simulator.

Independent review

Fresh read-only reviewers, given the guidelines, the stack, the validation results and the captures. A first round on the previous heads found should-fix points (fixtures and options ahead of their PR, the Errors table hiding its meanings on a phone, the Guilds preview, captures from before production's guild fields), all fixed. Re-review on base 1aa85cf4, head 5362b047: CODE: PASS, VISUAL: PASS, no blocker or should-fix. Left as is: a few sentences of Authentication mention the reference that lands in #1646.

Limitations

  • An unsigned 429 has no code; the pings and commit search limits answer without one; ThrottleCommits answers a scheduled commit from the API with a 302 unless it sends Accept: application/json. The guides describe the API as it behaves; these are left for a separate PR.
  • Authentication describes today's sign-in (loopback or devnull://); the device flow PR (#585, still open) changes that.

Activity

4
coderabbitai[bot]13d ago

IMPORTANT

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

This pull request is a draft

Merging is unavailable until it is marked ready for review.