Node-engine: an upstream copy served through the registry seat is no part of a want (A-454)

Builds: design 47 G A-454
This commit is contained in:
2026-11-17 00:49:44 +01:00
parent dbb77efab1
commit 0a43489a74
2 changed files with 18 additions and 1 deletions
+5
View File
@@ -372,6 +372,11 @@ func TestAWantAndItsCompositionApplyTheModuleAndTheHaveNamesBoth(t *testing.T) {
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)
}
// And neither is the registry seat's copy of an upstream image, though it is routed through the seat.
mirrored := json.RawMessage(`{"id":"web.m","type":"container","name":"web-m","image":"store:5000/upstream/docker.io/library/registry@` + d1 + `","image-seat":"container-image-registry","image-holder":"n1","module":"web"}`)
if got := partsDifference(map[string]string{"web:c": d3}, []json.RawMessage{container, mirrored}); got != "" {
t.Fatalf("an upstream copy served through the registry seat 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)
}
+13 -1
View File
@@ -6,6 +6,7 @@ import (
"sort"
"strings"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/containerimageregistryclient/reference"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/declaration"
)
@@ -43,6 +44,17 @@ func heldForEntry(why string) bool {
return strings.HasPrefix(why, EntryAsked) || strings.HasPrefix(why, EntryMissing)
}
// upstreamCopy is whether a routed image is the registry seat's copy of an upstream image, `<address>/upstream/<host>/<image>@<digest>`:
// the mesh mirrors it, but it built nothing, so it is no part of a want (design 47 G A-454).
func upstreamCopy(image string) bool {
_, path, ok := strings.Cut(image, "/")
if !ok {
return false
}
_, _, upstream := reference.InUpstream(path)
return upstream
}
// partsDifference checks a want's `parts` against the digests of the archive, process and container resources of the
// composition, which are the digests the apply fetches and checks (design 47 G section 524). A want with no `parts` (an
// assigner of before G, or a node whose record does not state `want-parts`) is applied as today: it returns "". With
@@ -71,7 +83,7 @@ func partsDifference(parts map[string]string, resources []json.RawMessage) strin
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 == "" {
if res.ImageSeat == "" || upstreamCopy(res.Image) {
continue
}
if strings.HasPrefix(res.Image, "sha256:") {