From cc79528accbfd0ba3a65a4654c254faaef79bfc9 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 04:38:46 +0100 Subject: [PATCH] Prove the take-in skips a done key's package (H-A-466, review finding) The take-in's two package skips (the wait for a reference and Built) were proved by no test: the test's take-in only got the build buildOf makes, which carries no package. The builder's done key frombus hands over does carry the package with no reference; the package row now takes in such a key and checks Built gives no package. Without the first skip the key is refused waiting for the package's reference; without the second Built holds it. Builds: design 47 H2 H-A-466 --- internal/selfcompose/versions_test.go | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/internal/selfcompose/versions_test.go b/internal/selfcompose/versions_test.go index 0b4624f8..68084554 100644 --- a/internal/selfcompose/versions_test.go +++ b/internal/selfcompose/versions_test.go @@ -16,6 +16,8 @@ import ( "github.com/novox/mesh-host/internal/nodegrant" "github.com/novox/mesh-host/internal/takein" + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" + "git.novox.be/novox/mesh-sdk/go/catalogue" "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner" @@ -62,6 +64,9 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) { parts map[string]string missing string // a word the reason holds said []string + // pkg names a package artifact the builder's done key carries with no reference beside what the build made: the key + // frombus hands takein.Manifest (H-A-466). + pkg string }{ "resolved": {want: meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: "1.2.3", Self: true}, parts: map[string]string{"mail:server": d("9"), "mail:files": d("1"), "mail:web": d("3")}}, @@ -70,7 +75,7 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) { "a seat that does not answer": {want: meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: "1.2.3", Self: true}, down: "container-image-registry", missing: "mail:web", said: []string{"mail at version 1.2.3: the seat container-image-registry"}}, "a package artifact": {want: meshwants.WantsByWantNodeModuleValue{Fp: fpPkg, Version: "1.2.3", Self: true}, entry: &withPackage, - parts: map[string]string{"mail:tools": d("4")}}, + parts: map[string]string{"mail:tools": d("4")}, pkg: "mailapi"}, } { var mu sync.Mutex var said []string @@ -139,6 +144,25 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) { if _, err := takein.Manifest(context.Background(), m, *b, nil); err != nil { t.Errorf("%s: the take-in refused the build: %v", name, err) } + if row.pkg != "" { + // The builder's done key carries the package, published to its registry, with no reference: the take-in waits + // for no reference of it, and what it takes in holds no package. + key := *b + key.Artifacts = append(append([]builds.BuiltArtifact(nil), b.Artifacts...), + builds.BuiltArtifact{Name: row.pkg, Kind: catalogue.ArtifactPackage, Digest: d("5")}) + if _, err := takein.Manifest(context.Background(), m, key, nil); err != nil { + t.Errorf("%s: the take-in refused the done key carrying a package: %v", name, err) + } + built, err := takein.Built(context.Background(), m, key.Artifacts, nil) + if err != nil || len(built) != len(b.Artifacts) { + t.Errorf("%s: built %+v, %v: want the build's artifacts alone", name, built, err) + } + for _, a := range built { + if a.Name == row.pkg || a.Kind == catalogue.ArtifactPackage { + t.Errorf("%s: the take-in holds the package %+v", name, a) + } + } + } for _, a := range b.Artifacts { if a.Digest != row.parts["mail:"+a.Name] || a.Reference != referenceOf("mail", a.Name, a.Digest) { t.Errorf("%s: artifact %+v", name, a)