From 5884f8ed7bcb60ac3f0b922cdd10db6db210307a Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 23 Nov 2026 23:17:41 +0100 Subject: [PATCH] assigner: while a run waits for a package's publish its readers' wait-held names that package (issue 1984, review round 1) A run waiting for a package's publish left its readers said waiting for a build node (`on: build node`), though no ask was put. While the run's value holds `waits`, waitOf now says the step waits for the publish of that package (`on: publish of package `, since the wait began), naming the package and the entry, never a build node; the readers are said so when the wait begins, under their held id with the package's path added, so the bus's duplicate window keeps it apart from the first, and a reader joining a waiting run is said so at its join. Test: TestTheCompositionStepRunsOneAskPerMachine, the wait's rows: each reader's wait-held names the publish of x/go and the node-engine's entry (failed first, no such wait-held within 10 s, with waitOf ignoring `waits`). Builds: design 47 H2 H-A-630 (5) (hq 1cdfa6ff); H-A-631 (hq ee89b857); A-469y --- .../mesh-delivery-assigner/compositionbounds.go | 15 ++++++++++++++- .../cmd/mesh-delivery-assigner/compositionrun.go | 4 ++++ .../mesh-delivery-assigner/compositionrun_test.go | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionbounds.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionbounds.go index ea44f2bee..5fb6f5fc1 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionbounds.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionbounds.go @@ -44,7 +44,12 @@ func dropOver(call func(key string, body any) (json.RawMessage, error)) func(ask } } -// waitOf is a reader's wait for a build node to take its run's ask (A-469y). +// waitOnPublish begins what a composition run's waiting reader waits on while the run waits for a package's publish, the +// package's path after it (design 47 H2 H-A-630 (5)). +const waitOnPublish = "publish of package " + +// waitOf is a reader's wait for a build node to take its run's ask (A-469y); while the run's value holds `waits`, its wait for +// that package's publish before the ask is put, naming the package and the entry, never a build node (H-A-630 (5)). func waitOf(run meshwants.CompositionRun, reader meshwants.CompositionReader) meshwants.Wait { w := meshwants.Wait{Step: "pipeline", Owner: meshwants.Seat, Module: reader.Module, Node: run.Machine, On: waitOnBuildNode, Fp: reader.Fingerprint, Words: fmt.Sprintf("the composition step of %s waits for a build node to take the composition run %s of %s (ask %s)", reader.Pipeline, @@ -52,6 +57,11 @@ func waitOf(run meshwants.CompositionRun, reader meshwants.CompositionReader) me if run.Started != nil { w.Since = *run.Started } + if run.Waits != nil { + w.On, w.Since = waitOnPublish+run.Waits.Package, run.Waits.Since + w.Words = fmt.Sprintf("the composition step of %s waits for the publish of package %s, named with no version in %s, before the composition run %s of %s is asked (ask %s)", + reader.Pipeline, run.Waits.Package, run.Waits.Entry, runKeyOf(run.Candidate, run.Machine), run.Machine, run.Ask) + } return w } @@ -63,6 +73,9 @@ func (r *compositionRuns) sayWaits(run meshwants.CompositionRun, readers []meshw for _, c := range readers { w := waitOf(run, c) event, id := meshwants.EventWaitHeld, "composition."+runKeyOf(run.Candidate, run.Machine)+"."+run.Ask+"."+c.ID+".held" + if run.Waits != nil && how == "" { // a wait-held of its own, so the bus's duplicate window does not take it for the first one's + id += "." + run.Waits.Package + } if how != "" { w.How, event, id = how, meshwants.EventWaitEnded, strings.TrimSuffix(id, ".held")+".ended" } diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go index 01d8aaf23..d4734d163 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun.go @@ -887,6 +887,10 @@ func (r *compositionRun) awaitPins(ctx context.Context, key, ask, what string, p said = path r.logf("the composition run %s waits for package %s, named with no version in %s: %s; %s ends its wait at %s", key, path, what, unpublishedSaid(waiting), packageWaitSetting, since.Add(r.runs.set.packageWait).Format(time.RFC3339)) + // Its readers are said waiting for that package's publish, naming it, no longer for a build node (H-A-630 (5)). + if run, _, ok, err := r.runs.read(key); err == nil && ok && run.Ended == nil && run.Ask == ask && run.Waits != nil { + r.runs.sayWaits(run, run.Readers, "") + } } for woke := false; !woke; { changed := r.runs.wake() diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go index 19a2504a6..741d0d4d6 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/compositionrun_test.go @@ -323,6 +323,11 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) { u.mu.Unlock() return put(ctx, a) } + u.runs.say = func(event string, body any, id string) error { + w := body.(meshwants.Wait) + journal.logf("said %s on %s: %s (%s)", event, w.On, w.Words, id) + return nil + } phase := &stepPhase{} done := make(chan stepOutcome, 1) first, supersede := context.WithCancel(context.WithValue(context.Background(), phaseKey{}, phase)) @@ -330,6 +335,8 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) { go func() { done <- u.r.run(first, "ask-step", step) }() journal.await(t, "waits for package git.novox.be/novox/x/go, named with no version in the node-engine's entry src2:e", 2) journal.await(t, "the composition step of m says fetch: the composition run", 1) + // H-A-630 (5): each reader's wait-held says it waits for x/go's publish, naming the package and the entry. + journal.await(t, "said wait-held on "+waitOnPublish+"git.novox.be/novox/x/go: the composition step of waits for the publish of package git.novox.be/novox/x/go, named with no version in the node-engine's entry src2:e", 2) if got := phase.get(); got != meshwants.StepProgressEventPhaseFetch { t.Errorf("waiting, the step says the phase %q, want fetch", got) }