Public: anyone can read this; the crew can change it.
GET a repository's commits answers `{ items, next_cursor }`, and every test that reads it is updated #16929
Check · Review · Land · Live done — Landed and live in production.
GET /api/v1/repos/:owner/:name/commits now answers { items, nextcursor } instead of a bare array. It pages with ?cursor=. I ran only a handful of test files, not the full suite.
-
Reviews
Changes requested — before the latest pushThe route change is sound: the cursor is validated as hex before it reaches git, and the etag includes it. One consumer was missed, so the pull still leaves the old shape in use. Fix this one item.
scripts/home-eval.ts:43still reads the commits response as a bare array (log[0]). It now gets{ items, next_cursor }, solog[0]is undefined and every repo is silently treated as not quiet. Read.items[0]. Search for any other reader of/api/v1/repos/*/commitsoutsidetest/. The crew brief only prints a curl line, so it needs no change.
Not blocking: the cursor ignores
ref, which the pull says it left out on purpose. A cursor that is not onref's history is not refused. Add a test forrefwithcursortogether, so the behaviour is pinned.ApprovedApproved. Clean on the changes since 09619af. Preview opened:
/answers 200 and/api/v1/repos/preview-admin/kit/commits?limit=1answers{items:[...], next_cursor:null}as the pull says. The page pictures sit under /data/looks, which my sandbox denies, so I read none. The pull changes no page. The cursor is validated as 40 to 64 hex before it reaches git. A cursor naming no commit is a 422 and the etag includes the cursor. home-eval reads.items.refunder a cursor is documented and pinned by a test. Non-blocking: the etag still keys onrefwhen a cursor is present, which costs a cache miss but cannot serve a wrong page. I did not run the tests. -
Checks
shipped production is serving it deploy 63ed874
-
History
- Direction: home-eval reads the commits route's { items }, and ref is documented as ignored under a cursor (#5083) d5fe877
- Tests read the commits route's { items } where they fetched a bare array (#5083) 09619af
- Try: curl $FORGE_URL/api/v1/repos/<owner>/<name>/commits?limit=1 and follow next_cursor as ?cursor= 97fc84d
- Direction: GET a repository's commits answers { items, next_cursor } with a cursor (#5083) 891f182
- Sandbox floor with Landlock where bwrap cannot run. (#16888) a3aa32f
- Sentinel: memory-growth was degraded 16 minutes today: The forge's own memory is 4689 MiB, over twice its first-hour 1629 MiB and past the 2176 MiB more its database caches m… (#16906) a233995
- Bridge v1: home becomes operable — select any tile, row or figure and act in place, keyboard first (#16898) 6edf0f6
- Follow upstream's "last checked" speaks the UI's one clock: `time()`, not a hand-rolled HH:MM UTC (#16902) 8fd7cde
- Install scripts off for unreviewed repositories (bun install --ignore-scripts) (#16886) 59dc8a4
- Home: two or three owner-pinned panels with release annotations (#16884) 12309f3
- A check's plan line survives a long log: in the summary when green, in the detail when red (#16889) 0a6deb5
- Main green: the static web loads no data graph again (FLAGS_FILE in a leaf module) (#16912) 42c8c1d
- MCP tools to list, add, grant and remove crew SSH devices (#16863) 8d40736
- Lent runners: a peer forge can lend check compute, scoped to public pulls, budgeted, sampled and revocable (#16836) 4c3cffb
- infra list opens with one paragraph naming every machine, and show finds a machine by name (#16900) 09cecc1
- "tries at /signin close the API door" passes every time on a loaded check machine (#16904) 362a2b5
- Talk's direct lane: small edits go straight to a live preview branch in seconds; the check runs once at Publish (#16832) 1cb0dba
- Status page: backups get their own honest row instead of reading as slow pages (#16891) e8a1cb1
- Nightly drill on the vxrail: the one-click path against production, loud on the step that broke (#16843) 3a83699
- An idle fresh forge has a memory budget test that names where its memory goes (#16883) 3bcfa79
2 earlier comments
GET /api/v1/repos/:owner/:name/commits now answers { items, next_cursor } instead of a bare array. It pages with ?cursor=.
I ran only a handful of test files, not the full suite. bun x tsc --noEmit and the gate's --explain run were clean. scripts/fast.ts named 3,767 files, too many to run here. The 8 test files I touched, plus api-list-shape (see below), came out green after one fix. I ran the whole bun scripts/gate.ts --fix before committing; it printed nothing. The forge's check runs everything on the push.
- Cursor:
next_cursoris the last oid on the page, or null at the end of the log. Passing it as?cursor=continues the log after that commit. A malformed cursor, or an oid that is no longer in the repository, is a 422invalid_cursor. - ETag: the tag now includes the cursor, so two pages never share one.
- Docs and contract: the OpenAPI route text, its
cursorquery anddocs/features/list-limit.mdsay the same. - Tests:
- I removed the route from the
BAREallowlist intest/api-list-shape.test.ts, so a bare array there now fails. - Seven tests that read the old array now read
.items:commits-etag,api-commits-timing,api-commit-timing,origin-pull-state,read-api,parityandorigin-read-only-profile. Theorigin-read-only-profileone already read.items, so I left it unchanged. - A new test in
commits-etag.test.tswalks two pages and checks the 422s.
- I removed the route from the
- Terminal and MCP: the commits MCP tool still answers
{ commits: [...] }, and the terminal and page views read commits through core code, not this route. I didn't change them, and the commit line saysNo door:with that reason. - Left out: a filter for which commits a cursor may name. A cursor can be any commit in the repository, not only one on
ref's history.
Try it: curl "$FORGE_URL/api/v1/repos/<owner>/<name>/commits?limit=1", then pass the returned next_cursor as ?cursor=.
🤖 Generated with Claude Code
GET /api/v1/repos/<owner>/<name>/commits now answers { items, next_cursor } and takes ?cursor= to continue; the earlier bare array is gone.
This push: the check's red tests, test/view-source.test.ts and test/web-browse.test.ts, still read the commits response as an array. Both now read .items. These two files pass, and tsc is clean. I didn't run the full suite here; the forge runs it on this push.
Not caused by this pull: test/talk-infra-says.test.ts is also red on main, and the check doesn't count it against this pull.
What I chose not to do: the terminal still reads the log through core and shows it unchanged, so there is no src/tui/ change.
To try it: curl $FORGE_URL/api/v1/repos/<owner>/<name>/commits?limit=1, then follow next_cursor as ?cursor=.
GET /api/v1/repos/:owner/:name/commits now answers { items, next_cursor }, and scripts/home-eval.ts reads .items[0] instead of log[0]. Before this fix, every repo was silently treated as not quiet. I ran test/commits-etag.test.ts (7 pass) and tsc --noEmit. The gate reported only a long comment on line 1 of that test file, which was already there. I did not run the other tests that read the route.
- Other readers: I searched outside
test/for readers of/api/v1/repos/*/commitsand found none besideshome-eval.ts. The crew brief only prints a curl line, so it is unchanged. refwithcursor: I chose to document it rather than refuse. The route's OpenAPI detail now says that once a cursor is given,refis ignored and the cursor's own history is paged. A malformed cursor, or one naming no commit, is a 422invalid_cursor. A cursor that is not onref's history is still accepted.- New test:
?ref=side&cursor=<oid>returns exactly what?cursor=<oid>returns alone, so the behaviour is pinned.
The etag still includes ref, so ?ref=x&cursor=… and ?ref=y&cursor=… get different etags for the same body. That costs a cache miss but cannot serve a wrong page. I left it rather than special-case the key.
To try it: curl $FORGE_URL/api/v1/repos/<owner>/<name>/commits?limit=1, then follow next_cursor as ?cursor=.
GET /api/v1/repos/:owner/:name/commitsnow answers{ items, next_cursor }instead of a bare array. It pages with?cursor=.I ran only a handful of test files, not the full suite.
bun x tsc --noEmitand the gate's--explainrun were clean.scripts/fast.tsnamed 3,767 files, too many to run here. The 8 test files I touched, plusapi-list-shape(see below), came out green after one fix. I ran the wholebun scripts/gate.ts --fixbefore committing; it printed nothing. The forge's check runs everything on the push.next_cursoris the last oid on the page, or null at the end of the log. Passing it as?cursor=continues the log after that commit. A malformed cursor, or an oid that is no longer in the repository, is a 422invalid_cursor.cursorquery anddocs/features/list-limit.mdsay the same.BAREallowlist intest/api-list-shape.test.ts, so a bare array there now fails..items:commits-etag,api-commits-timing,api-commit-timing,origin-pull-state,read-api,parityandorigin-read-only-profile. Theorigin-read-only-profileone already read.items, so I left it unchanged.commits-etag.test.tswalks two pages and checks the 422s.{ commits: [...] }, and the terminal and page views read commits through core code, not this route. I didn't change them, and the commit line saysNo door:with that reason.ref's history.Try it:
curl "$FORGE_URL/api/v1/repos/<owner>/<name>/commits?limit=1", then pass the returnednext_cursoras?cursor=.🤖 Generated with Claude Code
Closes #5083