From c452f2cc07c7da38d47642fbb833a783273e0350 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 25 Nov 2026 18:45:09 +0100 Subject: [PATCH] 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 --- .../queue_integration_test.go | 15 ++++++--------- .../internal/pipeline/carry.go | 2 +- .../internal/pipeline/handplace.go | 3 --- .../internal/pipeline/verbs_test.go | 5 +++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/queue_integration_test.go b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/queue_integration_test.go index 7157363cb..28195f2d5 100644 --- a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/queue_integration_test.go +++ b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/queue_integration_test.go @@ -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") diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/carry.go b/modules/mesh-delivery-pipeline/internal/pipeline/carry.go index 4cb1f2fcd..c7666218c 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/carry.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/carry.go @@ -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 diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/handplace.go b/modules/mesh-delivery-pipeline/internal/pipeline/handplace.go index 02ca05a13..d4e274914 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/handplace.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/handplace.go @@ -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 { diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/verbs_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/verbs_test.go index dcb6d25fb..f95008dc8 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/verbs_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/verbs_test.go @@ -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