assigner: a put may hold the build a node runs now

A put of ace's assigner at the build it runs (a hand start) was refused, since the builder's store holds no build of
it, so the trunk's newest build would replace it. Where the store holds none, a put naming the fingerprint the node's
running statement names is held there with the composition the node's have names; the store is not asked. A have
naming no composition at that fingerprint refuses it, saying so.

Builds: design 47 G A-427, A-426
This commit is contained in:
2026-11-15 15:58:00 +01:00
parent ad3d73d9bd
commit 21523a449f
2 changed files with 32 additions and 0 deletions
@@ -79,6 +79,23 @@ func StepPut(w PutWorld) PutNext {
if !w.Assigned {
return say(puts.Refused, "%s is not assigned to %s: a put moves a module where it stands assigned (propose its assignments first)", w.Module, w.Node)
}
if p.Step != puts.Wanted && p.Step != puts.Holding && w.Build == "" {
// Only where the builder's store holds no build of it: one it built goes the put's whole way (composition, the yes).
if r := w.Running; r != nil && !r.Stopped && r.Fingerprint != "" && r.Fingerprint == p.FP {
// The build the node runs now (design 47 G A-427): read from the node's running statement, held there with the
// composition its have names, and the builder's store is not asked for it (a part started by hand has none there).
if h := w.Have; h == nil || h.Fp != p.FP || h.Composed == "" {
return say(puts.Refused, "%s runs %s at %s, and its have names no composition at that fingerprint, so the want cannot name what runs", w.Node, w.Module, fp)
}
p.Composed = w.Have.Composed
words := fmt.Sprintf("the want of %s on %s names %s, the build it runs now (composition %s), from its running statement; the builder's store is not asked",
w.Module, w.Node, fp, short(p.Composed))
if p.Hold {
words += ", held until released"
}
return PutNext{Put: applied(w, p.Said(w.Now, puts.Wanted, words))}
}
}
switch w.Build {
case builds.BuildDone:
case builds.BuildFailed:
@@ -882,6 +882,21 @@ func stepsOfAPut(t *testing.T) {
{"not assigned", func() PutWorld { w := bus(); w.Assigned = false; return w }, puts.Refused, "not assigned", false, false, false},
{"no build yet of the newest", func() PutWorld { w := bus(); w.Build = ""; return w }, puts.Build, "builds by itself", false, false, false},
{"no build of an older one", func() PutWorld { w := bus(); w.Build, w.Newest = "", fpOf('c'); return w }, puts.Refused, "holds no build", false, false, false},
// A-427: the build the node runs now is put from its running statement, held with the have's composition, the
// builder's store not asked (a part started by hand has no build there); a have naming no composition refuses it.
{"the build the node runs now, not in the builder's store: held there", func() PutWorld {
w := bus()
w.Build, w.Newest = "", fpOf('c')
w.Running = &nodeengine.Running{Node: "novox", Module: "nats", Fingerprint: fNew}
w.Have = &nodeengine.HaveByNodeModuleValue{Fp: fNew, Composed: dig(fNew), Phase: nodeengineclient.PhaseRunning, Health: nodeengineclient.HealthOK}
return w
}, puts.Holding, "held there until released", false, false, false},
{"the build the node runs now, its have naming no composition: refused", func() PutWorld {
w := bus()
w.Build, w.Newest = "", fpOf('c')
w.Running = &nodeengine.Running{Node: "novox", Module: "nats", Fingerprint: fNew}
return w
}, puts.Refused, "names no composition", false, false, false},
{"a failed build", func() PutWorld { w := bus(); w.Build, w.BuildWords = builds.BuildFailed, "go vet"; return w }, puts.Refused, "go vet", false, false, false},
{"no composition yet: waits", func() PutWorld { w := bus(); w.Composed = nil; return w }, puts.Compose, "no composition of nats for novox", false, false, false},
{"composed, grant not naming the node", func() PutWorld { w := bus(); w.Granted = false; return w }, puts.Compose, "does not name novox", false, false, false},