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

GET /api/v1/repos/:owner/:name/commits carries an ETag and answers a repeat with 304 until the ref it reads moves #9162

shipped production is serving it opened this has it
opened this

An agent polling a branch's history gets a 304 while the branch tip has not moved, instead of re-reading the log — as the issues and pulls reads already do.

Done looks like:

  • [x] GET /api/v1/repos/:owner/:name/commits (src/http/api.ts) answers 200 with a weak etag from weakEtag in src/http/etag.ts, cache-control: private, no-cache and vary: authorization, cookie.
  • [x] A repeat with that etag in If-None-Match is a 304 with the same headers, no body, and the securityFloor headers.
  • [x] Pushing a commit to the ref read makes the old etag miss; a push to another branch does not; a different ref or limit gets a different etag.
  • [x] A bad_ref 422 and a 404 carry no ETag.
  • [x] test/commits-etag.test.ts covers each of the above and fails without the change.

Files: src/http/api.ts, test/commits-etag.test.ts. Risks: keep the response body exactly as it is today (a bare array); MCP and the CLI read it.

commented

Reviewed pull #9167 at its head: ticked GET /api/v1/repos/:owner/:name/commits (src/http/api.ts) answers 200 with a weak etag from weakEtag in src/http/etag.ts, cache-control: private, no-cache and vary: authorization, cookie.; A repeat with that etag in If-None-Match is a 304 with the same headers, no body, and the securityFloor headers.; Pushing a commit to the ref read makes the old etag miss; a push to another branch does not; a different ref or limit gets a different etag.; A bad_ref 422 and a 404 carry no ETag.; test/commits-etag.test.ts covers each of the above and fails without the change..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs