Skip to content

core: serve a checksummed http file from its snapshot without revalidating - #15033

Open
yasyf wants to merge 1 commit into
dagger:mainfrom
yasyf:http-checksum-snapshot
Open

yasyf wants to merge 1 commit into
dagger:mainfrom
yasyf:http-checksum-snapshot

Conversation

@yasyf

@yasyf yasyf commented Nov 2, 2026

Copy link
Copy Markdown

Serve an http() file from the state's snapshot without a request when the caller's checksum matches the snapshot's content digest.

HTTPState.Resolve revalidated with If-None-Match or If-Modified-Since in every session, checksum or not. With a checksum, a 304 can only confirm bytes the engine already holds, and any other answer from the origin failed the call. #15032 has the details.

The new test fetches a URL that answers differently on each request (count: 1, then count: 2), with the checksum of the first answer, in two sessions. Before this change the second session fetched count: 2 and failed with a checksum mismatch; now it returns count: 1 without a request.

Measured on one engine, with the origin's addresses blocked after a warm run, our CI's image checks, which fetch their GitHub release assets with checksums:

Before After
Warm run, origin unreachable fails, connection refused passes, no request

Fixes #15032.

…ating

HTTPState.Resolve sent a conditional GET to the origin in every session,
even when the caller passed a checksum and the state's snapshot already
held content with that digest. The checksum pins the bytes, so the
request could only confirm what the engine had. When the origin returned
an error, the call failed even though the file was already on disk.

Return the snapshot when its digest matches the checksum, and fetch only
when it doesn't.

Signed-off-by: Yasyf Mohamedali <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http() with a checksum revalidates against the origin every session, and fails when the origin errors

1 participant