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

The OpenAPI document describes editing a pull, its reviews, approving it here and assigning an issue or pull #5261

Merged opened this

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

Merged

The OpenAPI document now has rows for editing a pull, listing and posting reviews, approving here, and assigning an issue or a pull. The openapi tests (13 files, 29 tests) and the type check pass, and I pushed the branch. I did not run the full `bun test`.

shipped production is serving it deploy c48dffd

opened this

The OpenAPI document now has rows for editing a pull, listing and posting reviews, approving here, and assigning an issue or a pull. The openapi tests (13 files, 29 tests) and the type check pass, and I pushed the branch. I did not run the full bun test.

  • Rows added in src/contract/openapi.ts: each sits beside its neighbours by path and gives the summary, auth, body fields, success status and refusal codes the handler answers.

- PATCH {REPO}/pulls/{number} takes title, body and state. Its refusals are invalid_text, invalid_state, invalid_reason and nothing_to_change. - GET …/pulls/{number}/reviews is new and has no refusals. - POST …/pulls/{number}/reviews already had a row, but it described a verdict body. The handler actually takes a single-line comment (path, line, side, body), answers 201 and refuses with bad_anchor, so I rewrote it. Verdicts go to …/review-states, which this issue does not cover. - POST …/pulls/{number}/approve-here answers 201. Its refusals are not_foreign, self_review and not_open. - PUT …/issues/{number}/assignee and PUT …/pulls/{number}/assignee take assignee, a username or null. Both refuse with invalid_assignee and no_such_user.

  • New test/openapi-pulls.test.ts: it asserts all six path and method pairs are in the document. It also boots an app and checks one refusal per row against the live route: invalid_state, bad_anchor, not_foreign and no_such_user (for both assignee routes).
  • One edit to test/openapi.test.ts: its "every described route is registered" check reads route registrations as literal strings, so it couldn't see the assignee routes, which api.ts registers in a loop over issues and pulls. I made it expand that loop into two routes. The check itself is unchanged.

Not covered:

  • The routes themselves are unchanged.
  • The self_review, not_open, invalid_text, invalid_reason, nothing_to_change and invalid_assignee refusals are documented but not exercised by a test.

Try it with bun test test/openapi, or fetch GET /contract/openapi.json and look for the six entries.

🤖 Generated with Claude Code

Closes #5241

commented

The OpenAPI document now has rows for editing a pull, listing and posting reviews, approving here, and assigning an issue or a pull. The openapi tests (13 files, 29 tests) and the type check pass, and I pushed the branch. I did not run the full bun test.

  • Rows added in src/contract/openapi.ts: each sits beside its neighbours by path and gives the summary, auth, body fields, success status and refusal codes the handler answers.

- PATCH {REPO}/pulls/{number} takes title, body and state. Its refusals are invalid_text, invalid_state, invalid_reason and nothing_to_change. - GET …/pulls/{number}/reviews is new and has no refusals. - POST …/pulls/{number}/reviews already had a row, but it described a verdict body. The handler actually takes a single-line comment (path, line, side, body), answers 201 and refuses with bad_anchor, so I rewrote it. Verdicts go to …/review-states, which this issue does not cover. - POST …/pulls/{number}/approve-here answers 201. Its refusals are not_foreign, self_review and not_open. - PUT …/issues/{number}/assignee and PUT …/pulls/{number}/assignee take assignee, a username or null. Both refuse with invalid_assignee and no_such_user.

  • New test/openapi-pulls.test.ts: it asserts all six path and method pairs are in the document. It also boots an app and checks one refusal per row against the live route: invalid_state, bad_anchor, not_foreign and no_such_user (for both assignee routes).
  • One edit to test/openapi.test.ts: its "every described route is registered" check reads route registrations as literal strings, so it couldn't see the assignee routes, which api.ts registers in a loop over issues and pulls. I made it expand that loop into two routes. The check itself is unchanged.

Not covered:

  • The routes themselves are unchanged.
  • The self_review, not_open, invalid_text, invalid_reason, nothing_to_change and invalid_assignee refusals are documented but not exercised by a test.

Try it with bun test test/openapi, or fetch GET /contract/openapi.json and look for the six entries.

🤖 Generated with Claude Code

Approved

The six rows match the handlers I read (PATCH pull, GET/POST reviews, approve-here 201 with its three refusals, both assignee PUTs). The preview serves the document. Tests cover the paths and one refusal per row, and the openapi.test loop expansion is a fair fix. Two things next: (1) test the documented refusals that are still unexercised (self_review, not_open, invalid_text, invalid_reason, nothing_to_change, invalid_assignee); (2) document the PATCH pull reason/into body fields the invalid_reason row mentions, or drop that row if a pull never takes them.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs