agent: the parts check counts the templates archives a composition was rendered from as fetched (A-481, A-481a)

compose fills Composed.Templates from the resolved manifest's TemplatesDigest; partsDifference adds them to the digests fetched.

Builds: design 47 G A-481, A-481a
This commit is contained in:
2026-11-17 23:44:15 +01:00
parent 179a4a6402
commit 87cfae48b2
7 changed files with 45 additions and 11 deletions
+10
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
engcomp "github.com/novox/mesh-host/internal/compositions"
"slices"
"sort"
"strings"
"testing"
@@ -32,10 +33,19 @@ func TestCompositionsAreTheDeclarationSplitByModule(t *testing.T) {
sort.Strings(want)
fps := map[string]string{"mesh-wireguard": fpFor('a'), "files": fpFor('b')}
// A-481a: the composition names the digest of the templates archive its module was rendered from.
templated := in.Catalogue["files"]
templated.TemplatesDigest = "sha256:" + strings.Repeat("e", 64)
in.Catalogue["files"] = templated
out, skipped, err := Compositions(in, "laptop", fps, Foreseeing)
if err != nil || len(skipped) != 0 {
t.Fatalf("Compositions = %v, skipped %v", err, skipped)
}
for _, c := range out {
if want := map[string][]string{"files": {templated.TemplatesDigest}}[c.Module]; !slices.Equal(c.Templates, want) {
t.Errorf("%s names the templates %v, want %v", c.Module, c.Templates, want)
}
}
var got []string
for key, c := range out {
node, module, fp, isNode, err := engcomp.ParseKey(key)