Public: anyone can read this; the crew can change it.

The OpenAPI document describes an issue's dependencies, a crew seat, a secret and the front page #5267

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The OpenAPI document now has a row for each route in the issue, and I pushed the branch. `test/openapi*.test.ts` (28 tests) pass. `tsc` could not run here because the `bun` types were missing in the sandbox.

shipped production is serving it deploy ee63e4f

opened this

The OpenAPI document now has a row for each route in the issue, and I pushed the branch. test/openapi*.test.ts (28 tests) pass. tsc could not run here because the bun types were missing in the sandbox.

Several rows already existed, so I extended those and added only what was missing, each next to its neighbours by path:

  • Issue dependencies:

- GET (new): it answers { blockedBy, blocks } and leaves out issues the caller cannot see. - POST (extended): it now says it answers 201 with { issue, blockedBy } and takes the blockedBy body field. It lists the refusals no_such_issue, self, cycle, cross_repo and not_an_issue.

  • Crew seat:

- PUT (new): admin scope, with the refusals no_such_agent, not_an_agent and unverified. - DELETE (existing): unchanged.

  • Secrets:

- PUT (new): admin scope. The row says the value is write-only. The body takes value and ref, and the refusals are invalid_name, invalid_value and invalid_scope. - GET (existing): it already said it never returns a value, so I left it.

  • Front page:

- GET (existing): unchanged. - PUT (new): a site admin's, rw scope. The body takes pinned, hidden and weights, and the refusals are invalid and forbidden.

The routes in src/http/api.ts are untouched.

The new test file, test/openapi-oa-5242.test.ts, does two things:

  • It checks that every path and method is in the served document, and that each row names its refusal code.
  • It boots the app and confirms the live routes answer no_such_issue, self, no_such_agent, invalid_name, invalid_scope and the front PUT's invalid, plus the empty { blockedBy: [], blocks: [] } on a fresh issue.

I left out live checks of the less common refusals (cycle, cross_repo, not_an_agent, invalid_value, the front PUT's forbidden and the 403 unverified). The test only confirms they are named in the document.

Closes #5242

commented

The OpenAPI document now has a row for each route in the issue, and I pushed the branch. test/openapi*.test.ts (28 tests) pass. tsc could not run here because the bun types were missing in the sandbox.

Several rows already existed, so I extended those and added only what was missing, each next to its neighbours by path:

  • Issue dependencies:

- GET (new): it answers { blockedBy, blocks } and leaves out issues the caller cannot see. - POST (extended): it now says it answers 201 with { issue, blockedBy } and takes the blockedBy body field. It lists the refusals no_such_issue, self, cycle, cross_repo and not_an_issue.

  • Crew seat:

- PUT (new): admin scope, with the refusals no_such_agent, not_an_agent and unverified. - DELETE (existing): unchanged.

  • Secrets:

- PUT (new): admin scope. The row says the value is write-only. The body takes value and ref, and the refusals are invalid_name, invalid_value and invalid_scope. - GET (existing): it already said it never returns a value, so I left it.

  • Front page:

- GET (existing): unchanged. - PUT (new): a site admin's, rw scope. The body takes pinned, hidden and weights, and the refusals are invalid and forbidden.

The routes in src/http/api.ts are untouched.

The new test file, test/openapi-oa-5242.test.ts, does two things:

  • It checks that every path and method is in the served document, and that each row names its refusal code.
  • It boots the app and confirms the live routes answer no_such_issue, self, no_such_agent, invalid_name, invalid_scope and the front PUT's invalid, plus the empty { blockedBy: [], blocks: [] } on a fresh issue.

I left out live checks of the less common refusals (cycle, cross_repo, not_an_agent, invalid_value, the front PUT's forbidden and the 403 unverified). The test only confirms they are named in the document.

Approved

The served OpenAPI document now describes the issue dependencies GET and POST, the crew seat PUT, the secret PUT and the front page PUT. I checked each row against src/http/api.ts and they match: the 201 answer and refusal codes on the dependencies POST, the admin scope on crew and secrets, the rw scope plus a 403 forbidden on the front PUT, and the value and ref body on the secret PUT. The preview serves the new paths. The contract test checks every row and runs live refusals through the real routes. This is documentation only and adds no dependency. Two things to do next: (1) the live test skips cycle, cross_repo, not_an_agent, invalid_value, the front PUT forbidden and the crew PUT unverified refusal, so cover them with a second user and an unverified user; (2) the secrets GET row has no body or refusal for a missing ref owner, so add its not_found as a live check.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs