selfcompose: the manifest of the build a module runs here is answered in one place; every step reads it there (A-484)
Entry of the running build, else the composition this node runs of it, else the module's trunk manifest through the seat mesh-catalog's verb module; said once per module and source; words naming the three where none answers. Read there: a held module's offer (frombus Scope.RunningManifest), FormChanges (A-483), the store holder and the stand of a running module without an entry (A-461d, A-480a), and the tool composition. Builds: design 47 G A-484, A-480, A-480a, A-483, A-461d, A-482
This commit is contained in:
@@ -132,6 +132,10 @@ type Env struct {
|
||||
// a fingerprint it holds none of, so a composer that believes it handed it hands it again. Nil tells nobody.
|
||||
WhyUnmade func(module string) string
|
||||
Waiting func(module, fp string)
|
||||
// RunningManifest is the one place that answers the manifest of the build a module runs here (design 47 G A-484): the source
|
||||
// that answered with its build, or, where none did, the words naming the three it tried. The tool composition says it. Nil
|
||||
// says nothing.
|
||||
RunningManifest func(module string) (source, fp, words string)
|
||||
// Apply applies one module's composition (scope NodeModule for the node's own), given the compositions the node's
|
||||
// other modules run so a path, unit or group they hold is not removed or taken. It is called with one module at a
|
||||
// time.
|
||||
|
||||
@@ -1718,6 +1718,15 @@ func TestTheNodesOwnCompositionIsAppliedWhenItDiffersAndARecordMoveWaitsForAYes(
|
||||
if _, err := b.ag.Composition(context.Background(), "ghost", "", false); err == nil || !strings.Contains(err.Error(), "waits for the composer: no manifest in the composer's picture") {
|
||||
t.Errorf("the composition read of ghost says %v, want why the composer made none", err)
|
||||
}
|
||||
// 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) {
|
||||
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 ||
|
||||
view.RunsManifest.Source != "the module's trunk manifest in the catalog" || !strings.Contains(view.Composition.Refused, "waits for the composer") {
|
||||
t.Errorf("the composition read of ghost says %+v, %v, want what runs of it and why the composer made none", view.RunsManifest, err)
|
||||
}
|
||||
b.ag.env.RunningManifest = nil
|
||||
toldMu.Lock()
|
||||
if n := slices.Index(told, "ghost@"+fpOf("9")); saidCount() != 1 || n < 0 || slices.Contains(told[n+1:], "ghost@"+fpOf("9")) {
|
||||
t.Errorf("said %d times, told %q; want once and ghost told once", saidCount(), told)
|
||||
|
||||
@@ -37,6 +37,9 @@ type CompositionView struct {
|
||||
Revisions []RevisionView `json:"revisions,omitempty"`
|
||||
// Runs is what runs of the module, and where that is known from; nil when nothing of it runs.
|
||||
Runs *RunsView `json:"runs,omitempty"`
|
||||
// RunsManifest is the manifest of the build that runs of the module, as the one place reads it (design 47 G A-484): which
|
||||
// source answered, or the words naming the three it tried. Said also where the want's build has no composition.
|
||||
RunsManifest *RunsManifestView `json:"runs-manifest,omitempty"`
|
||||
// Judged is the move from what runs to the composition read, as the agent judges it before an apply.
|
||||
Judged JudgedView `json:"judged"`
|
||||
// Diff is every resource that differs from what runs, when asked.
|
||||
@@ -136,6 +139,14 @@ type RunsView struct {
|
||||
Resources int `json:"resources"`
|
||||
}
|
||||
|
||||
// RunsManifestView is what the one place answers of the build a module runs here.
|
||||
type RunsManifestView struct {
|
||||
// Source is the source that answered; empty when none did.
|
||||
Source string `json:"source,omitempty"`
|
||||
FP string `json:"fp,omitempty"`
|
||||
Words string `json:"words"`
|
||||
}
|
||||
|
||||
// JudgedView is a move's judgement.
|
||||
type JudgedView struct {
|
||||
Judgement string `json:"judgement"`
|
||||
@@ -178,6 +189,10 @@ 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)
|
||||
@@ -220,12 +235,19 @@ func (a *Agent) Composition(ctx context.Context, module, digest string, diff boo
|
||||
case digest != "" && read == nil:
|
||||
return view, fmt.Errorf("no revision of %s the bucket keeps has the digest %s; revisions lists those it keeps", key, digest)
|
||||
case read == nil && !haveLatest:
|
||||
// What runs of the module is still said, through the one place (A-484): the composition read is the want's build, and a
|
||||
// module held at another build has none of it.
|
||||
words := fmt.Sprintf("the bucket holds no composition of %s at %s", module, fp)
|
||||
if a.env.SelfComposed && a.env.WhyUnmade != nil && module != NodeModule {
|
||||
if why := a.env.WhyUnmade(module); why != "" {
|
||||
return view, fmt.Errorf("the bucket holds no composition of %s at %s; the agent waits for the composer: %s", module, fp, why)
|
||||
words = fmt.Sprintf("the bucket holds no composition of %s at %s; the agent waits for the composer: %s", module, fp, why)
|
||||
}
|
||||
}
|
||||
return view, fmt.Errorf("the bucket holds no composition of %s at %s", module, fp)
|
||||
if view.RunsManifest == nil {
|
||||
return view, errors.New(words)
|
||||
}
|
||||
view.Composition = RevisionView{Key: key, Refused: words}
|
||||
return view, nil
|
||||
case read == nil:
|
||||
read = &latest
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user