R2: the runner hears only the ends of the steps it asked itself

A build seat's step-ended naming another asker (the assigner's composer build,
which names no pipeline) was read against the runner's store, refused and
terminated; it is now taken as nothing, read before any pipeline, and
acknowledged.

Builds: design 47 G §24, §69

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-20 04:56:31 +01:00
parent 5009109fad
commit def28437ce
2 changed files with 15 additions and 0 deletions
@@ -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 {
@@ -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)