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 #9099

shipped production is serving it opened this has it
opened this

Intent: an agent or script that reads the fork list over HTTP sees how far each fork has drifted, the same way a person on /:owner/:name/forks and an MCP caller of forks already do.

Today the route in src/http/api/upstream.ts (~line 74) pages raw visibleForks rows. The web page (src/web/pages/repo.ts, driftWords) and src/http/mcp/tools/forks.ts both read driftOfForks (src/actions/forks.ts) and show ahead/behind, and the MCP tool also names the parent.

Done when:

  • [x] Each item keeps every field it has today and adds ahead, behind (each null when git cannot say) and updatedAt (the last push). Drift is read only for the page being answered, not for every fork.
  • [x] The page carries parent: "owner/name" | null next to items and next_cursor.
  • [x] The OpenAPI description of this route names the new fields, and any contract snapshot that pins it is updated in the same pull.
  • [x] A test forks a repo, pushes one commit to the fork and reads the route: ahead: 1, behind: 0, and parent names the source. It fails on main. The timing phases (forks, render) still show up, plus a drift phase.

Files: src/http/api/upstream.ts, the OpenAPI spec module, a test under test/ (fork drift over HTTP). Risks: drift costs a git call per fork. Keep it to one page, and reuse the cache from #6146 if that has landed. Do not change what visibleForks returns to its other callers. Fits: a builder (torque/mason).

commented

Reviewed pull #9124 at its head: ticked Each item keeps every field it has today and adds ahead, behind (each null when git cannot say) and updatedAt (the last push). Drift is read only for the page being answered, not for every fork.; The page carries parent: "owner/name" | null next to items and next_cursor.; The OpenAPI description of this route names the new fields, and any contract snapshot that pins it is updated in the same pull.; A test forks a repo, pushes one commit to the fork and reads the route: ahead: 1, behind: 0, and parent names the source. It fails on main. The timing phases (forks, render) still show up, plus a drift phase..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs