Skip to content

feat(cache): use HTTP 404 for remote cache fetch misses - #772

Merged
wan9chi merged 3 commits into
mainfrom
remote-cache-fetch-404
Sep 28, 2026
Merged

wan9chi merged 3 commits into
mainfrom
remote-cache-fetch-404

Conversation

@wan9chi

@wan9chi wan9chi commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Motivation

The public cache service (#718) follows its RFC and answers a fetch that matches neither key with HTTP 404 and a plain-text body. It never sends kind: "not_found". The client and the Node test backend still used a 200 response with kind: "not_found", so a miss meant different things depending on the server. This switches both to 404 and drops the not_found kind, giving the client and both servers one miss contract.

Changes

  • vt_remote_cache: Client::fetch returns Result<Option<Fetched>, Error>, with None for a 404 response. Fetched only describes the body of a 200 response, so its NotFound variant is removed. A 200 response with kind: "not_found" is now a malformed response. Every other non-200 status is still an error, and a 404 download still fails.
  • Test backend (packages/tools): a fetch miss gets a 404 with the body Not found, logged as POST /fetch 404.
  • The remote cache e2e snapshots change only in those backend lines and responses. The vp run output is unchanged.

A fetch that matches neither key is now answered with HTTP 404, and the
`not_found` kind is no longer part of the fetch response. The client
returns `Fetched::NotFound` for a 404 and rejects a 200 response with
`kind: "not_found"` as malformed. The test backend answers misses with a
plain-text 404, as the public cache service does.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@wan9chi
wan9chi force-pushed the remote-cache-fetch-404 branch from d03708b to 47880c1 Compare September 27, 2026 17:05
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  -0.06%  [ -8.32% ..  +7.09%]  overhead  +267.01%
dynamic/access             change  +0.31%  [ -0.76% ..  +1.28%]  overhead   +11.92%
dynamic/access-relative    change  +0.11%  [ -1.57% ..  +1.14%]  overhead   +58.39%
dynamic/access-contended   change  -0.48%  [ -3.49% ..  +1.28%]  overhead   +13.79%
static/launch              change  +0.36%  [ -4.42% ..  +6.04%]  overhead  +736.12%
static/access              change  +0.20%  [ -0.87% ..  +1.47%]  overhead  +818.81%
static/access-relative     change  +0.09%  [ -0.72% ..  +0.91%]  overhead +1405.75%
static/access-contended    change  +0.17%  [ -0.33% ..  +0.68%]  overhead +3207.93%

macos

dynamic/launch             change  -0.58%  [ -2.98% ..  +2.38%]  overhead  +214.35%
dynamic/access             change  -0.69%  [ -3.44% ..  +2.15%]  overhead    +1.46%
dynamic/access-relative    change  +0.29%  [ -1.33% ..  +1.75%]  overhead  +273.03%
dynamic/access-contended   change  +1.26%  [ -2.39% .. +16.92%]  overhead    +2.35%

windows

dynamic/launch             change  -0.37%  [ -4.22% ..  +4.93%]  overhead   +24.19%
dynamic/access             change  +0.00%  [ -1.45% ..  +1.13%]  overhead    +1.32%
dynamic/access-relative    change  -0.18%  [ -1.97% ..  +1.48%]  overhead    +1.50%
dynamic/access-contended   change  -0.76%  [-13.87% ..  +4.25%]  overhead    +2.88%

@wan9chi
wan9chi added this pull request to stack #773 September 27, 2026 17:16
wan9chi and others added 2 commits September 28, 2026 10:40
`Client::fetch` now returns `Result<Option<Fetched>, Error>`, with `None`
for a 404 response, instead of a `Fetched::NotFound` variant. `Fetched`
now only describes the body of a 200 response, so it no longer needs a
variant that no body decodes into.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@wan9chi
wan9chi merged commit c7e7635 into main Sep 28, 2026
19 checks passed
@wan9chi
wan9chi deleted the remote-cache-fetch-404 branch September 28, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant