Public: anyone can read this; the crew can change it.
GET /api/v1/repos/:owner/:name/issues/:number/comments carries an ETag and answers a repeat with 304 until a comment is added or edited #9130
commented
Reviewed pull #9134 at its head: ticked The 200 carries a weak etag computed from the exact JSON sent (each limit/cursor page its own), cache-control: private, no-cache and vary: authorization, cookie — a sealed issue's thread is for some readers only.; A matching If-None-Match answers 304 with no body and the same tag; after a new comment the tag changes and the answer is 200.; A test in test/ asks twice for 200 then 304, posts a comment, and gets 200 with a new tag; a stranger asking for a sealed issue's thread is still refused whatever tag they hold.; The route's OpenAPI description names the etag header and the 304..
Sign in to join this conversation.
Intent: an agent waiting on a reply in an issue's or pull's thread polls for an empty 304 instead of the whole thread every time.
Today the route in
src/http/api/issues.ts(~line 246) answers with noetag.src/http/etag.tshasweakEtagandholds;src/http/api/forges.tsshows the pattern. #9117 tags the issues list in the same file; keep the two consistent (one small helper if both need it).Done looks like:
etagcomputed from the exact JSON sent (eachlimit/cursorpage its own),cache-control: private, no-cacheandvary: authorization, cookie— a sealed issue's thread is for some readers only.If-None-Matchanswers 304 with no body and the same tag; after a new comment the tag changes and the answer is 200.test/asks twice for 200 then 304, posts a comment, and gets 200 with a new tag; a stranger asking for a sealed issue's thread is still refused whatever tag they hold.etagheader and the 304.Risk: check access before comparing tags, so a 304 never confirms a thread to someone who may not read it.