diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/steps.go b/modules/mesh-delivery-pipeline/internal/pipeline/steps.go index 63caa13f..bc0033f8 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/steps.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/steps.go @@ -187,6 +187,11 @@ func (h *Hearer) OnStepEndedShared(bs StepSeat, subject string, ev StepEnded, sh if ev.Node != node { return seat.Pipeline{}, fmt.Errorf("%w: ask %s ended on %s's subject names node %q", ErrRefused, ev.ID, node, ev.Node) } + // The end of a step another asker asked (the assigner's composer build) is not the runner's: it is read before any + // pipeline, and writes and says nothing (design 47 G §24, §69). A seat whose end names no asker is held to the store. + if ev.Asker != "" && ev.Asker != h.Name { + return seat.Pipeline{}, nil + } for { p, rev, err := h.Store.Get(ev.Pipeline) if err != nil { diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/steps_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/steps_test.go index 114411d9..a01a529d 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/steps_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/steps_test.go @@ -128,6 +128,16 @@ func TestStepEndedIsTakenOnlyAsAsked(t *testing.T) { if store[pkey].p.Steps[0].Outcome != seat.StepResultOutcomeRunning { t.Error("a refused end changed the pipeline") } + // R2/AC1 (design 47 G §24, §69): the end of another asker's step (the assigner's composer build, which names no + // pipeline) is not the runner's: it writes and says nothing, read before any pipeline, and is acknowledged. + theirs := ended("b7", "build", "passed") + theirs.Asker, theirs.Pipeline = "mesh-delivery-assigner", "" + if _, err := h.OnStepEnded(goSeat, goSeat.Prefix+"n1", theirs); err != nil { + t.Errorf("another asker's step end: err %v, want it taken as nothing", err) + } + if store[pkey].p.Steps[0].Outcome != seat.StepResultOutcomeRunning || store[pkey].rev != 1 { + t.Error("another asker's step end changed the pipeline") + } // The seat the step was asked of is the only one that ends it. if _, err := h.OnStepEnded(StepSeat{Seat: "node-build-node", Prefix: "mesh.seat.node-build-node.event.step-ended."}, "mesh.seat.node-build-node.event.step-ended.n1", ended("a1", "lint", "passed")); !errors.Is(err, ErrRefused) { t.Errorf("another seat's holder ended the step: %v", err)