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 <path>`, 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
This commit is contained in:
2026-11-23 23:17:41 +01:00
parent a46f14ba23
commit 5884f8ed7b
3 changed files with 25 additions and 1 deletions
@@ -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 { 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, 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, 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 { if run.Started != nil {
w.Since = *run.Started 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 return w
} }
@@ -63,6 +73,9 @@ func (r *compositionRuns) sayWaits(run meshwants.CompositionRun, readers []meshw
for _, c := range readers { for _, c := range readers {
w := waitOf(run, c) w := waitOf(run, c)
event, id := meshwants.EventWaitHeld, "composition."+runKeyOf(run.Candidate, run.Machine)+"."+run.Ask+"."+c.ID+".held" 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 != "" { if how != "" {
w.How, event, id = how, meshwants.EventWaitEnded, strings.TrimSuffix(id, ".held")+".ended" w.How, event, id = how, meshwants.EventWaitEnded, strings.TrimSuffix(id, ".held")+".ended"
} }
@@ -887,6 +887,10 @@ func (r *compositionRun) awaitPins(ctx context.Context, key, ask, what string, p
said = path 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, 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)) 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; { for woke := false; !woke; {
changed := r.runs.wake() changed := r.runs.wake()
@@ -323,6 +323,11 @@ func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
u.mu.Unlock() u.mu.Unlock()
return put(ctx, a) 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{} phase := &stepPhase{}
done := make(chan stepOutcome, 1) done := make(chan stepOutcome, 1)
first, supersede := context.WithCancel(context.WithValue(context.Background(), phaseKey{}, phase)) 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) }() 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, "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) 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 { if got := phase.get(); got != meshwants.StepProgressEventPhaseFetch {
t.Errorf("waiting, the step says the phase %q, want fetch", got) t.Errorf("waiting, the step says the phase %q, want fetch", got)
} }