MH-2: a want is read by its version alone; the parts check and parts-differ go

The node-engine no longer reads a want's parts: the parts check (G 524) and its hold
parts-differ are removed, the digests of a build are resolved through the registry
seats from the want's version, and a candidate's added module is resolved from its
version alone.

Builds: design 47 H §750, §764; H-A-37, H-A-38

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-20 02:31:13 +01:00
parent 3e17fc939d
commit ea25a8389d
10 changed files with 63 additions and 236 deletions
+21 -4
View File
@@ -437,6 +437,15 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
var refusals []string
e := b.env()
e.Get = get
// The registry seats: de-spiegel's image at version 1 (design 47 H §750: a want names its version, the node-engine
// resolves the digests).
e.Registry = EntryCall(func(_ context.Context, seat, _ string, args any) (json.RawMessage, error) {
if seat == "container-image-registry" && args.(map[string]string)["name"] == "de-spiegel/site" {
return json.RawMessage(`{"name":"de-spiegel/site","versions":[{"name":"de-spiegel/site","kind":"image","digest":"sha256:` +
strings.Repeat("6", 64) + `","version":"1"}]}`), nil
}
return nil, errors.New("not held")
})
e.Refused = func(why string, held map[string]string) {
for _, m := range heldModules(held) {
why += "held " + m + ": " + held[m]
@@ -572,11 +581,11 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
mfp := meshcatalogclient.SourcePrefix2 + strings.Repeat(map[string]string{"de-spiegel": "d", "proxy": "e"}[m], 64)
c3.holdEntry(t, m, mfp, raw)
w := meshwants.WantsByWantNodeModuleValue{Fp: mfp, Self: true}
if m == "de-spiegel" { // builds an image: the entry names it, the want the digest its part has
if m == "de-spiegel" { // builds an image: the entry names it, the want its version, which the registry seat resolves
k := c3.keptEnt[mfp]
k.entry.Artifacts = []meshcatalog.Artifact{{Kind: "image", Ref: "de-spiegel:site"}}
c3.keptEnt[mfp] = k
w.Parts = map[string]string{"de-spiegel:site": "sha256:" + strings.Repeat("6", 64)}
w.Version = "1"
}
c3.wants[m] = w
}
@@ -1117,6 +1126,14 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
artEntry := entryOfManifest("art", artFp, artManifest)
artEntry.Artifacts = []meshcatalog.Artifact{{Kind: "archive", Language: "none", Ref: "art:files"}}
catalogEntries[artFp] = artEntry
// art's files archive at version 1, which the candidate "art-with" names (the candidate's version, never a digest).
senv.Registry = EntryCall(func(_ context.Context, seat, _ string, args any) (json.RawMessage, error) {
if seat == "oci-artifact-registry" && args.(map[string]string)["name"] == "art/files" {
return json.RawMessage(`{"name":"art/files","versions":[{"name":"art/files","kind":"archive","digest":"sha256:` +
strings.Repeat("9", 64) + `","version":"1"}]}`), nil
}
return nil, errors.New("not held")
})
senv.Entry = EntryCall(func(_ context.Context, _, verb string, args any) (json.RawMessage, error) {
switch in := args.(type) {
case meshcatalog.ModuleInput:
@@ -1223,7 +1240,7 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
// A module with an artifact: held when the candidate gives no part for it, built from its entry and the parts when it does.
for group, added := range map[string]map[string]meshmoduleassigner.AddedModule{
"art-without": nil,
"art-with": {"art": {Version: "1", Parts: map[string]string{"art:files": "sha256:" + strings.Repeat("9", 64)}}},
"art-with": {"art": {Version: "1"}},
} {
p := trunk
p.Modules = []meshmoduleassigner.PlacedModule{{Module: "lemurs"}, {Module: "art"}}
@@ -1295,7 +1312,7 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
},
"art-without": func(a nodeengine.CandidateAnswer) bool {
return a.Verdict == nodeengine.CandidateAnswerVerdictSame && len(a.Held) == 1 && a.Held[0].Module == "art" &&
strings.Contains(a.Held[0].Why, "the candidate gives no part for art:files of art's build "+artFp)
strings.Contains(a.Held[0].Why, "the candidate's version resolves no digest of art:files of art's build "+artFp)
},
"art-with": func(a nodeengine.CandidateAnswer) bool {
return len(a.Added) == 1 && a.Added[0].Module == "art" && len(a.Held) == 0