Design 47 H1: the one chain (take-in, forge bridge, pipeline runner, assigner, teller, view, watchman, grants; checker gone) #263
@@ -185,8 +185,17 @@ func TestANewerWaitingPipelineSupersedesTheOlder(t *testing.T) {
|
||||
take(4, "app")
|
||||
take(5, "app", "lib")
|
||||
take(6, "app")
|
||||
if p, _, _ := mem.Get("main.5"); p.Outcome != seat.PipelineOutcomeWaiting || len(p.Movers) != 1 || p.Movers[0].Module != "lib" {
|
||||
t.Errorf("main.5 = %s moving %+v, want waiting with lib alone", p.Outcome, p.Movers)
|
||||
p5, _, _ := mem.Get("main.5")
|
||||
if p5.Outcome != seat.PipelineOutcomeWaiting || len(p5.Movers) != 1 || p5.Movers[0].Module != "lib" || !slices.Equal(p5.Superseded, []string{"app"}) {
|
||||
t.Errorf("main.5 = %s moving %+v, superseded %v; want waiting with lib alone, app superseded", p5.Outcome, p5.Movers, p5.Superseded)
|
||||
}
|
||||
// H-A-53, H-A-107: lib, building on app, which was taken out, is placed with its build's why saying so.
|
||||
reg, entries := placeFixture()
|
||||
entries["lib"] = catalog.CatalogEntry{Module: "lib", Artifacts: entries["app"].Artifacts, Edges: []catalog.Edge{{From: "app:program", To: "lib:program", Kind: 1}}}
|
||||
placing := p5
|
||||
s.placeMovers(&placing, func(string) (catalog.Registration, bool) { return reg, true }, entries, time.Unix(1, 0))
|
||||
if st := stepsOf(placing, "lib"); len(st) == 0 || st[0].Step != seat.StepResultStepBuild || !strings.Contains(st[0].Why, "app") || !strings.Contains(st[0].Why, "newest published") {
|
||||
t.Errorf("lib's build = %+v, want its why naming app superseded out", st)
|
||||
}
|
||||
if p, _, _ := mem.Get("main.4"); p.Outcome != seat.PipelineOutcomeRunning || !Moves(p, "app") {
|
||||
t.Errorf("the running main.4 = %s, want running to its end with app", p.Outcome)
|
||||
|
||||
@@ -334,6 +334,7 @@ func (s *Starter) placeMovers(p *seat.Pipeline, reg func(module string) (catalog
|
||||
continue
|
||||
}
|
||||
steps, a := Place(*p, m, r, entries, now, s.Name)
|
||||
supersededWhy(*p, m.Module, entries, steps)
|
||||
if failed != "" {
|
||||
why := "its dependency " + failed + " did not build"
|
||||
for k := range steps {
|
||||
|
||||
@@ -4,8 +4,10 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
@@ -90,6 +92,11 @@ func (s *Starter) supersedeOne(wkey, key string, newer seat.Pipeline) (bool, err
|
||||
gone := len(left) == 0
|
||||
now := s.now()
|
||||
s.logf("%s: %d of its movers are moved by the newer %s and leave it", key, len(p.Movers)-len(left), newer.Pipeline)
|
||||
for _, m := range p.Movers {
|
||||
if !Moves(seat.Pipeline{Movers: left}, m.Module) && !slices.Contains(p.Superseded, m.Module) {
|
||||
p.Superseded = append(p.Superseded, m.Module)
|
||||
}
|
||||
}
|
||||
p.Movers = left
|
||||
if gone {
|
||||
p.Outcome, p.Why, p.Ended = seat.PipelineOutcomeSuperseded, "every mover is moved by the newer "+newer.Pipeline, &now
|
||||
@@ -113,3 +120,23 @@ func (s *Starter) supersedeOne(wkey, key string, newer seat.Pipeline) (bool, err
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// supersededWhy writes, into mover module's build steps, that a dependency it builds on was taken out of p by a newer
|
||||
// pipeline, so it builds against the newest published package (design 47 H §748; H-A-53, H-A-107).
|
||||
func supersededWhy(p seat.Pipeline, module string, entries map[string]catalog.CatalogEntry, steps []seat.StepResult) {
|
||||
var deps []string
|
||||
for _, x := range entries[module].Edges {
|
||||
if from := moduleOf(x.From); slices.Contains(buildKinds, x.Kind) && from != module && slices.Contains(p.Superseded, from) && !slices.Contains(deps, from) {
|
||||
deps = append(deps, from)
|
||||
}
|
||||
}
|
||||
if len(deps) == 0 {
|
||||
return
|
||||
}
|
||||
why := "its dependency " + strings.Join(deps, ", ") + " was taken out of this pipeline by a newer one: it builds against the newest published package"
|
||||
for i := range steps {
|
||||
if steps[i].Step == seat.StepResultStepBuild {
|
||||
steps[i].Why = why
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user