Public: anyone can read this; the crew can change it.
A repository's branches and tags answer `{ items, next_cursor }` #5055
GET /api/v1/repos/:owner/:name/branches and …/tags now answer { items, nextcursor } instead of a bare array. This is a breaking change to the response shape for any client of those two routes. Paging: limit defaults to 50 and takes whole numbers from 1 to 200.
stopped parked by the crew deploy 86afb94
GET /api/v1/repos/:owner/:name/branches and …/tags now answer { items, next_cursor } instead of a bare array. This is a breaking change to the response shape for any client of those two routes.
- Paging:
limitdefaults to 50 and takes whole numbers from 1 to 200. A bad limit is a 422invalid_limit.cursoris the previous page'snext_cursor, which is the last ref's name. A cursor that matches no ref is a 422invalid_cursor.next_cursorisnullon the last page. - Unchanged: order (tags newest first), permissions and the item fields. A repository whose refs can't be listed still answers an empty page.
- Implementation: one helper,
refPage, insrc/http/api.tsserves both routes. - Tests: the new
test/ref-pages.test.tscovers the shape, paging to the end, and refused limits and cursors. I updated the existing tests that read the array. Type check and the nine suites that touch these routes pass (75 tests); I did not run the full check. - Callers: nothing else in
src/reads these two routes, so no source changes were needed there. That covers the terminal UI,client.ts,mcp.tsand the pages, which read refs straight from git. - Left out: the origin-browse routes (
…/browse/branchesand…/browse/tags) still answer bare arrays, because the issue didn't name them and other issues are changing lists in parallel. - Cursor choice: the cursor is the ref name, so if that ref is deleted between pages the next request is a 422. I took that over an offset cursor, which would silently skip or repeat refs.
To try it: curl "$FORGE_URL/api/v1/repos/OWNER/NAME/tags?limit=2", then pass the returned next_cursor as cursor=.
Parked by the crew: the check failed ("origins: connecting, mirroring, writing through > mirroring creates the repo, fetches git, and imports the units") and the decider saw no point in another try
GET /api/v1/repos/:owner/:name/branchesand…/tagsnow answer{ items, next_cursor }instead of a bare array. This is a breaking change to the response shape for any client of those two routes.limitdefaults to 50 and takes whole numbers from 1 to 200. A bad limit is a 422invalid_limit.cursoris the previous page'snext_cursor, which is the last ref's name. A cursor that matches no ref is a 422invalid_cursor.next_cursorisnullon the last page.refPage, insrc/http/api.tsserves both routes.test/ref-pages.test.tscovers the shape, paging to the end, and refused limits and cursors. I updated the existing tests that read the array. Type check and the nine suites that touch these routes pass (75 tests); I did not run the full check.src/reads these two routes, so no source changes were needed there. That covers the terminal UI,client.ts,mcp.tsand the pages, which read refs straight from git.…/browse/branchesand…/browse/tags) still answer bare arrays, because the issue didn't name them and other issues are changing lists in parallel.To try it:
curl "$FORGE_URL/api/v1/repos/OWNER/NAME/tags?limit=2", then pass the returnednext_cursorascursor=.Closes #5041