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

The OpenAPI document describes labels made and removed, a commit's check, and a file read by path #5175

opened this

Merged 37d 7h ago, live in production

The OpenAPI document now describes four more routes, so a harness can manage labels and read a commit's verdict through it alone. test/openapi.test.ts passes (12 tests). The type check could not run here: bun x tsc --noEmit fails with "Cannot find type definition file for 'bun'", so I did not run it.

Notes

opened this

The OpenAPI document now describes four more routes, so a harness can manage labels and read a commit's verdict through it alone. test/openapi.test.ts passes (12 tests). The type check could not run here: bun x tsc --noEmit fails with "Cannot find type definition file for 'bun'", so I did not run it. The forge's check will.

I added one block of rows right after ${REPO}/tags in src/contract/openapi.ts, and changed no other row:

  • POST ${REPO}/labels: needs the admin scope, takes name and color, and answers 201. Refusals are invalid and taken, both 422.
  • DELETE ${REPO}/labels/{id}: needs the admin scope and answers 204 with no body. A missing label is a 404; I did not give it a refusals entry because it carries no error code.
  • GET ${REPO}/commits/{oid}/check: public, never cached. The summary gives the answer's fields and the five state values, and says a short id, unknown commit or unreadable repository is a 404.
  • GET ${REPO}/contents/{path}: public, reads the ref query. The summary gives the directory and file shapes and says a file over 5 MB answers 413 with { type: file, tooLarge, size }.

I added a test that asserts each new path and method is in the served document, with its auth, body fields, status and parameters.

I also changed an existing test. The "every described route is registered in the router" test did not recognise the router's path wildcard, so the new contents/{path} row failed it. It now treats name like :name. The test was wrong, not the code.

I left out the GET labels and commits rows, which #4846 adds. The unreadable-repository 404 and the 413 have no stable error code, so they are described in the summaries only.

To try it, fetch the OpenAPI document and look under /api/v1/repos/{owner}/{name}/ for labels, labels/{id}, commits/{oid}/check and contents/{path}.

Closes #5113

Show 1 earlier items

7 earlier comments
commented

I merged main into the branch and pushed it (45849645); bun test test/openapi.test.ts passes (18 tests).

The only conflict was in test/openapi.test.ts, where both sides had appended new tests at the end of the file. I kept both sets:

  • From this branch: the test for labels made and removed, a commit's check, and a file read by path.
  • From main: the three tests for sign-ins and ending one, branch and contents writes, and the contents refusals.

I did not run the full suite. I also could not run the type check, because bun x tsc --noEmit fails here with "Cannot find type definition file for 'bun'". I did not run bun install to fix that. The forge's check on the push will run both.

commented

I merged main into the branch again and pushed it (039418ba). bun test test/openapi.test.ts passes (19 tests). I didn't run the full suite or the type check; the forge's check on the push will.

The only conflict was in test/openapi.test.ts, where both sides had appended tests at the end of the file. I kept both:

  • From this branch: the test for labels made and removed, a commit's check, and a file read by path.
  • From main: the new test for the admin's writes (a capacity setting, a limit and a team).
commented

Steward: this pull is approved but no longer merges into main. #5932 split src/http/mcp.ts into one file per tool, and several other shared files moved. Bring it up to date with main: merge main and resolve keeping this pull's intent. If it adds or changes an MCP tool, move that into its own file in the new layout and regenerate the docs. Then let the check run. If the change is already on main, say so and close the pull.

commented

The OpenAPI document now describes labels made and removed, a commit's check, and a file read by path. I merged main and moved the four rows into main's new per-route layout. The OpenAPI tests pass (271). bun x tsc --noEmit failed here with "Cannot find type definition file for 'bun'", so the type check did not run.

  • Route files: the four rows are now separate files under src/contract/openapi/routes/:
    • postApiV1ReposOwnerNameLabels.ts: make a label
    • deleteApiV1ReposOwnerNameLabelsId.ts: remove a label
    • getApiV1ReposOwnerNameCommitsOidCheck.ts: a commit's check
    • getApiV1ReposOwnerNameContentsPath.ts: read a file by path
  • Index and test: I regenerated routes/index.ts with bun scripts/openapi-routes.ts and re-added the pull's test to test/openapi.test.ts.
  • Coverage list: I removed the label routes and the contents route from NOT_YET_DESCRIBED in test/openapi-coverage.test.ts. I also tried to remove the commit-check line, but nothing matched, so I haven't confirmed that route is off the list. The coverage test still reports 15 entries that could be removed. I did not check whether any of those are mine.
  • Left out: the root-tree contents route with no path still has no row, as Sentinel noted. No MCP tools are touched, so no docs needed regenerating.
commented

The review approved the pull with no changes requested, so I made no changes and pushed nothing.

I agree with the review's reading. The pull only adds documentation: four OpenAPI route rows, three entries removed from NOT_YET_DESCRIBED, and one test that fails if any of the rows is removed.

commented

No change this round: nobody has commented on the pull since my last run, so I found nothing to address and pushed nothing. The branch matches origin.

The OpenAPI document now describes four more routes, so a harness can manage labels and read a commit's verdict through it alone:

  • POST ${REPO}/labels: needs the admin scope, takes name and color, and answers 201. Refusals are invalid and taken, both 422.
  • DELETE ${REPO}/labels/{id}: needs the admin scope and answers 204 with no body. A missing label is a 404 with no error code, so it has no refusals entry.
  • GET ${REPO}/commits/{oid}/check: public, never cached. The summary gives the answer's fields and the five state values, and says a short id, unknown commit or unreadable repository is a 404.
  • GET ${REPO}/contents/{path}: public, reads the ref query. The summary gives the directory and file shapes and says a file over 5 MB answers 413 with { type: file, tooLarge, size }.

I added a test that asserts each new path and method is in the served document, with its auth, body fields, status and parameters.

I also changed an existing test. The "every described route is registered in the router" test did not recognise the router's path wildcard, so the new contents/{path} row failed it. It now treats name like :name. The test was wrong, not the code.

I left out the GET labels and commits rows, which #4846 adds. The unreadable-repository 404 and the 413 have no stable error code, so they are described in the summaries only.

I re-checked this run: after bun install, bun x tsc --noEmit is clean and bun test test/openapi.test.ts passes (23 tests). To try it, fetch the OpenAPI document and look under /api/v1/repos/{owner}/{name}/ for the four paths.

Closes #5113

commented

Handed to a person by the crew: this pull is approved, but 2 runs to bring it up to date with main ended without a push, so no more start here. Conflicting files: test/openapi-coverage.test.ts, test/openapi.test.ts. Merge main into it, or say what to try and assign it back to the crew. (The forge posts this under your name; you did not write it.)

commented

I merged main into the branch and pushed it (cf913419), so it no longer conflicts. bun x tsc --noEmit is clean and bun test test/openapi passes (335 tests across 26 files). I did not run the whole suite; the forge's check will.

The only conflicts were in the two test files:

  • test/openapi-coverage.test.ts: both sides had edited the NOT_YET_DESCRIBED list. I dropped the DELETE …/pulls/{}/hold and DELETE …/labels/{} lines, because main already describes both routes in src/contract/openapi/routes/.
  • test/openapi.test.ts: both sides had appended a test at the end. I kept both: this pull's test for labels, a commit's check and a file read by path, and main's test for the feed, chips and asks routes.

main has since split the OpenAPI rows into one file per route under src/contract/openapi/routes/, and those files already include the label, commit-check and contents-by-path routes. This pull's tests still pass against them.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs