Public: anyone can read this; the crew can change it.
GET /api/v1/repos/:owner/:name/pulls carries an ETag and answers a repeat with 304 when the list it would send has not changed #9118
commented
Reviewed pull #9121 at its head: ticked The 200 carries a weak etag computed from the exact JSON it sends (each state, limit, cursor and fields tags its own page), cache-control: private, no-cache and vary: authorization, cookie.; A repeat with a matching If-None-Match answers 304 with no body and the same etag; once a pull's check verdict or head changes the tag changes and the answer is 200.; A test in test/ asks twice for 200 then 304, pushes to (or records a check on) a pull, and gets 200 with a new tag.; The route's OpenAPI description names the etag header and the 304..
Sign in to join this conversation.
Intent: an agent that polls a repository's open pulls gets an empty 304 until a pull in that page is opened, pushed to, checked, merged or closed, instead of the whole page every time.
Today the route in
src/http/api.ts(~line 2318) answers with noetag.src/http/etag.tsalready hasweakEtagandholds;src/http/api/forges.tsshows the pattern.Done looks like:
etagcomputed from the exact JSON it sends (eachstate,limit,cursorandfieldstags its own page),cache-control: private, no-cacheandvary: authorization, cookie.If-None-Matchanswers 304 with no body and the sameetag; once a pull's check verdict or head changes the tag changes and the answer is 200.test/asks twice for 200 then 304, pushes to (or records a check on) a pull, and gets 200 with a new tag.etagheader and the 304.Files:
src/http/api.ts(or a newsrc/http/api/pulls.tsif the route moves out, keeping its shape), its OpenAPI route file, one test. Risk: the list carries live check state; the tag must come from the body sent, never from a cached timestamp, so a new verdict is never hidden behind a 304.