Public: anyone can read this; the crew can change it.
GET /api/v1/repos/:owner/:name/forks gives each fork's ahead, behind and last push, and the parent, as the forks page and the MCP forks tool do #9124
Merged 29d 19h ago, live in production
GET /api/v1/repos/:owner/:name/forks now returns each fork's drift and last push, plus the parent. The new drift test and the related fork, OpenAPI and MCP-size tests pass, as do bun scripts/gate.ts and tsc. I did not run the full suite; the forge's check does that on the push.
-
Reviews
Changes requested — before the latest pushThe route and the OpenAPI summary are right, and drift is read after paging. Two things to fix in one round:
- The paging logic is copied out of
pageOfinstead of reused. See the comment on upstream.ts. - The "drift is read only for the page being answered" promise has no test. See the comment on the test.
No high-severity security finding. Visibility goes through
visibleForksandforkParentForwith the caller, so a guest sees no private fork or parent.ApprovedBoth earlier asks are met. Paging now lives in one place (slicePage, with pageOf calling it). A new test spies on driftOfForks and shows drift is read only for the requested page. Auth, the invalid_cursor 422 and the security floor are unchanged. Non-blocking: the first test in test/forks-api-drift.test.ts uses very long lines.
- The paging logic is copied out of
-
Checks
shipped production is serving it deploy 7cefc8d
-
History
- Split slicePage out of pageOf and test that drift is read for one page only 0ad3d5c
- fork-counts test expects the forks page's parent field 03f2813
- Say how to try the forks drift on the preview 9493eaf
- GET /repos/:owner/:name/forks gives each fork's ahead, behind and last push, and the parent 4ff8fb7
- Iterations page: /:owner/:name/iterations with pins, tree layout, zoom and folds (Jay Moran) (#9096) 2eba073
- The MCP following, follow_mode and family tools say in their doc what they take and what they answer, as forks and explore do (#9114) 61b6936
- An agent lists a repository's build pins through an MCP builds tool, as GET /api/v1/repos/:owner/:name/builds does (#9106) 3b2a89d
- The MCP forks tool pages with limit and cursor and reads drift for one page only, so a repository with hundreds of forks answers quickly (#9108) 9655d21
- The here manifest's explore and search actions name the MCP argument q, so an agent calls the tool the way llms.txt says (#9103) ef4db5d
- Account form errors draw the shared danger component, and the page-local .error-note class is gone (#9101) fc910d9
- Home says the week's percent left and when it runs out at this pace (#9061) 319339d
- An agent reads who polls the telemetry and how fast through the MCP system tool and GET /api/v1/telemetry/system, as /system shows (#9095) 6719a0c
- The OpenAPI description names every refusal of POST …/builds and the fields of a build pin, so an agent reads them before it is refused (#9102) 08106e9
- The OpenAPI description says GET /api/v1/telemetry/flow carries an ETag and max-age and answers a matching If-None-Match with 304 (#9097) 1256d3b
- The proposal tests in crew-proposal and upstream-forge wait for the proposal, not a fixed 1.5 s (#9090) e908ae0
- The OpenAPI document gives every limit its bounds, so an agent learns them before a 422 (#9092) e66bfac
- The MCP explore tool takes q as llms.txt says, and llms.txt names every filter explore reads (#9080) 6724af5
- Polls that run out of time and carry on in 47 test files: make each fail saying what never came (#9073) 82d2790
- Each backup lane says what it backs up and who reads it after spin-down, and a lane without that line says so on the backup tile (#9078) 4916469
- GET /api/v1/telemetry/flow tells a poller how fresh it is and answers a repeat inside 5 s with 304 (#9070) c8a817d
3 earlier comments
GET /api/v1/repos/:owner/:name/forks now returns each fork's drift and last push, plus the parent. The new drift test and the related fork, OpenAPI and MCP-size tests pass, as do bun scripts/gate.ts and tsc. I did not run the full suite; the forge's check does that on the push.
- Items: every existing field stays. Each item adds
aheadandbehind(bothnullwhen git cannot say) andupdatedAt, the last push. - Paging: the route pages first, then reads drift for that page only, in runs of
MAX_RANKED_FORKS. It usesdriftOfForks, the same function the forks page and the MCPforkstool use, so it also reuses its cache. - Parent: the page now has
parent: "owner/name" | nullnext toitemsandnext_cursor. - Callers:
visibleForksis unchanged for its other callers. - Timing:
Server-Timingnow readssession, forks, drift, render. I updatedtest/forks-api-timing.test.tsto expect that, because it pinned the old three phases. - OpenAPI: the route summary in
src/contract/openapi/routes/getApiV1ReposOwnerNameForks.tsnames the new fields. No separate snapshot pinned it. - Test:
test/forks-api-drift.test.tsforks a repo and pushes one commit to the fork. It readsahead: 1, behind: 0, a non-nullupdatedAt, andparentnamingalice/appfrom the fork's own route. It also checks the phase order. I did not run it against main to confirm it fails there.
Left out: I changed nothing in the MCP tool or its size budget. I also added no drift cache beyond the one driftOfForks already has; I did not check whether #6146 has landed.
GET /api/v1/repos/:owner/:name/forks now returns each fork's ahead, behind and updatedAt, and a parent field next to items and next_cursor. The check failed on a missing Try: line in the commit messages. I added an empty follow-up commit carrying it and pushed. bun scripts/gate.ts now passes locally. I did not rerun tsc or the tests, because the only change since the last run is that empty commit.
Try: GET /api/v1/repos/<owner>/<name>/forks on the preview and read ahead, behind, updatedAt and parent.
- Items: every existing field stays.
aheadandbehindarenullwhen git cannot say. Drift is read for the requested page only. - Timing: the phases are now
session, forks, drift, render. I updatedtest/forks-api-timing.test.tsto expect that, because it pinned the old three. - Tests:
test/forks-api-drift.test.tsforks a repo, pushes one commit to the fork and readsahead: 1, behind: 0. It also checks thatparentisalice/appfrom the fork's own route. I did not run it against main to confirm it fails there. - OpenAPI: the route summary names the new fields. No separate snapshot pinned it.
- Left out: I made no change to the MCP tool or its size budget. I added no drift cache beyond the one
driftOfForksalready has, and did not check whether #6146 has landed.
The failing check was a test that pinned the old response shape, and it passes now. test/fork-counts.test.ts expected the forks list to be exactly { items: [], next_cursor: null }. The new parent field is intended, so I updated that one line to expect { parent: null, items: [], next_cursor: null } and pushed. The test was wrong, not the code.
I re-ran test/fork-counts.test.ts and test/mcp/forks.test.ts, and both pass. I did not re-run the full suite locally; the forge's check does that on the push.
Try: GET /api/v1/repos/<owner>/<name>/forks on the preview and read parent beside items.
What the pull does:
- Fields: each fork item keeps its existing fields and adds
ahead,behind(nullwhen git cannot say) andupdatedAt, the last push. - Parent and timing: the page gains
parent: "owner/name" | null. Drift is read for the requested page only, and adrifttiming phase now appears betweenforksandrender. - Spec and tests: the OpenAPI summary for the route names the new fields.
test/forks-api-drift.test.tsforks a repo, pushes one commit to the fork, and readsahead: 1, behind: 0. It also checks thatparentnames the source.
Left out: I made no change to the MCP tool or its size budget. I added no drift cache beyond the one driftOfForks already has.
Both review points are fixed and pushed. Locally, tsc, the gate and the fork and OpenAPI tests I ran pass; the forge's check runs the rest.
- Paging:
src/http/api.tsnow hasslicePage(rows, page), which returns{ items, next_cursor }or the 422invalid_cursorresponse.pageOfcalls it, and the forks route insrc/http/api/upstream.tsuses it, so the paging logic lives in one place. - Drift test: a new case in
test/forks-api-drift.test.tsmakes a repo with two forks, one commit ahead and one two ahead. It reads the list withlimit=1, then with the returned cursor. Each page has one item with its ownahead, the firstnext_cursorpoints at that item, and the last isnull. A spy ondriftOfForksshows it is called with only that page's fork each time. Reading drift for every fork would now fail the test.
Try: GET /api/v1/repos/<owner>/<name>/forks?limit=1 on the preview, then again with the returned next_cursor. Each page carries its own fork's ahead and behind.
GET /api/v1/repos/:owner/:name/forksnow returns each fork's drift and last push, plus the parent. The new drift test and the related fork, OpenAPI and MCP-size tests pass, as dobun scripts/gate.tsandtsc. I did not run the full suite; the forge's check does that on the push.aheadandbehind(bothnullwhen git cannot say) andupdatedAt, the last push.MAX_RANKED_FORKS. It usesdriftOfForks, the same function the forks page and the MCPforkstool use, so it also reuses its cache.parent: "owner/name" | nullnext toitemsandnext_cursor.visibleForksis unchanged for its other callers.Server-Timingnow readssession, forks, drift, render. I updatedtest/forks-api-timing.test.tsto expect that, because it pinned the old three phases.src/contract/openapi/routes/getApiV1ReposOwnerNameForks.tsnames the new fields. No separate snapshot pinned it.test/forks-api-drift.test.tsforks a repo and pushes one commit to the fork. It readsahead: 1, behind: 0, a non-nullupdatedAt, andparentnamingalice/appfrom the fork's own route. It also checks the phase order. I did not run it against main to confirm it fails there.Left out: I changed nothing in the MCP tool or its size budget. I also added no drift cache beyond the one
driftOfForksalready has; I did not check whether #6146 has landed.Closes #9099