Rerun of validate or composition asks the shared ask (H-A-236)

The rerun verb looked a step's ask up by the mover's id, but the validate
ask is one per pipeline and names no mover, so every validate rerun, and
a composition rerun, was refused "placed no ask now".

Builds: design 47 H H-A-236
This commit is contained in:
2026-11-21 12:02:02 +01:00
parent e5f54c5cdb
commit 0f167db73d
2 changed files with 58 additions and 0 deletions
@@ -509,6 +509,22 @@ func (v Verbs) askOf(p seat.Pipeline, s seat.StepResult, caller string, now time
if !ok {
return nil, fmt.Errorf("%s moves no module %q", p.Pipeline, s.Module)
}
// The validate ask is the pipeline's one, naming no mover (H-A-51): its rerun asks that one ask again; a composition's
// rerun builds the mover's composition ask directly, never looked up among the placed steps (H-A-236).
switch s.Step {
case seat.StepResultStepValidate, seat.StepResultStepComposition:
if s.Seat == wants.Seat {
id, step := AskID(now, p.Pipeline, "", "", seat.StepResultStepValidate), wants.StepRunStepValidate
if s.Step == seat.StepResultStepComposition {
id, step = AskID(now, p.Pipeline, m.Module, "", seat.StepResultStepComposition), wants.StepRunStepComposition
}
a := wantsAsk(p, m, id, step)
b := a.Ask.(wants.StepRun)
b.Rerun, b.By = true, caller
a.Ask = b
return &a, nil
}
}
reg, ok := v.Starter.Registration(m.Module)
if !ok {
return nil, fmt.Errorf("%s has no registration", m.Module)
@@ -8,6 +8,7 @@ import (
catalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
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"
"git.novox.be/novox/mesh-sdk/go/views"
)
@@ -252,6 +253,47 @@ func TestRerunOfARunAsksWithItsCandidatesHalf(t *testing.T) {
}
}
// H-A-236: a rerun of a failed pipeline's validate step asks the pipeline's one validate ask again (H-A-51), naming no
// mover in its id; a rerun of a composition step builds the mover's composition ask directly. Neither is refused "placed no
// ask now".
func TestRerunOfValidateOrCompositionAsksTheSharedAsk(t *testing.T) {
v, store, _, asks, _, _ := verbsFixture()
reg, entries := placeFixture()
reg.Policy.Steps.Validate, reg.Policy.Steps.Composition = "required", "required"
v.Starter.Registration = func(string) (catalog.Registration, bool) { return reg, true }
p, rev, _ := store.Get(pkey)
p.Steps, _ = Place(p, p.Movers[0], reg, entries, time.Unix(1, 0), "the-runner")
for i := range p.Steps {
switch p.Steps[i].Step {
case seat.StepResultStepValidate:
p.Steps[i].Outcome = seat.StepResultOutcomeFailed
case seat.StepResultStepComposition:
p.Steps[i].Outcome = seat.StepResultOutcomeNotAsked
}
}
p.Outcome = seat.PipelineOutcomeFailed
store.Update(pkey, p, rev)
now := v.now()
for _, c := range []struct{ step, module string }{{seat.StepResultStepValidate, ""}, {seat.StepResultStepComposition, "app"}} {
n := len(asks.asks)
r, err := v.Rerun("operator", seat.RerunInput{Pipeline: pkey, Module: "app", Step: c.step, Why: "the holder restarted"})
want := AskID(now, pkey, c.module, "", c.step)
if err != nil || r.Result == nil || r.Result.Ask != want || r.Result.Outcome != seat.StepResultOutcomeRunning {
t.Fatalf("a rerun of %s = %+v, %v, want running under %s", c.step, r.Result, err, want)
}
if len(asks.asks) != n+1 || asks.ids[n] != want {
t.Fatalf("a rerun of %s asked %v, want one ask under %s", c.step, asks.ids[n:], want)
}
b, ok := asks.asks[n].(wants.StepRun)
if !ok || b.Step != c.step || b.Module != "app" || b.Pipeline != pkey || !b.Rerun || b.By != "operator" || b.Asker != seat.Seat {
t.Errorf("the %s ask = %+v", c.step, asks.asks[n])
}
p, rev, _ = store.Get(pkey)
p.Steps[stepIndex(p, c.step, "")].Outcome = seat.StepResultOutcomeFailed
store.Update(pkey, p, rev)
}
}
func stepIndex(p seat.Pipeline, step, artifact string) int {
for i, s := range p.Steps {
if s.Step == step && s.Artifact == artifact {