selfcompose: a module counts as running here only when heard, run by the agent or its have says running or held; the trunk build stands only where no manifest is named (A-482, A-480a)

Both review findings of 7bfeb466 and 179a4a64 sit in runsWithoutEntry and are one change.

Builds: design 47 G A-482, A-480a
This commit is contained in:
2026-11-17 23:46:03 +01:00
parent 87cfae48b2
commit ba9d4787f9
3 changed files with 48 additions and 17 deletions
+14 -4
View File
@@ -179,7 +179,10 @@ type Composer struct {
records map[string]nodeengine.NodeRecord
// inOwn is, by module, whether this node's have of it names no fingerprint of the new form (mesh-wireguard, a module
// at a build of the old form): the node runs it inside its own composition, and composes it there again (issue 1126).
inOwn map[string]bool
inOwn map[string]bool
// haveRuns is, by module, whether this node's have of it names a build in the phase running or held: a module that
// keeps running what it runs, though no running event says it (design 47 G A-482).
haveRuns map[string]bool
modules map[string]meshcatalog.ModulesByModuleValue
told map[string]bool // lines said once each (sayOnceEach)
values map[string]map[string]any // by module, this node's
@@ -423,7 +426,7 @@ func New(env Env) *Composer {
func newComposer(env Env) *Composer {
return &Composer{env: env, wants: map[string]meshwants.WantsByWantNodeModuleValue{}, assignments: map[string]meshmoduleassigner.Assignments{}, assignmentKeys: meshmoduleassignerclient.NewKeys(),
records: map[string]nodeengine.NodeRecord{}, inOwn: map[string]bool{}, modules: map[string]meshcatalog.ModulesByModuleValue{}, values: map[string]map[string]any{},
records: map[string]nodeengine.NodeRecord{}, inOwn: map[string]bool{}, haveRuns: map[string]bool{}, modules: map[string]meshcatalog.ModulesByModuleValue{}, values: map[string]map[string]any{},
manifests: map[string][]byte{}, archives: map[string][]byte{}, handed: map[string]string{}, notTaken: map[string]string{}, unmadeSaid: map[string]string{}, rehand: make(chan struct{}, 1), sealedOwn: map[string]ownSealed{},
pkgs: map[string]compositions.Composed{}, asked: make(chan chan Pass, 8)}
}
@@ -862,9 +865,10 @@ func (c *Composer) takeModuleHave(u agent.Update) bool {
if err != nil || isNode || node != c.env.Node {
return false
}
in := false
in, runs := false, false
if !u.Deleted {
if h, err := nodeengineclient.DecodeHave(u.Value); err == nil {
runs = (h.Phase == nodeengineclient.PhaseRunning || h.Phase == nodeengineclient.PhaseHeld) && h.Fp != ""
// A have that names nothing it runs, failed (the node could not compose a module it never ran: NotComposed), is
// no module run inside the node's own composition: taken as one, it was composed from its manifest past its
// build (issue 1126, review round 1 of the builds).
@@ -879,8 +883,14 @@ func (c *Composer) takeModuleHave(u agent.Update) bool {
}
c.mu.Lock()
defer c.mu.Unlock()
changed := c.haveRuns[module] != runs
if runs {
c.haveRuns[module] = true
} else {
delete(c.haveRuns, module)
}
if c.inOwn[module] == in {
return false
return changed
}
if in {
c.inOwn[module] = true