fix(sandbox): don't misreport attestation images as missing in local preflight - #580
Open
yzxcj797 wants to merge 1 commit into
Open
fix(sandbox): don't misreport attestation images as missing in local preflight#580yzxcj797 wants to merge 1 commit into
yzxcj797 wants to merge 1 commit into
Conversation
…preflight
The local-sandbox preflight ran docker image inspect with a combined
{{.Id}} {{if .Config.Labels}}...{{end}} template. Images built by buildx
with attestations -- the Docker 29 default, and what qm sandbox publish
emits -- inspect as an OCI index whose Config has no Labels key, so the
template errors and exits non-zero, and preflight rejected present,
usable images as 'not found -- run npm run sandbox:local:build' (yc-software#577).
Split the probe: {{.Id}} decides existence (valid for index and manifest
images alike), and the fingerprint template becomes a second, tolerated
probe -- its failure means no fingerprint, which skips the stale-image
comparison instead of failing the run.
The fake docker gains the exact attestation behavior, and the regression
test asserts provision no longer rejects with the not-found signature
(fails on main with precisely that misreport).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the preflight bug reported in part 2 of #577 (scoped to that; part 1 is a published-artifacts question for maintainers).
The bug
The local-sandbox preflight ran one probe:
Images built by buildx with attestations — the Docker 29 default, and exactly what
qm sandbox publishemits — inspect as an OCI index whoseConfighas noLabelskey. The Go template then fails:That exits non-zero, so preflight rejected a present, usable image as
local sandbox image <image> not found — run npm run sandbox:local:build— a wrong error that points at rebuilding (the reporter rebuilt twice before checking the exit path itself).Fix
Split the probe in two:
docker image inspect -f '{{.Id}}' <image>decides existence — valid for index and manifest images alike.Fingerprint-labeled images behave exactly as before, including the stale warning.
Tests
test/support/fake-docker.tsgains the exact attestation behavior:{{.Id}}inspects fine, the labels template fails with the realmap has no entry for key "Labels"error.test/local-sandbox.test.tsasserts provision no longer rejects with the not-found signature. Verified locally: fails onmainwith precisely that misreport ("image was misreported as missing"), passes with the fix.Note: 12 pre-existing tests in this file already fail on Windows checkouts (they exercise the real
agent.mjsdaemon's/exec, which needs a POSIX shell) — same count before and after this change; CI on Linux runs them green.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.