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

The OpenAPI document describes watching a milestone: PUT and DELETE …/milestones/{number}/watch #5421

Merged opened this

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

Merged

The OpenAPI document now describes `PUT` and `DELETE /api/v1/repos/{owner}/{name}/milestones/{number}/watch`.

shipped production is serving it deploy b4d876b

opened this

The OpenAPI document now describes PUT and DELETE /api/v1/repos/{owner}/{name}/milestones/{number}/watch.

  • Rows: Each method has its own row in ROUTES (src/contract/openapi.ts), placed in a separate block from the limb row. Each takes a token, has no request body, and answers { watching }. The refusals listed are what watchMilestone and the handler return:

- unauthorized: 401, no signed-in account. - forbidden: 403, only a person watches a milestone, so agents are refused. A token without write scope is also refused, but that refusal comes from requireScope, and I did not list it in the rows. - not_found: 404, the repository is unreadable or the number is not a milestone.

  • Coverage list: I removed the two watch lines from NOT_YET_DESCRIBED in test/openapi-coverage.test.ts.
  • New test: test/openapi-milestone-watch.test.ts reads both rows and checks each refusal code. It fails without the rows.
  • Test fix: The handler registers both methods in one loop, so test/openapi.test.ts could not see them as registered routes. I added a small expansion of that loop to its router-registration check, the same way it already handles the issues-and-pulls loop. I changed the test, not the code.

I ran test/openapi.test.ts, test/openapi-coverage.test.ts and the new test, and all 20 tests pass. I did not run the type check (bun x tsc --noEmit) or the rest of the suite. The sandbox has no bun type definitions: tsc stops on a missing bun types file before it checks any code.

I left out any behaviour change to the routes themselves. To try it, fetch GET /contract/openapi.json and look under the watch path.

🤖 Generated with Claude Code

Closes #5315

commented

The OpenAPI document now describes PUT and DELETE /api/v1/repos/{owner}/{name}/milestones/{number}/watch.

  • Rows: Each method has its own row in ROUTES (src/contract/openapi.ts), placed in a separate block from the limb row. Each takes a token, has no request body, and answers { watching }. The refusals listed are what watchMilestone and the handler return:

- unauthorized: 401, no signed-in account. - forbidden: 403, only a person watches a milestone, so agents are refused. A token without write scope is also refused, but that refusal comes from requireScope, and I did not list it in the rows. - not_found: 404, the repository is unreadable or the number is not a milestone.

  • Coverage list: I removed the two watch lines from NOT_YET_DESCRIBED in test/openapi-coverage.test.ts.
  • New test: test/openapi-milestone-watch.test.ts reads both rows and checks each refusal code. It fails without the rows.
  • Test fix: The handler registers both methods in one loop, so test/openapi.test.ts could not see them as registered routes. I added a small expansion of that loop to its router-registration check, the same way it already handles the issues-and-pulls loop. I changed the test, not the code.

I ran test/openapi.test.ts, test/openapi-coverage.test.ts and the new test, and all 20 tests pass. I did not run the type check (bun x tsc --noEmit) or the rest of the suite. The sandbox has no bun type definitions: tsc stops on a missing bun types file before it checks any code.

I left out any behaviour change to the routes themselves. To try it, fetch GET /contract/openapi.json and look under the watch path.

🤖 Generated with Claude Code

Approved

Approved. The two rows match the handler in src/http/api.ts (requireScope rw, then 401/403/404 as listed, answers { watching }). The preview serves both under /contract/openapi.json, the coverage list shrinks by exactly these two routes, and the new test fails without the rows. No behaviour change, no dependency. Next: (1) the rows could name the missing-write-scope refusal (requireScope) so a client sees every 403; (2) the regex that expands the PUT/DELETE loop in openapi.test.ts is brittle, so a small helper that expands method loops generally would serve the next such route.

commented

The full gate on land was red; the pull is open again. Red tests:

  • the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files are not audited
  • the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files are not audited [70.03ms] [shard 103]
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs