R3-1, R3-2, R3-3: the node-engine reads no build of the builder; the shadow builds from the entry it holds

The composer's Build is made from the catalog half's entry it holds and the parts of the want that names it (buildOf); the
inputs of the indexer's modules and the builder's builds, takeBuildDone, takeModule and the builder read are gone, and mesh-host
names no BuilderBuildsBucket. The shadow takes the entries of the builds it composes from (askBuildsEntries), builds a module a
candidate adds from its entry and the candidate's `added` parts (A-316), and holds, with the reason, a module whose entry
has no part given, whose fingerprint the verb module does not give, or for which it errors (A-312). Its composer is given the
entry call as the node's own is. Rows: a built module added with and without parts, the verb module answering no fingerprint
and erroring.

Builds: design 47 G §421, §628, A-308, A-312, A-316
This commit is contained in:
2026-11-12 23:05:06 +01:00
parent e558510a54
commit 23799a30ed
12 changed files with 279 additions and 359 deletions
+43 -1
View File
@@ -16,6 +16,7 @@ import (
engcomp "github.com/novox/mesh-host/internal/compositions"
"github.com/novox/mesh-host/internal/judge"
"maps"
"slices"
"sort"
"strings"
"sync"
@@ -592,9 +593,16 @@ func (s *Shadow) answerProposal(ctx context.Context, proposal string) (nodeengin
inOwn := c.inOwnOf(*assignment)
c.mu.Unlock()
fps := shadowBuilds(running, *assignment, modules, inOwn)
if why := c.askBuildsEntries(fps); why != "" {
// Its answer wakes the shadow (entryMoved), which composes this proposal again.
c.missed.Add(1)
return nodeengine.CandidateAnswer{Proposal: proposal, Revision: int64(rev), Verdict: nodeengine.CandidateAnswerVerdictRefused,
Refused: why + ", so this answer waits for it"}, true
}
// A module the candidate adds that no want here names: the trunk's build is asked of the catalog half's verb module, and its
// entry by the verb entry (design 47 G §421, A-312). One with no build to take is held, with the reason.
heldAdded := map[string]string{}
addedWants := map[string]meshwants.WantsByWantNodeModuleValue{}
folded := map[string]bool{}
for _, m := range inOwn {
folded[m] = true
@@ -620,6 +628,13 @@ 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}
if missing := partsMissing(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)
continue
}
addedWants[pm.Module] = w
m := meshcatalog.ModulesByModuleValue{Fp2: fp, Manifest: digest, Repository: entry.Repository, Commit: entry.Commit, Path: entry.Path,
Needs: entry.Needs, Packages: entry.Packages, Verdict: entry.Verdict}
if entry.Inputs != nil {
@@ -642,14 +657,41 @@ func (s *Shadow) answerProposal(ctx context.Context, proposal string) (nodeengin
// The boxes it runs, by what each module's have and its own key say after a restart (Held), are reused for the
// modules it runs: a value sealed again is no difference.
held := map[string]meshwants.WantsByWantNodeModuleValue{agent.NodeModule: {}}
c.mu.Lock()
for module := range fps {
held[module] = meshwants.WantsByWantNodeModuleValue{Fp: fps[module]}
if w, ok := c.wants[module]; ok && w.Fp == fps[module] {
held[module] = w // the want's parts give the build's artifacts their digests (buildOf)
}
if w, ok := addedWants[module]; ok {
held[module] = w // so do the parts the candidate gives a module it adds
}
}
c.mu.Lock()
c.wants = held
c.mu.Unlock()
// A module the candidate adds that cannot be built is held with the reason, and the rest is composed without it: composed with it, the
// assignment would be refused for a module nothing provides.
if len(heldAdded) > 0 {
without := *assignment
without.Modules = nil
for _, pm := range assignment.Modules {
if _, held := heldAdded[pm.Module]; !held {
without.Modules = append(without.Modules, pm)
}
}
given[node] = &without
}
a := frombus.Answer(ctx, reader{c: c}, c.env.Mesh, frombus.Scope{Node: node, KeptAt: kept, Assignments: given, InOwn: inOwn,
SameValue: c.sameValue, HeldToday: s.heldToday(heldAdded)}, fps, running, proposal, rev)
for _, module := range slices.Sorted(maps.Keys(heldAdded)) {
a.Held = append(a.Held, nodeengine.CandidateRefusal{Module: module, Why: heldAdded[module]})
}
// What this proposal added is its own: another proposal that places the module without giving its parts must not find it composed.
c.mu.Lock()
for module := range addedWants {
delete(c.modules, module)
}
c.mu.Unlock()
s.mu.Lock()
ran := make(map[string]string, len(s.ran))
for m, d := range s.ran {