Take a validate end by its ask alone, ending every mover's validate (H-A-252)

The pipeline's one validate ask names no mover, but its end names the
mover whose body the holder took; the runner compared that mover with
the first step carrying the ask and dropped a passed validate, so the
pipeline held its slot (main.88).

Builds: design 47 H H-A-236, H-A-252
This commit is contained in:
2026-11-21 12:02:02 +01:00
parent 5f7137e676
commit c9515da86f
2 changed files with 65 additions and 1 deletions
@@ -8,6 +8,7 @@ import (
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshbuilds"
seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
wants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
nodebuildgo "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
)
@@ -163,3 +164,34 @@ func TestASilentSeatsAskIsPutAgainWhenItsHolderStartsAndEndsAtItsSilentBound(t *
t.Errorf("raised %v", raised)
}
}
// H-A-252: the pipeline's one validate ask names no mover (H-A-51), and its holder's end names the mover whose body it took:
// it is matched by its ask alone and ends the validate step of every mover under it, whichever mover it names.
func TestAValidateEndNamingOneMoverEndsEveryMoversValidate(t *testing.T) {
h, store, _, _, _, _ := fixture()
p, rev, _ := store.Get(pkey)
p.Movers = []seat.Mover{{Module: "app", Commit: "c1", Fingerprint: "src2:aa"}, {Module: "lib", Commit: "c2", Fingerprint: "src2:bb"}}
p.Steps = []seat.StepResult{
{Module: "app", Step: seat.StepResultStepValidate, Status: seat.StepResultStatusRequired, Outcome: seat.StepResultOutcomeRunning, Ask: "v1", Seat: wants.Seat},
{Module: "lib", Step: seat.StepResultStepValidate, Status: seat.StepResultStatusRequired, Outcome: seat.StepResultOutcomeRunning, Ask: "v1", Seat: wants.Seat}}
store.Update(pkey, p, rev)
var bs StepSeat
for _, x := range StepSeats {
if x.Seat == wants.Seat {
bs = x
}
}
ev := StepEnded{ID: "v1", Node: "n1", Pipeline: pkey, Module: "lib", Commit: "c2", Fingerprint: "src2:bb", Step: seat.StepResultStepValidate, Outcome: "passed"}
if _, err := h.OnStepEnded(bs, bs.Prefix+"n1", ev); err != nil {
t.Fatal(err)
}
got, _, _ := store.Get(pkey)
for _, s := range got.Steps {
if s.Outcome != seat.StepResultOutcomePassed {
t.Errorf("%s's validate = %s, want passed by the one end", s.Module, s.Outcome)
}
}
if got.Outcome != seat.PipelineOutcomePassed {
t.Errorf("the pipeline = %s (%s), want passed", got.Outcome, got.Why)
}
}
@@ -239,6 +239,12 @@ func (h *Hearer) OnStepEndedPinned(bs StepSeat, subject string, ev StepEnded, sh
return seat.Pipeline{}, fmt.Errorf("%w: ask %s names pipeline %q, which the runner cannot read: %v", ErrRefused, ev.ID, ev.Pipeline, err)
}
i := stepOfAsk(p, ev.ID)
// The validate ask is the pipeline's one, naming no mover (H-A-51): its end, naming the mover whose body the holder
// took, is matched by its ask alone and ends every mover's validate step under it (H-A-252).
oneValidate := i >= 0 && p.Steps[i].Step == seat.StepResultStepValidate && p.Steps[i].Seat == wants.Seat
if oneValidate {
i = validateStepOfAsk(p, ev.ID, ev.Module)
}
var m seat.Mover
if i >= 0 {
m, _ = MoverOf(p, p.Steps[i].Module)
@@ -248,7 +254,7 @@ func (h *Hearer) OnStepEndedPinned(bs StepSeat, subject string, ev StepEnded, sh
return p, fmt.Errorf("%w: pipeline %s asked no step under ask %s", ErrRefused, ev.Pipeline, ev.ID)
case p.Steps[i].Seat != bs.Seat:
return p, fmt.Errorf("%w: ask %s was asked of %s, not %s", ErrRefused, ev.ID, p.Steps[i].Seat, bs.Seat)
case ev.Commit != m.Commit || ev.Fingerprint != m.Fingerprint || ev.Module != m.Module || ev.Step != p.Steps[i].Step:
case ev.Step != p.Steps[i].Step || (!oneValidate && (ev.Commit != m.Commit || ev.Fingerprint != m.Fingerprint || ev.Module != m.Module)):
return p, fmt.Errorf("%w: ask %s ended %s of %s at %s (%s), asked as %s of %s at %s (%s)", ErrRefused, ev.ID, ev.Step,
ev.Module, ev.Commit, ev.Fingerprint, p.Steps[i].Step, p.Steps[i].Module, m.Commit, m.Fingerprint)
case !open(p.Steps[i]):
@@ -587,6 +593,32 @@ func endOutcome(o string) bool {
return false
}
// validateStepOfAsk is the validate step the end of the shared validate ask id ends first (H-A-252): the open one of the mover
// the end names, else any open one under the ask (sameValidate ends the rest), else the first under it.
func validateStepOfAsk(p seat.Pipeline, id, module string) int {
first, anyOpen := -1, -1
for i, s := range p.Steps {
if s.Step != seat.StepResultStepValidate || s.Ask == "" || (s.Ask != id && AgainID(s.Ask) != id) {
continue
}
if first < 0 {
first = i
}
if open(s) {
if s.Module == module {
return i
}
if anyOpen < 0 {
anyOpen = i
}
}
}
if anyOpen >= 0 {
return anyOpen
}
return first
}
func stepOfAsk(p seat.Pipeline, id string) int {
for i, s := range p.Steps {
// An ask put again is put under AgainID of the step's ask (H-A-243 (3)): its holder's answer under either is the step's.