Node-engine: a running module with no fingerprint is held in its answer, never removed (A-410)

Builds: design 47 G A-410
This commit is contained in:
2026-11-14 23:18:36 +01:00
parent 0adc5ab4e6
commit 592b4002bd
2 changed files with 38 additions and 0 deletions
+14
View File
@@ -141,6 +141,20 @@ func Answer(ctx context.Context, r Reader, mesh Mesh, s Scope, fps map[string]st
a.Differs = slices.DeleteFunc(cmp.Differs, func(d nodeengine.CandidateDiffers) bool { return !notFailed(d.Module) })
cmp.Added = slices.DeleteFunc(cmp.Added, func(d nodeengine.CandidateAdded) bool { return !notFailed(d.Module) })
skipped = slices.DeleteFunc(skipped, func(m string) bool { return !notFailed(m) })
// A module the node runs and an assignment names, but that no build can be given to compose at (what runs of it carries
// no fingerprint, it having started before the node-engine wrote them, and the declaration gives none), is held: kept as
// it runs, said as held with why, never removed and never stopped for it. Only a module no assignment names is removed
// (A-410).
for _, m := range skipped {
if !runs[m] {
continue
}
a.Removed = slices.DeleteFunc(a.Removed, func(x string) bool { return x == m })
a.Held = append(a.Held, nodeengine.CandidateRefusal{Module: m,
Why: "what runs of " + m + " has no fingerprint and none is given to compose it at, so it is kept as it runs",
Today: "running, kept as it runs"})
}
skipped = slices.DeleteFunc(skipped, func(m string) bool { return runs[m] })
// What the proposal adds, by node and module: placed by a candidate and not by the trunk on that node.
added := map[string]bool{}
@@ -12,6 +12,7 @@ import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
engcomp "github.com/novox/mesh-host/internal/compositions"
"maps"
"os"
"reflect"
"slices"
@@ -193,6 +194,29 @@ func answerNamesEveryRefusalAndLeavesAnOldBuildToTheNode(t *testing.T) {
if a = Answer(ctx, b, Mesh{}, Scope{Node: "n1", Assignments: given(b), InOwn: []string{"spiegel"}}, fps, withMembership, "p-h1", 3); a.Verdict != nodeengine.CandidateAnswerVerdictSame {
t.Errorf("the node's own with its bus membership is answered %+v, want the same", a)
}
// (C) A module the node runs and an assignment names, given no fingerprint to compose at (it started before the node
// wrote them): held as it runs, never removed (A-410). One no assignment names is removed.
noFp := maps.Clone(fps)
delete(noFp, "lemurs")
unmarked := make([]engcomp.Composed, 0, len(running))
for _, c := range running {
if c.Module == "lemurs" {
c.FP = ""
}
unmarked = append(unmarked, c)
}
unmarked = append(unmarked, engcomp.Composed{Node: "n1", Module: "gone", FP: fp("1")})
a = Answer(ctx, b, Mesh{}, Scope{Node: "n1", Assignments: given(b), InOwn: []string{"spiegel"}}, noFp, unmarked, "p-h1", 3)
if !reflect.DeepEqual(a.Removed, []string{"gone"}) {
t.Errorf("removed %v, want only the module no assignment names", a.Removed)
}
heldIt := false
for _, h := range a.Held {
heldIt = heldIt || h.Module == "lemurs" && h.Why != ""
}
if !heldIt || len(a.Added) != 0 {
t.Errorf("a running module with no fingerprint is answered held %+v added %+v, want held with why and not added", a.Held, a.Added)
}
// Without what runs, the fold composes spiegel from its manifest, as before, and the composition refuses it.
if _, _, held, err := Compose(ctx, b, Mesh{}, Scope{Node: "n1", InOwn: []string{"spiegel"}}, fps); err != nil ||
!strings.Contains(held["spiegel"], "spiegel has not been built for this mesh") {