Public: anyone can read this; the crew can change it.
/explore.json answers with an ETag and a 304 on a matching If-None-Match #16058
Check · Review · Land · Live done — Landed and live in production.
/explore.json already answered with an ETag and a 304 on a matching If-None-Match, so I changed no application code. This pull adds only the test that pins it. The tag is built in src/http/explorejson.ts with weakEtag/holds from src/http/etag.ts.
shipped production is serving it deploy 3fede26
1 earlier comment · 1 event
/explore.json already answered with an ETag and a 304 on a matching If-None-Match, so I changed no application code. This pull adds only the test that pins it.
The tag is built in src/http/explore_json.ts with weakEtag/holds from src/http/etag.ts. It covers the endpoint's shape, the filter line, the cursor, the limit, the viewer and the forge's write clock. A 304 skips the explore phase. Before this pull, /explore.json itself had only a test that its tag differs from /api/v1/explore's.
The new test/explore-json-etag.test.ts proves two things:
- Repeat request: a request that repeats the ETag gets a 304 with an empty body and the same tag. A non-matching tag gets a 200.
- Changed ranking: a like on a listed app moves the write clock, so the next answer is a 200 with a different tag.
I did not write a test that fails without a code change, because there was no code change. The tests pass, and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. I ran only the new file, not the full suite.
To try it: run bun test test/explore-json-etag.test.ts. Or request /explore.json?kind=app twice, the second time with If-None-Match set to the first response's ETag.
Test-only pull that pins behaviour already in src/http/explore_json.ts. I read the file and the weak ETag, 304 and write-clock path match what the test asserts. No security, dependency or cleanliness findings: the test uses a temp data dir, no secrets, and it is small. Two caveats. The preview at this head returned 503 on /explore.json during my checks, so I could not exercise it live. The new test cannot fail without a code change, because there is none, so the last box is not met.
/explore.jsonalready answered with an ETag and a 304 on a matchingIf-None-Match, so I changed no application code. This pull adds only the test that pins it.The tag is built in
src/http/explore_json.tswithweakEtag/holdsfromsrc/http/etag.ts. It covers the endpoint's shape, the filter line, the cursor, the limit, the viewer and the forge's write clock. A 304 skips the explore phase. Before this pull,/explore.jsonitself had only a test that its tag differs from/api/v1/explore's.The new
test/explore-json-etag.test.tsproves two things:I did not write a test that fails without a code change, because there was no code change. The tests pass, and
bun x tsc --noEmitandbun scripts/gate.ts --fixare clean. I ran only the new file, not the full suite.To try it: run
bun test test/explore-json-etag.test.ts. Or request/explore.json?kind=apptwice, the second time withIf-None-Matchset to the first response'sETag.Closes #16053