From dbb77efab13f7139b799dd80de8c58cffd99c7c0 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 00:48:46 +0100 Subject: [PATCH] Node-engine: only an image the mesh built is a part of a want (A-454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A container's image counts as fetched for the parts check only when the composition names the seat it came through; an upstream image its manifest pins by digest is no part and is never 'fetched and not in the want's parts'. Builds: design 47 G A-454 (ยง421's parts check, A-432) --- internal/agent/agent_test.go | 10 +++++++++- internal/agent/parts.go | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index 9ad87282..548ddff4 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -363,10 +363,18 @@ func TestAWantAndItsCompositionApplyTheModuleAndTheHaveNamesBoth(t *testing.T) { } } // A container's digest is the one after its image's @. - container := json.RawMessage(`{"id":"web.c","type":"container","name":"web-c","image":"store/web@` + d3 + `","module":"web"}`) + container := json.RawMessage(`{"id":"web.c","type":"container","name":"web-c","image":"store/web@` + d3 + `","image-seat":"mesh-artifact-store","image-holder":"n1","module":"web"}`) if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container}); got != "" { t.Fatalf("a container whose digest is in the parts differs: %q", got) } + // A-454: an image the manifest pins from outside, by its digest, is no part of the want's parts, and a mesh-built one still is. + upstream := json.RawMessage(`{"id":"web.u","type":"container","name":"web-u","image":"registry@` + d2 + `","module":"web"}`) + if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container, upstream}); got != "" { + t.Fatalf("an upstream image pinned by its digest is a part: %q", got) + } + if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{upstream}); !strings.Contains(got, "in the want's parts and not fetched: "+d3) || strings.Contains(got, d2) { + t.Fatalf("with only an upstream image the mesh-built one is not missing, or the upstream one is named: %q", got) + } // A-432: a runtime of its own runs the tool runner's program, which the module's parts do not name. ownRuntime := json.RawMessage(`{"id":"web.own-runtime","type":"process","name":"web-runtime","source":"store/node-tools","digest":"` + d1 + `","run":["./node-tools"],"module":"web"}`) if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container, ownRuntime}); got != "" { diff --git a/internal/agent/parts.go b/internal/agent/parts.go index 1da96058..f5f0482c 100644 --- a/internal/agent/parts.go +++ b/internal/agent/parts.go @@ -69,6 +69,11 @@ func partsDifference(parts map[string]string, resources []json.RawMessage) strin fetched[res.Digest] = true } case *declaration.Container: + // Only an image the mesh built is a part: the composition names the seat it came through (the artifact store or a + // registry seat) beside it. An image the manifest pins from outside, by its digest, is no part (design 47 G A-454). + if res.ImageSeat == "" { + continue + } if strings.HasPrefix(res.Image, "sha256:") { fetched[res.Image] = true } else if _, digest, ok := strings.Cut(res.Image, "@"); ok {