MH-2b: the node-engine reads the want by the real contract: composed, kept-on and newest go

A want carries no composed digest, no keeping node and no newest build (design 47 H 750,
H-A-37): the agent takes the digest from the composition the node made for the want's
build, the shadow's resolution around a missing entry (A-405) and KeptBuildOf's keeping node
go, and the artifact is fetched from the store. Tests of the removed behaviour go.

Builds: design 47 H §750; H-A-37

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-20 03:09:22 +01:00
parent ee017fe306
commit dd2b3a16df
14 changed files with 43 additions and 165 deletions
-30
View File
@@ -3,41 +3,11 @@ package selfcompose
import (
"context"
"slices"
"strings"
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
// The node that keeps a kept build is the want's kept-on alone, for an artifact its parts name (design 47 G 526, A-50).
func TestTheKeepingNodeIsTheWantsKeptOn(t *testing.T) {
kd := strings.Repeat("6", 64)
for _, row := range []struct {
name, digest string
want *meshwants.WantsByWantNodeModuleValue
node string
kept bool
}{
{"kept, by its bare digest", kd, &meshwants.WantsByWantNodeModuleValue{Fp: "f1", KeptOn: "n3", Version: "1"}, "n3", true},
{"kept, by the declared digest", "sha256:" + kd, &meshwants.WantsByWantNodeModuleValue{Fp: "f1", KeptOn: "n3", Version: "1"}, "n3", true},
{"a digest the resolved version does not name", "sha256:" + strings.Repeat("7", 64), &meshwants.WantsByWantNodeModuleValue{Fp: "f1", KeptOn: "n3", Version: "1"}, "", false},
{"a want naming no keeping node", kd, &meshwants.WantsByWantNodeModuleValue{Fp: "f1", Version: "1"}, "", false},
{"no want of the module", kd, nil, "", false},
} {
c := &Composer{wants: map[string]meshwants.WantsByWantNodeModuleValue{}}
if row.want != nil {
c.wants["db"] = *row.want
// The digests the want's version resolves to through the registry seats (design 47 H §750).
c.resolved = map[resolvedKey]versionParts{{"db", "f1", "1"}: {parts: map[string]string{"db:p": "sha256:" + kd}}}
}
node, fp, kept, err := c.KeptBuildOf(context.Background(), "db", row.digest)
if err != nil || node != row.node || kept != row.kept || (kept && fp != "f1") {
t.Errorf("%s: node %q fp %q kept %v err %v", row.name, node, fp, kept, err)
}
}
}
// Design 47 G §558, A-275: a manifest's `invokes` in its long form {verb, fields} is read for its seat, and one of a form that
// cannot be read is refused, never read as no seats.
func TestSeatsOfReadsALongFormInvokeAndRefusesAnUnreadableOne(t *testing.T) {