selfcompose: the one place says its source at every caller, reads the have's build, answers HoldsData; the tool composition reads it outside the agent's lock (A-484, A-482)

Builds: design 47 G A-484, A-484a, A-482
This commit is contained in:
2026-11-18 01:02:10 +01:00
parent 91dc064f92
commit 5cc26e2659
7 changed files with 152 additions and 122 deletions
+1
View File
@@ -1720,6 +1720,7 @@ func TestTheNodesOwnCompositionIsAppliedWhenItDiffersAndARecordMoveWaitsForAYes(
}
// Where the one place says what runs of it (A-484), the tool answers it though the want's build has no composition.
b.ag.env.RunningManifest = func(string) (string, string, string) {
_ = b.ag.Running() // the one place reads what the agent runs: the tool must not hold the agent's lock while it does
return "the module's trunk manifest in the catalog", "src2:t", "the manifest of the build ghost runs here is read from the module's trunk manifest in the catalog"
}
if view, err := b.ag.Composition(context.Background(), "ghost", "", false); err != nil || view.RunsManifest == nil ||
+5 -4
View File
@@ -189,10 +189,6 @@ func (a *Agent) Composition(ctx context.Context, module, digest string, diff boo
Held: att.Held, AnsweredRevision: att.AnsweredRev, Transient: att.Transient}
}
view.Started = a.checked[module]
if a.env.RunningManifest != nil && module != NodeModule {
src, rfp, words := a.env.RunningManifest(module)
view.RunsManifest = &RunsManifestView{Source: src, FP: rfp, Words: words}
}
latest, haveLatest := a.compositionFor(module, fp)
r, ran := a.running[module]
from, known := a.runningComposition(module)
@@ -205,6 +201,11 @@ func (a *Agent) Composition(ctx context.Context, module, digest string, diff boo
}
}
a.mu.Unlock()
// Read outside the lock: the one place reads what the agent runs (Agent.Running takes it), and nothing it does is asked of the bus.
if a.env.RunningManifest != nil && module != NodeModule {
src, rfp, words := a.env.RunningManifest(module)
view.RunsManifest = &RunsManifestView{Source: src, FP: rfp, Words: words}
}
if module != NodeModule && fp == "" {
return view, fmt.Errorf("%s has no want and no have on %s, so no build of it is composed here", module, a.env.Node)
}