Design 47 H1: a mover leaving a running pipeline has its build-node asks dropped (H-A-223)

A moved mover's steps ended superseded, but their asks kept running on the
build nodes. Each such step holding its own ask on a node-build seat, one
reading no shared run, now has the seat's drop asked with the newer
pipeline's why, through the drop the runner already bounds and keeps. The
seat mesh-builds serves no drop, so a build ask there runs to its end,
which the runner ignores: the step is no longer open.

Builds: design 47 H H-A-223
This commit is contained in:
2026-11-21 01:22:10 +01:00
parent d1581666d2
commit 3a31331ad3
2 changed files with 34 additions and 5 deletions
@@ -3,6 +3,7 @@ package pipeline
import (
"encoding/json"
"errors"
"fmt"
"strings"
"testing"
"time"
@@ -390,7 +391,8 @@ func TestAMovedMoverLeavesARunningPipeline(t *testing.T) {
Steps: []seat.StepResult{
{Module: "a", Step: seat.StepResultStepBuild, Status: seat.StepResultStatusRequired, Outcome: seat.StepResultOutcomeRunning, Ask: "x1", Started: &t0},
{Module: "b", Step: seat.StepResultStepBuild, Status: seat.StepResultStatusRequired, Outcome: seat.StepResultOutcomeRunning, Ask: "x2", Started: &t0},
{Module: "b", Step: seat.StepResultStepLint, Artifact: "b:program", Status: seat.StepResultStatusRequired, Outcome: seat.StepResultOutcomeRunning, Ask: "x3", Started: &t0}}}
{Module: "b", Step: seat.StepResultStepLint, Artifact: "b:program", Status: seat.StepResultStatusRequired, Outcome: seat.StepResultOutcomeRunning, Ask: "x3", Started: &t0,
Seat: nodebuildgo.Seat, Node: "n2"}}}
}
rows := []struct {
name string
@@ -412,9 +414,22 @@ func TestAMovedMoverLeavesARunningPipeline(t *testing.T) {
p seat.Pipeline
rev uint64
}{running(), 1}
var said []string
h := &Hearer{Store: store, Say: func(subject string, _ any) error { said = append(said, subject); return nil }, Now: func() time.Time { return t0 }}
var said, dropped []string
h := &Hearer{Store: store, Say: func(subject string, _ any) error { said = append(said, subject); return nil }, Now: func() time.Time { return t0 },
DropRun: func(buildSeat, node, ask, why string) error {
dropped = append(dropped, buildSeat+" "+node+" "+ask+" "+fmt.Sprint(strings.Contains(why, "main.57")))
return nil
}}
h.SupersedeRunning(seat.Pipeline{Pipeline: "main.57", Branch: "main", Revision: 57, Movers: r.newer})
// b's lint ask on its build node is dropped naming the newer pipeline; the build ask on mesh-builds, which
// serves no drop, is not (H-A-223).
wantDropped := ""
if r.newer[0].Fingerprint != "src2:b1" {
wantDropped = "node-build-go n2 x3 true"
}
if got := strings.Join(dropped, ","); got != wantDropped {
t.Errorf("dropped %q; want %q", got, wantDropped)
}
p, _, _ := store.Get("main.54")
got := []string{p.Outcome}
for _, s := range p.Steps {
@@ -109,14 +109,17 @@ func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
now := h.now()
why := "superseded: the newer " + newer.Pipeline + " moved its fingerprint, and carries it (H-A-223)"
var ended []int
var leave []seat.StepResult
var leave, drop []seat.StepResult
for i := range p.Steps {
st := &p.Steps[i]
if !slices.Contains(moved, st.Module) || (!open(*st) && st.Outcome != seat.StepResultOutcomeWaiting) {
continue
}
if sharedRun(*st) != "" && st.Seat != wants.Seat {
switch {
case sharedRun(*st) != "" && st.Seat != wants.Seat:
leave = append(leave, *st)
case st.Ask != "" && BoundSeat(st.Seat):
drop = append(drop, *st) // its own ask on a build node: the seat's drop cancels it
}
st.Outcome, st.Why, st.Ended = seat.StepResultOutcomeSuperseded, why, &now
p.Unlogged = append(p.Unlogged, endEntry(key, *st, now))
@@ -139,6 +142,17 @@ func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
for _, st := range leave {
h.leaveRun(key, st, "the mover "+st.Module+" left "+key+" for the newer "+newer.Pipeline)
}
// Its running asks on the build nodes are cancelled through the seat's drop (H-A-223). The seat mesh-builds serves no
// drop, so a build ask there runs to its end, which the runner ignores: the step is no longer open.
for _, st := range drop {
if h.DropRun == nil {
h.logf("%s: the ask %s of %s's %s is not dropped: the runner has no drop", key, st.Ask, st.Module, st.Step)
continue
}
if err := h.DropRun(st.Seat, st.Node, st.Ask, why); err != nil {
h.logf("%s: the drop of the ask %s of %s's %s is not asked of %s: %v", key, st.Ask, st.Module, st.Step, st.Seat, err)
}
}
if err := h.said(p, nil, done); err != nil {
h.logf("%v", err)
}