P5 H-A-750 (1): a head pipeline that waits is joined by start and by the carry; the queue test reads the cancelled mover joining it

Builds: design 47 H2 H-A-750 (1), H-A-607 (2), H-A-643
This commit is contained in:
2026-11-25 18:45:09 +01:00
parent 070f62ceca
commit c452f2cc07
4 changed files with 10 additions and 15 deletions
@@ -309,15 +309,11 @@ func testTheQueueRunsPipelinesInTurn(t *testing.T) {
t.Fatal(err)
}
outcome("main.4", seat.PipelineOutcomeCancelled)
// design 47 H2 §786: the cancel leaves main.4's lib unfinished; dropped here, as runner_unfinished_drop does, so the
// next take-ins move only what they name.
unfinished, err := js.KeyValue(ctx, module+"_"+pipeline.StateUnfinished)
if err != nil {
t.Fatal(err)
}
waitFor(t, ctx, logs, func() bool { _, err := unfinished.Get(ctx, "main.lib"); return err == nil })
if err := unfinished.Delete(ctx, "main.lib"); err != nil {
t.Fatal(err)
// design 47 H2 §786, H-A-607 (2), H-A-750 (1): the cancel leaves main.4's lib, which joins the head's pipeline main.7 though
// that waits, said by mover-added with the pipeline it came from.
waitFor(t, ctx, logs, func() bool { return wasSaid("mover-added.main.7") })
if p := get("main.7"); !slices.ContainsFunc(p.Movers, func(m seat.Mover) bool { return m.Module == "lib" }) {
t.Fatalf("main.7 moves %+v, want lib joined from the cancelled main.4", p.Movers)
}
outcome("main.6", seat.PipelineOutcomeRunning)
waitFor(t, ctx, logs, func() bool { _, ok := finding(pipeline.QueueFullKind); return !ok })
@@ -331,6 +327,7 @@ func testTheQueueRunsPipelinesInTurn(t *testing.T) {
outcome("main.7", seat.PipelineOutcomeRunning)
take(8, "gated")
built("main.7", "tool")
built("main.7", "lib") // the lib that joined main.7 is built too, so main.7 ends and main.8 runs
outcome("main.8", seat.PipelineOutcomeRunning)
take(9, "lib")
built("main.8", "gated")
@@ -23,7 +23,7 @@ type AddedFrom struct {
// openPipeline says whether p waits or runs: a delivering pipeline that has not ended.
func openPipeline(p seat.Pipeline) bool {
return p.Run == "" && p.Outcome == seat.PipelineOutcomeRunning && p.Ended == nil
return p.Run == "" && (p.Outcome == seat.PipelineOutcomeRunning || p.Outcome == seat.PipelineOutcomeWaiting) && p.Ended == nil
}
// AddMovers adds to the pipeline key, which waits or runs, each of movers it does not move yet, tiers them with the rest from
@@ -94,9 +94,6 @@ func (v Verbs) Start(caller string, in seat.StartInput) (seat.StartAnswer, error
}
return seat.StartAnswer{Pipeline: key}, nil
}
if head.Ended == nil {
return seat.StartAnswer{}, fmt.Errorf("the pipeline %s is %s, not running: nothing was started", key, head.Outcome)
}
// The head's pipeline has ended: a module whose own step failed reopens it with its closed group, as a rerun does.
for _, m := range movers {
if !Moves(head, m.Module) || len(failedSteps(head, m.Module)) == 0 {
@@ -506,8 +506,9 @@ func TestStartWithModulesJoinsTheHeadsPipelineOrReopensIt(t *testing.T) {
if err := json.Unmarshal(made["main.9"], &p); err != nil || len(p.Movers) != 2 {
t.Fatalf("the pipeline = %+v (%v), want app and lib", p, err)
}
// The head's pipeline runs and moves app alone: start of both adds lib, said with the caller; one it moves already is refused.
p.Movers = p.Movers[:1]
// The head's pipeline waits (H-A-750 (1)) and moves app alone: start of both adds lib, said with the caller; one it moves
// already is refused.
p.Movers, p.Outcome = p.Movers[:1], seat.PipelineOutcomeWaiting
store["main.9"] = struct {
p seat.Pipeline
rev uint64