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
+6 -38
View File
@@ -1,42 +1,10 @@
package selfcompose
import (
"context"
"strings"
)
import "context"
// 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 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]
c.mu.Unlock()
if !ok || w.Fp == "" || w.KeptOn == "" {
return "", "", false, nil
}
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()
if r.parts == nil {
return "", "", false, nil
}
parts = r.parts
}
if len(parts) > 0 {
named := false
for _, d := range parts {
if strings.TrimPrefix(d, "sha256:") == strings.TrimPrefix(digest, "sha256:") {
named = true
}
}
if !named {
return "", "", false, nil
}
}
return w.KeptOn, w.Fp, true, nil
// KeptBuildOf is the node that keeps the build a module is wanted at, for the artifact store's holder (design 47 G section 271,
// 526, A-50). A want names a version and no keeping node any more (design 47 H §750, H-A-37: `kept-on` goes), so none is kept
// here and the artifact is fetched from the store.
func (c *Composer) KeptBuildOf(_ context.Context, _, _ string) (node, fp string, kept bool, err error) {
return "", "", false, nil
}