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
+4 -4
View File
@@ -8,7 +8,7 @@ import (
// KeptBuildOf is the node that keeps the build a module is wanted at, and its fingerprint, for the artifact store's
// holder (design 47 G section 271, 526, A-50): the want's `kept-on` and nothing else names it, the builder's builds being
// no read of the node-engine's (section 421). kept is false when the module has no want, its want names no keeping node,
// or its `parts` do not name the digest ("sha256:" and 64 hex digits, or bare): the artifact is then fetched from the store.
// or the digests its version resolves to do not name the digest ("sha256:" and 64 hex digits, or bare): the artifact is then fetched from the store.
func (c *Composer) KeptBuildOf(_ context.Context, module, digest string) (node, fp string, kept bool, err error) {
c.mu.Lock()
w, ok := c.wants[module]
@@ -16,9 +16,9 @@ func (c *Composer) KeptBuildOf(_ context.Context, module, digest string) (node,
if !ok || w.Fp == "" || w.KeptOn == "" {
return "", "", false, nil
}
parts := w.Parts
if len(parts) == 0 && w.Version != "" {
// A want naming its version names its digests through the registry seats (A-430a): the resolution the composing made.
var parts map[string]string
if w.Version != "" {
// A want names its version alone, and its digests through the registry seats (design 47 H §750): the resolution the composing made.
c.mu.Lock()
r := c.resolved[resolvedKey{module, w.Fp, w.Version}]
c.mu.Unlock()
+6 -4
View File
@@ -19,15 +19,17 @@ func TestTheKeepingNodeIsTheWantsKeptOn(t *testing.T) {
node string
kept bool
}{
{"kept, by its bare digest", kd, &meshwants.WantsByWantNodeModuleValue{Fp: "f1", KeptOn: "n3", Parts: map[string]string{"db:p": "sha256:" + kd}}, "n3", true},
{"kept, by the declared digest", "sha256:" + kd, &meshwants.WantsByWantNodeModuleValue{Fp: "f1", KeptOn: "n3", Parts: map[string]string{"db:p": "sha256:" + kd}}, "n3", true},
{"a digest the parts do not name", "sha256:" + strings.Repeat("7", 64), &meshwants.WantsByWantNodeModuleValue{Fp: "f1", KeptOn: "n3", Parts: map[string]string{"db:p": "sha256:" + kd}}, "", false},
{"a want naming no keeping node", kd, &meshwants.WantsByWantNodeModuleValue{Fp: "f1", Parts: map[string]string{"db:p": "sha256:" + kd}}, "", false},
{"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") {
+3 -4
View File
@@ -778,8 +778,8 @@ func (c *Composer) entry(bucket, key string) (v any, has, known bool) {
defer c.mu.Unlock()
switch bucket {
case buckets.Wants:
// A want is composed by its fingerprint, version, parts and keeping node (design 47 G §525); its words, rule and newest
// change nothing composed. Judged by its fingerprint alone, a want that gained its parts at the same fingerprint asked no
// A want is composed by its fingerprint, version and keeping node (design 47 G §525); its words, rule and newest
// change nothing composed. Judged by its fingerprint alone, a want that gained its version at the same fingerprint asked no
// pass, and the agent waited for a composition never made (lead-47 2026-11-16, the indexer on novox).
module := agent.NodeModule
if _, ok := meshwants.ParseWantsByWantNodeNodeKey(key); !ok {
@@ -792,8 +792,7 @@ func (c *Composer) entry(bucket, key string) (v any, has, known bool) {
w, ok := c.wants[module]
return struct {
Fp, Version, KeptOn string
Parts map[string]string
}{w.Fp, w.Version, w.KeptOn, w.Parts}, ok, true
}{w.Fp, w.Version, w.KeptOn}, ok, true
case buckets.Assignments:
// Any key of a node, its node key, a module key or its legacy key, stands for the node's whole assignment: a
// module key written before its node key names it changes nothing composed.
+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
+3 -3
View File
@@ -628,10 +628,10 @@ func (s *Shadow) answerProposal(ctx context.Context, proposal string) (nodeengin
heldAdded[pm.Module] = fmt.Sprintf("the entry of %s's build %s holds no manifest that can be read: %v", pm.Module, fp, err)
continue
}
// The module is built from its entry and the parts the candidate gives (A-316); an artifact it gives no part for holds it.
w := meshwants.WantsByWantNodeModuleValue{Fp: fp, Parts: own.c.Added[pm.Module].Parts, Version: own.c.Added[pm.Module].Version}
// The module is built from its entry and the version the candidate gives (A-316, H-A-38); an artifact whose digest that version does not resolve holds it.
w := meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: own.c.Added[pm.Module].Version}
if _, missing := c.partsOf(pm.Module, entry, w); missing != "" {
heldAdded[pm.Module] = fmt.Sprintf("the candidate gives no part for %s of %s's build %s, so the node composes nothing new of it", missing, pm.Module, fp)
heldAdded[pm.Module] = fmt.Sprintf("the candidate's version resolves no digest of %s of %s's build %s, so the node composes nothing new of it", missing, pm.Module, fp)
continue
}
addedWants[pm.Module] = w
+3 -3
View File
@@ -70,10 +70,10 @@ func registryName(module string, a meshcatalog.Artifact) string {
}
// partsOf is the digest of each artifact of e for want w, by artifact reference, and the artifacts it names no digest for ("" when
// each has one). A want with parts gives them; a want with a version and no parts is resolved through the registry seats.
// each has one). A want names its version alone (design 47 H §750); its digests are resolved through the registry seats.
func (c *Composer) partsOf(module string, e meshcatalog.CatalogEntry, w meshwants.WantsByWantNodeModuleValue) (map[string]string, string) {
parts := w.Parts
if len(parts) == 0 && w.Version != "" && len(e.Artifacts) > 0 {
var parts map[string]string
if w.Version != "" && len(e.Artifacts) > 0 {
var why string
if parts, why = c.resolve(module, e, w); why != "" {
return nil, why
+3 -6
View File
@@ -13,10 +13,10 @@ import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
// Design 47 G A-430, A-430a (the lead's answer A-430b): a want naming its version and no parts is resolved to its artifacts'
// Design 47 G A-430, A-430a (the lead's answer A-430b): a want naming its version is resolved to its artifacts'
// digests through the verb versions of the registry seat of each artifact's kind, under `<module>/<artifact>`; an upstream copy
// by the digest its manifest pins. The build is made from those digests. A lookup that fails is said, naming the module, the
// version and the seat, and holds the module whole; a want with parts is read by its parts as before.
// version and the seat, and holds the module whole.
func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
fp := meshcatalogclient.SourcePrefix2 + strings.Repeat("a", 64)
d := func(c string) string { return "sha256:" + strings.Repeat(c, 64) }
@@ -46,9 +46,6 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
missing: "2.0.0", said: []string{"mail at version 2.0.0", "oci-artifact-registry", "container-image-registry"}},
"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"}},
"parts as before": {want: meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: "1.2.3", Self: true,
Parts: map[string]string{"mail:server": d("9"), "mail:files": d("5"), "mail:web": d("6")}},
parts: map[string]string{"mail:server": d("9"), "mail:files": d("5"), "mail:web": d("6")}},
} {
var mu sync.Mutex
var said []string
@@ -112,7 +109,7 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
if calls != before {
t.Errorf("%s: resolved again: %d calls, then %d", name, before, calls)
}
c.wants["mail"] = meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: row.want.Version, Parts: row.want.Parts, KeptOn: "g14", Self: true}
c.wants["mail"] = meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: row.want.Version, KeptOn: "g14", Self: true}
if node, _, kept, _ := c.KeptBuildOf(context.Background(), "mail", row.parts["mail:files"]); !kept || node != "g14" {
t.Errorf("%s: kept on %q %v, want g14", name, node, kept)
}