assigner: a step asked again that joins a run not yet taken says its wait held, as join does (A-469y)

Builds: design 47 G §727; A-469y.
This commit is contained in:
2026-11-17 13:04:02 +01:00
parent ed78003b23
commit 1f344bd47c
2 changed files with 21 additions and 0 deletions
@@ -837,6 +837,9 @@ func (r *compositionRuns) rejoin(reader meshwants.CompositionReader, candidate,
} else if err != nil {
return joined{}, err
}
if run.Ended == nil && r.untaken(key, run.Ask) { // as join: a reader of a run not yet taken waits for a build node (A-469y)
r.sayWaits(run, []meshwants.CompositionReader{reader}, "")
}
return joined{key: key, run: run}, nil
}
if err := r.room(); err != nil {
@@ -527,6 +527,24 @@ func TestACompositionRunsBoundTimesOwedProgress(t *testing.T) {
}
})
}
// A-469y: a step asked again that joins a running run not yet taken, beside a reader or in its pipeline's former reader's
// place, says its own wait held, as join does.
for _, c := range []struct{ name, id, pipeline string }{{"a rerun joins", "b", "main.3.b"}, {"a rerun takes its former place", "a2", "main.3.a"}} {
t.Run(c.name, func(t *testing.T) {
_, r, saids, _, _ := setup(t)
if _, err := r.join(reader("a"), "main.3", "n1", "run-1"); err != nil {
t.Fatal(err)
}
again := reader(c.id)
again.Pipeline, again.Rerun = c.pipeline, true
if _, err := r.rejoin(again, "main.3", "n1", "run-2"); err != nil {
t.Fatal(err)
}
if want := []said{{meshwants.EventWaitHeld, "", "a"}, {meshwants.EventWaitHeld, "", c.id}}; !slices.Equal(*saids, want) {
t.Errorf("said %v, want %v", *saids, want)
}
})
}
t.Run("taken up at the start", func(t *testing.T) {
_, r, _, _, _ := setup(t)
for _, c := range []struct{ id, machine string }{{"a", "n1"}, {"a", "n2"}, {"b", "n1"}} {