Skip to content

docs: summarize the remaining guild, organization, user and starred endpoints - #1667

Draft
jubianchi wants to merge 6 commits into
dev-null-sh:productionfrom
jubianchi:feat/api-docs-summaries
Draft

jubianchi wants to merge 6 commits into
dev-null-sh:productionfrom
jubianchi:feat/api-docs-summaries

Conversation

@jubianchi

Copy link
Copy Markdown
Contributor

Warning

Depends on #1646 (and the PRs below it), still open. Until they merge, this diff also shows their changes; this pull request's own changes.

Summary

Seven endpoints still had no summary in the API docs: one in Guilds, two in Organizations, three in Users and one in Me. Each was a single docblock away, so this fills them in one go, after #1666 did the headlines.

Changes

  1. Summaries. Docblocks on the controller methods, which Scramble turns into the summaries of the spec and the docs:
    Endpoint Says
    GET /guilds 24 a page, most members first, ?q= over handle, name and description; a 404 while guilds aren't open to the account
    POST /organizations/{handle}/follow following again changes nothing; a 404 for an organization without a page
    DELETE /organizations/{handle}/follow unfollowing one you don't follow changes nothing; a 404 for an organization without a page
    POST /users/{handle}/follow notified once, unless they mute the follower; a 403 for yourself or across a block
    DELETE /users/{handle}/follow unfollowing someone you don't follow changes nothing
    DELETE /users/{handle}/mute answers with the user and is_muting: false, like the mute does with true
    GET /starred last starred first, 20 a page, without the commits the user can no longer see
  2. Spec. resources/api/openapi.json is generated again; only these seven summaries change. A dataset test checks each of them.

No code changes: what the API answers stays the same.

Validation

Check Result
pest --parallel --coverage --exactly=100.0 (full suite) 6667 passed, 100.0%
pest --type-coverage --min=100 100.0%
pint --test, rector --dry-run, phpstan clean
scramble:export same spec as committed

Visual evidence

Playwright (Chromium) against a local dev server, each page opened on an endpoint of this PR. Before is #1646, after is this branch.

Before, 1440 light After, 1440 light After, 1440 dark
GET /guilds before: no summary, desktop, light GET /guilds after: its summary, desktop, light GET /guilds after, desktop, dark
Users before: following, unfollowing and unmuting with no summary, desktop, light Users after: following, unfollowing and unmuting with their summaries, desktop, light Users after, desktop, dark
Before, 390 light After, 390 light
GET /guilds before, mobile, light GET /guilds after, mobile, light

Device verification

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

Independent review

A fresh read-only reviewer, given the guidelines, the diff, the validation results and the captures, checked each summary against the requests, actions and queries behind it. On base 3c4a4838 (#1646), head 6834e85b: CODE: PASS, VISUAL: PASS. Applied in e530ed51:

  • unfollowing an organization without a page is a 404 too;
  • following notifies only the first time, and not someone who mutes the follower;
  • a refused follow is a 403;
  • starred commits the user can no longer see are left out.

Limitations

  • As in feat: list every endpoint of the API in its docs #1646, Scramble reads denyAsNotFound() as a 403: the error list of GET /guilds and of following an organization shows a 403 where the API answers 404. The summaries say 404.
  • Commits and Remotes still have endpoints without a summary; they come next, each in its own PR.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

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

The API docs page reuses the operations console's shell: the sidebar of
grouped pages, the header naming the current one, the mobile nav that
scrolls sideways, the theme switch and the way back to /dev/null.

ConsoleLayout now draws that shell from its props: the brand chip and
label, the nav landmark's own label, whether its links prefetch, and a
title that falls back to the console's name. OperationsLayout keeps
what only operations does (polling, refreshing, the remotes dock) and
passes its pages in, with Moderation as an item elsewhere and prefetch
off, as before. Nothing changes on screen: captures before and after
differ only in the pulsing live dot.

Two things only the API docs will use come with it, as part of the
shell: links that prefetch, which operations leaves off, and the way
back for a guest on a phone, since operations only has signed-in
admins.
/docs/api opens the API docs, readable by everyone, on the console
layout: the guides in the sidebar, the section named in the header,
and the way back to /dev/null. A section the docs don't have is the
not found page.

This first step brings the page and its Introduction: what the API is
for, its base URL and format, and a first request anyone can send. Its
code is highlighted on the server and shown in the site's own code
blocks. The other guides, the OpenAPI spec and the endpoint reference
follow in their own pull requests.

The docs are linked as API from the aside, after Apps, and from the
user menu where the aside is hidden.
The API docs get the guides that tell what a reference can't.
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 under tabs that keep the client picked. 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. Pagination says which lists
page differently. The Introduction now points to Pagination and
Authentication.

The limits the guide lists move to where they are enforced and read
from there: the commits a minute to Commit, the issues a day to
CreateIssue, the failed signatures a minute to SignedRequests. A test
signs a read, a write without a body and a write with one through each
helper exactly as the guide shows it, and the API accepts them.
Nothing tells a developer what the v1 API offers but the code. Scramble
reads it (routes, form requests, resources and their docblocks) and
exports an OpenAPI 3.1 spec, committed as resources/api/openapi.json so
anyone building on the API can read it without running Scramble.
GET /api/v1/openapi.json serves it to anyone, cached for an hour with an
ETag, for Postman, Bruno, Insomnia or a client generator. The API docs
link to it from their sidebar and their Introduction.

`composer generate:openapi` writes it again; it reads the models'
columns from the database, so it needs a migrated one. A test exports
it afresh and fails when the code and the committed spec disagree. The
export doesn't depend on APP_NAME or the locale.

Scramble is a dev dependency: its provider is always listed, since
make:provider rewrites bootstrap/providers.php as a plain list, and does
nothing without it. Its own docs page is turned off: /docs/api is ours.

On top of what Scramble infers, transformers in app/OpenApi:

- leave out, by route name, what only the apps use to work: signing in,
  live updates, the web session and the signed URLs of remote media and
  guild icons;
- name path parameters after what the route reads ({handle}), described
  as that field, and refuse two parameters named alike;
- say whether an endpoint needs a signed request or only reads more with
  one, and describe its 401 accordingly, and a 429 as a message with
  rate_limited only for signed requests;
- describe a request with images as JSON, or as a signed multipart
  upload of that JSON beside them, sent as a binary file part;
- keep a commit's poll optional and nullable, its options and duration
  required only when there is one, as its rules say;
- describe a commit's author as the user or organization it is, what
  resources build with the services they resolve, and how long a
  commit's body may be as links count.

Endpoints keep Scramble's grouping by controller for now: the reference
groups them as the docs list them.
The API docs get their reference, read from the committed spec: every
endpoint by group, the groups in alphabetical order and named after the
first segment of the paths they list (the log and starred commits under
Me), which the spec now groups its endpoints by. An endpoint the docs
have no group for fails the export, saying where to add one.

Each endpoint folds to its method, tinted by what it does, its path,
summary and whether it is signed, and opens to its path and query
parameters, body, responses, and the errors with fields of their own,
the others pointing to Errors. Each part reads as fields or as its JSON
schema, picked for that part alone, loaded on demand from
/docs/api/{section}/schemas/{endpoint}, outside the web group so caches
can share it, every referred schema written once in $defs. Examples in
curl, Laravel and fetch ask for JSON and send the very bytes they sign,
a scheduled commit's date computed when they run, valid values for the
fields and query parameters that check their format, and follow the
endpoint as it scrolls. A group, the index and an endpoint's schemas
are cached under one key each, replaced when the spec or the code
reading it changes.

⌘K, Ctrl+K or / search the guides and endpoints, from an index sent
once per visit. A pick on another page closes the search once that page
arrives; closing it otherwise hands focus back to the search button.

Loading, failure and retry keep the page still: the fields stay until
a schema arrives, a failure lies over them on one line on any phone,
is announced once, and Try again keeps focus on the part it was in.
…ndpoints

Seven API endpoints had no summary in the docs. Their controller methods
now carry docblocks, which Scramble turns into summaries: the guild
directory, following and unfollowing organizations and users, unmuting a
user and the starred commits. The spec is generated again; nothing
changes in what the API answers.
@jubianchi
jubianchi force-pushed the feat/api-docs-summaries branch from e530ed5 to 0db5a5b Compare November 22, 2026 19:03
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.

1 participant