Design 47 H1: the start of a newer pipeline is held to take moved movers out, and reads its branch alone (H-A-223)

No test failed when Start stopped calling the supersede of running
pipelines, the path the live runner takes. Two rows now start a newer
pipeline through Start, a take-in's and a release revision's, with the
supersede wired to a hearer over the same store, and hold that the older
running pipeline's moved mover left it. The supersede lists only the keys
of the newer pipeline's branch instead of every pipeline's.

Builds: design 47 H H-A-223
This commit is contained in:
2026-11-21 01:18:55 +01:00
parent 06a52a10e0
commit d1581666d2
2 changed files with 36 additions and 3 deletions
@@ -1,6 +1,7 @@
package pipeline package pipeline
import ( import (
"encoding/json"
"errors" "errors"
"strings" "strings"
"testing" "testing"
@@ -432,4 +433,36 @@ func TestAMovedMoverLeavesARunningPipeline(t *testing.T) {
} }
}) })
} }
// The live path: a newer pipeline started through Start, a take-in's or a release revision's alike, takes the moved
// mover out of the older running pipeline over the same store (H-A-223, H-A-213).
starts := []struct {
name string
begin Begin
}{
{"a take-in", Begin{Branch: "main", Source: 55, Revision: 55, Call: "0123456789abcdef", Movers: []seat.Mover{{Module: "b", Commit: "c2", Fingerprint: "src2:b2"}}}},
{"a release revision", Begin{Branch: "main", Source: 54, Revision: 57, Call: "release of mesh-sdk 0.1.26", Movers: []seat.Mover{{Module: "b", Commit: "c1", Fingerprint: "src2:b2"}}}},
}
for _, r := range starts {
t.Run("started by "+r.name, func(t *testing.T) {
store := &MoverStore{Raw: newMemRaw()}
raw, _ := json.Marshal(running())
if err := store.Create("main.54", raw); err != nil {
t.Fatal(err)
}
h := &Hearer{Store: store, Say: func(string, any) error { return nil }, Now: func() time.Time { return t0 }}
s := &Starter{Pipelines: store, Store: store, Say: func(string, any) error { return nil }, Now: func() time.Time { return t0 },
Supersede: func(newer seat.Pipeline) { h.SupersedeRunning(newer) }}
if ok, err := s.Start(r.begin); !ok || err != nil {
t.Fatalf("start = %v, %v", ok, err)
}
p, _, _ := store.Get("main.54")
var got []string
for _, st := range p.Steps {
got = append(got, st.Module+" "+st.Step+" "+st.Outcome)
}
if s := p.Outcome + "; " + strings.Join(got, "; "); s != "running; a build running; b build superseded; b lint superseded" {
t.Errorf("the older pipeline after %s = %s; want b left it", r.name, s)
}
})
}
} }
@@ -64,15 +64,15 @@ func allLeft(p seat.Pipeline) bool {
return true return true
} }
// SupersedeRunning takes out of every older running pipeline of newer's branch each mover whose fingerprint newer moved // SupersedeRunning takes out of every older running pipeline of newer's branch, read by that branch's keys alone, each mover whose fingerprint newer moved
// (H-A-223): its open steps end superseded, naming newer, never failed; a step reading a test run leaves it, as a cancel's // (H-A-223): its open steps end superseded, naming newer, never failed; a step reading a test run leaves it, as a cancel's
// does; the mover is kept in the pipeline's superseded, so the end judgement (H-A-163) counts it as left and newer carries // does; the mover is kept in the pipeline's superseded, so the end judgement (H-A-163) counts it as left and newer carries
// it. A pipeline then judged ends as at a step's end, by its other movers alone; one every mover left ends superseded. // it. A pipeline then judged ends as at a step's end, by its other movers alone; one every mover left ends superseded.
// A run on request's pipeline is never touched. It answers the pipelines it touched. // A run on request's pipeline is never touched. It answers the pipelines it touched.
func (h *Hearer) SupersedeRunning(newer seat.Pipeline) []string { func (h *Hearer) SupersedeRunning(newer seat.Pipeline) []string {
pkeys, err := allKeys(h.Store) pkeys, err := branchKeys(h.Store, newer.Branch)
if err != nil { if err != nil {
h.logf("the running pipelines are not listed, so none is superseded by %s: %v", newer.Pipeline, err) h.logf("the running pipelines of %s are not listed, so none is superseded by %s: %v", newer.Branch, newer.Pipeline, err)
return nil return nil
} }
var touched []string var touched []string