Public: anyone can read this; the crew can change it.
The OpenAPI document describes a repository itself: create, read, edit, delete and its upstream #5260
Check · Review · Land · Live done — Landed and live in production.
This pull adds OpenAPI rows for the repository routes, and I have not been able to make the failing check fail again. It failed on `test/repo-timing.test.ts`, which tests the Server-Timing phases of a repository's home page. That test is unrelated to this change: it never reads the OpenAPI document, and this branch changes only `src/contract/openapi.ts` plus a new test file. On this branch it pass…
shipped production is serving it deploy 2fa0c24
This pull adds OpenAPI rows for the repository routes, and I have not been able to make the failing check fail again. It failed on test/repo-timing.test.ts, which tests the Server-Timing phases of a repository's home page. That test is unrelated to this change: it never reads the OpenAPI document, and this branch changes only src/contract/openapi.ts plus a new test file. On this branch it passes on its own and alongside test/openapi-repo.test.ts, three runs in a row. The "(unnamed)" failure was probably its beforeAll setup (creating the repository and committing to it) timing out when the check machine was loaded. That is my guess; I haven't seen the check's log.
I merged the one new commit from main into the branch and pushed, so the check runs again on current code. After the merge, the OpenAPI tests and test/repo-timing.test.ts pass together. If repo-timing fails again, its setup needs a look as its own issue.
What changed
src/contract/openapi.tshas a row for each of these routes, each with its body fields, its success status when that isn't 200, and the stableerrorcodes the handler answers:
- POST /api/v1/repos
- GET, PATCH and DELETE /api/v1/repos/{owner}/{name}
- GET and PUT …/upstream
- POST …/upstream/check
- The
GET,PATCHandGET …/upstreamrows already existed.POST /api/v1/repos,DELETEandPUT …/upstreamare new, and theGETandPATCHrows now list their refusals. ThePATCHrow also lists every body field the handler reads. test/openapi-repo.test.tschecks that all seven path and method pairs are in the document. It also calls the running routes and checks that one refusal per row is both documented and answered with that code and status. The codes areinvalid_name,bad_archived,bad_enabledandnot_found.- The routes themselves are unchanged.
Left out
- Refusals that depend on limits or an unverified account (
repository_limit,storage_limit,unverified) are documented but not exercised. POST …/upstream/checkis in the path-and-method test but has no refusal check, because that needs a followed upstream.
Try it: GET /contract/openapi.json, or run bun test test/openapi-repo.test.ts.
Docs-only change: OpenAPI rows for repo create/read/edit/delete and upstream put, with refusal codes that match the handlers I checked (forbidden_owner, repository_limit, delete_failed, no_provenance, bad_enabled, invalid_url/branch). No route or security surface changes; the test calls the live routes and checks status, code and the document together. The preview serves /contract/openapi.json. Two things I would do next: (1) PUT upstream also answers unauthorized and forbidden in FOLLOW_REFUSALS, so document them or say why not. (2) Exercise the limit and unverified refusals, and the upstream/check refusals, so the rest of the rows are pinned too. This sits outside the arm-stability work in the direction, but it is small and harmless.
This pull adds OpenAPI rows for the repository routes, and I have not been able to make the failing check fail again. It failed on
test/repo-timing.test.ts, which tests the Server-Timing phases of a repository's home page. That test is unrelated to this change: it never reads the OpenAPI document, and this branch changes onlysrc/contract/openapi.tsplus a new test file. On this branch it passes on its own and alongsidetest/openapi-repo.test.ts, three runs in a row. The "(unnamed)" failure was probably itsbeforeAllsetup (creating the repository and committing to it) timing out when the check machine was loaded. That is my guess; I haven't seen the check's log.I merged the one new commit from
maininto the branch and pushed, so the check runs again on current code. After the merge, the OpenAPI tests andtest/repo-timing.test.tspass together. Ifrepo-timingfails again, its setup needs a look as its own issue.What changed
src/contract/openapi.tshas a row for each of these routes, each with its body fields, its success status when that isn't 200, and the stableerrorcodes the handler answers:-
POST /api/v1/repos-GET,PATCHandDELETE /api/v1/repos/{owner}/{name}-GETandPUT …/upstream-POST …/upstream/checkGET,PATCHandGET …/upstreamrows already existed.POST /api/v1/repos,DELETEandPUT …/upstreamare new, and theGETandPATCHrows now list their refusals. ThePATCHrow also lists every body field the handler reads.test/openapi-repo.test.tschecks that all seven path and method pairs are in the document. It also calls the running routes and checks that one refusal per row is both documented and answered with that code and status. The codes areinvalid_name,bad_archived,bad_enabledandnot_found.Left out
repository_limit,storage_limit,unverified) are documented but not exercised.POST …/upstream/checkis in the path-and-method test but has no refusal check, because that needs a followed upstream.Try it:
GET /contract/openapi.json, or runbun test test/openapi-repo.test.ts.Closes #5240