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

POST /api/v1/repos/:owner/:name/pulls/:number/take-back opens the pull that undoes a shipped one, as the page's Take back does #7210

shipped production is serving it opened this has it
opened this

For: undoing a shipped change is one call for anything that speaks the API, not only a button on the page.

Today only the web form POST /:owner/:name/pulls/:number/take-back (src/web/studio/actions.ts:286) reaches revertPull (src/actions/revert.ts). The API and the OpenAPI document have no take-back.

Done:

  • [ ] POST /api/v1/repos/:owner/:name/pulls/:number/take-back calls revertPull with the token's user. It answers 201 with the new pull's JSON, shaped as GET pull answers it.
  • [ ] Each RevertPullError maps to one stable code and status: not_shipped 409, already_reverted 409, mirrored 409, an agent or a reader forbidden 403, an unknown pull not_found 404, and a revert that does not apply cleanly 409 conflict, with git's reason in message. A token needs rw.
  • [ ] The route is in the OpenAPI document (src/contract/openapi/routes/), and test/openapi.test.ts passes.
  • [ ] A new test/api-take-back.test.ts ships a pull, takes it back through the API, and asserts the new pull's title and base. It then asserts that a second take-back is already_reverted, and that an open pull is not_shipped.

Files: a new src/http/api/take_back.ts, registered with one line beside reportRoutes, an OpenAPI route file, one test. Risk: low. The rules stay in revertPull; this is a door.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs