H-A-361: a hand-off places the movers that stay; a mover that left is not awaited
main.158 and main.163 ended failed seconds after newer pipelines took movers away: the movers that stay still awaited the movers that left, whose builds had ended superseded, so the next placing ended them "not asked: its dependency did not build" and the end judgement counted them as failures. A mover that left is no longer awaited (the stayer builds against the newest published package, H-A-53), is never placed in the older pipeline, and the hand-off places what stays at once and says in the journal which movers stay. Builds: design 47 H H-A-361, H-A-53, H-A-223
This commit is contained in:
@@ -139,13 +139,16 @@ var buildKinds = []int64{3, 1}
|
||||
// awaited are the artifact references mover m's steps wait for in p (§746, H-A-51): the From of each edge of a build kind
|
||||
// into m from another mover of p, toolchain edges first, each once. A toolchain edge (kind 3) from a build module whose
|
||||
// own new version is built from m is not awaited: what a build module's new version is built from is built by its
|
||||
// running version, never waited for (G §270, A-326), so the running build module builds m and the new one the rest.
|
||||
// running version, never waited for (G §270, A-326), so the running build module builds m and the new one the rest. A
|
||||
// mover that left p for a newer pipeline is not awaited either: m builds against the newest published package (H-A-53),
|
||||
// and its build ended superseded is no dependency that did not build (H-A-361).
|
||||
func awaited(p seat.Pipeline, m string, entries map[string]catalog.CatalogEntry) []catalog.Edge {
|
||||
var out []catalog.Edge
|
||||
for _, kind := range buildKinds {
|
||||
for _, x := range entries[m].Edges {
|
||||
from := moduleOf(x.From)
|
||||
if x.Kind != kind || from == m || !Moves(p, from) || slices.ContainsFunc(out, func(e catalog.Edge) bool { return e.From == x.From }) {
|
||||
if x.Kind != kind || from == m || !Moves(p, from) || slices.Contains(p.Superseded, from) ||
|
||||
slices.ContainsFunc(out, func(e catalog.Edge) bool { return e.From == x.From }) {
|
||||
continue
|
||||
}
|
||||
if kind == 3 && builtFrom(p, from, entries)[m] {
|
||||
|
||||
@@ -179,6 +179,65 @@ func TestAMoversBuildWaitsForItsDependenciesInThePipeline(t *testing.T) {
|
||||
if _, err := s2.Turn("main.7", view); err != nil || len(s2.publishedRead) != 0 {
|
||||
t.Errorf("after main.7's end %d answers are kept (%v), want none", len(s2.publishedRead), err)
|
||||
}
|
||||
|
||||
// H-A-361 (main.158 at 22:51, main.163 at 23:00 of 2026-11-21), H-A-53, H-A-223: a newer pipeline takes mesh-sdk and
|
||||
// builder, whose builds run, and web, not placed yet; app and tool, which awaited them, stay. They are placed and asked
|
||||
// at the hand-off, building against the newest published package, never ended not asked as if their dependency had
|
||||
// failed; web is not placed here; the journal says the hand-off and what stays; a later placing and the end judgement
|
||||
// leave the pipeline running until its kept steps end.
|
||||
t.Run("a hand-off places the kept movers that awaited a mover that left", func(t *testing.T) {
|
||||
web := entries["app"]
|
||||
web.Module, web.Edges = "web", []catalog.Edge{{From: "mesh-sdk:go", To: "web:program", Kind: 1}}
|
||||
entries["web"] = web
|
||||
mem := memStore{}
|
||||
s := &Starter{Pipelines: memCreated{mem}, Store: mem, Say: func(string, any) error { return nil }, Steps: &stepAsks{}, Name: "the-runner",
|
||||
Registration: func(string) (catalog.Registration, bool) { return reg, true }}
|
||||
ev := ev
|
||||
ev.Entries = append(slices.Clone(ev.Entries), catalog.TakeInEntry{Module: "web", Commit: "c4", Fingerprint: "src2:dd"})
|
||||
if n, err := s.TakenIn(ev, view); n != 1 || err != nil {
|
||||
t.Fatalf("the take-in started %d (%v)", n, err)
|
||||
}
|
||||
var journal []string
|
||||
h := &Hearer{Store: mem, Name: "the-runner", Say: func(string, any) error { return nil },
|
||||
Logf: func(f string, a ...any) { journal = append(journal, fmt.Sprintf(f, a...)) },
|
||||
Release: func(key string) { _, _ = s.Release(mem, key, view) }}
|
||||
h.SupersedeRunning(seat.Pipeline{Pipeline: "main.9", Branch: "main", Revision: 9, Movers: []seat.Mover{
|
||||
{Module: "mesh-sdk", Commit: "c5", Fingerprint: "src2:01"}, {Module: "builder", Commit: "c5", Fingerprint: "src2:b2"},
|
||||
{Module: "web", Commit: "c5", Fingerprint: "src2:d2"}}})
|
||||
check := func(when string) {
|
||||
p, _, _ := mem.Get("main.7")
|
||||
if p.Outcome != seat.PipelineOutcomeRunning {
|
||||
t.Fatalf("%s: main.7 = %s (%s), want running until its kept steps end", when, p.Outcome, p.Why)
|
||||
}
|
||||
for _, m := range []string{"app", "tool"} {
|
||||
st := stepsOf(p, m)
|
||||
if len(st) == 0 || st[0].Step != seat.StepResultStepBuild || st[0].Outcome != seat.StepResultOutcomeRunning || st[0].Ask == "" {
|
||||
t.Errorf("%s: %s's steps = %+v, want its build placed and asked", when, m, st)
|
||||
}
|
||||
}
|
||||
if st := stepsOf(p, "app"); len(st) > 0 && !strings.Contains(st[0].Why, "mesh-sdk") {
|
||||
t.Errorf("%s: app's build why %q does not say mesh-sdk was taken out (H-A-53)", when, st[0].Why)
|
||||
}
|
||||
if placed(p, "web") {
|
||||
t.Errorf("%s: web, which left, is placed in main.7: %+v", when, stepsOf(p, "web"))
|
||||
}
|
||||
}
|
||||
check("at the hand-off")
|
||||
if !slices.ContainsFunc(journal, func(l string) bool {
|
||||
return strings.Contains(l, "main.7: ") && strings.Contains(l, "leave it") && strings.Contains(l, "stay: app, tool")
|
||||
}) {
|
||||
t.Errorf("the journal %q does not say the hand-off and that app and tool stay", journal)
|
||||
}
|
||||
// A placing heard later (a publish, a step end) and the end judgement again: still running.
|
||||
if _, err := s.Release(mem, "main.7", view); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
p, rev, _ := mem.Get("main.7")
|
||||
if endPipeline(&p, time.Now(), nil) {
|
||||
_, _ = mem.Update("main.7", p, rev)
|
||||
}
|
||||
check("after a later placing and the end judgement")
|
||||
})
|
||||
}
|
||||
|
||||
// Design 47 G §270, A-326 (H §746, H-A-83 (2)): what a build module's new version is built from is built by its running
|
||||
|
||||
@@ -409,7 +409,8 @@ func (s *Starter) placeMovers(p *seat.Pipeline, reg func(module string) (catalog
|
||||
}
|
||||
all := entries
|
||||
for _, m := range p.Movers {
|
||||
if placed(*p, m.Module) {
|
||||
// A mover that left for a newer pipeline is placed there, never here (H-A-223, H-A-361).
|
||||
if placed(*p, m.Module) || slices.Contains(p.Superseded, m.Module) {
|
||||
continue
|
||||
}
|
||||
r, ok := reg(m.Module)
|
||||
@@ -1024,7 +1025,7 @@ func (s *Starter) Release(store Updater, key string, view func(branch string) (H
|
||||
return false
|
||||
}
|
||||
for _, m := range p.Movers {
|
||||
if !placed(p, m.Module) {
|
||||
if !placed(p, m.Module) && !slices.Contains(p.Superseded, m.Module) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,14 @@ func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
|
||||
h.logf("the running pipeline %s is not written, so its movers moved by %s stay: %v", key, newer.Pipeline, err)
|
||||
return false
|
||||
}
|
||||
h.logf("%s: %s moved by the newer %s leave it, %d of its open steps ended superseded (H-A-223)", key, strings.Join(moved, ", "), newer.Pipeline, len(ended))
|
||||
var stay []string
|
||||
for _, m := range p.Movers {
|
||||
if !slices.Contains(p.Superseded, m.Module) {
|
||||
stay = append(stay, m.Module)
|
||||
}
|
||||
}
|
||||
h.logf("%s: %s moved by the newer %s leave it, %d of its open steps ended superseded (H-A-223); %d stay: %s (H-A-361)", key,
|
||||
strings.Join(moved, ", "), newer.Pipeline, len(ended), len(stay), strings.Join(stay, ", "))
|
||||
for _, i := range ended {
|
||||
if err := h.say(seat.EventStepEnded, p, &p.Steps[i]); err != nil {
|
||||
h.logf("step-ended of %s's %s %s, superseded, is not said: %v", key, p.Steps[i].Module, p.Steps[i].Step, err)
|
||||
@@ -142,6 +149,11 @@ func (h *Hearer) supersedeRunningOne(key string, newer seat.Pipeline) bool {
|
||||
h.logf("%v", err)
|
||||
}
|
||||
h.appendUnlogged(key)
|
||||
// The movers that stay and waited on a mover that left are placed now, building against the newest published package
|
||||
// (H-A-53, H-A-361): no event of the mover that left comes to this pipeline again.
|
||||
if !done && h.Release != nil {
|
||||
h.Release(key)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user