diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/graphkept_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/graphkept_test.go index 857622492..fdf8d4fd0 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/graphkept_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/graphkept_test.go @@ -118,6 +118,11 @@ func TestTheWantsAreSaidWantedFromTheKeptAssignmentGraphRevision(t *testing.T) { if w, _ := mwc.DecodeWant(kv.values[skey]); w.Run != "9" { t.Errorf("a put's want is %+v, want the newest source held, 9", w) } + // a placement's build after the delivery of run 12: the newest source held for it is the want's own, never refused + p.putWant(ctx, "g14", "db", mwc.Want{Fp: fpTest, Version: "0.1.0"}) + if w := stored(); w.Run != "12" || w.Version != "0.1.0" { + t.Errorf("a placement's want after run 12 is %+v, want it written at run 12", w) + } }) // A-201, A-235: a run's candidate catalog revision, read whole through the seat's verb revision, keeps the run's assignment diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go index 9141378d0..fcd40fdf1 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go @@ -314,19 +314,27 @@ func (p *passer) putWant(ctx context.Context, node, module string, want mwc.Want // runOf is the run a want carries (design 47 H2 ยง813 (1); H-A-355 (1), H-A-416): the source revision of the pipeline that // released it, `.`, in decimal; for a want of no pipeline (a put, a placement's build, a removal) the newest -// source the assigner holds, the trunk's source of its kept assignment graph revision; "" when it holds none. -func (p *passer) runOf(want mwc.Want) string { +// source the assigner holds for it: the trunk's source of its kept assignment graph revision, or the run of the want written +// (held) when that is newer, so a person's put or placement after a delivery is never refused as older; "" when it holds none. +func (p *passer) runOf(want mwc.Want, held *mwc.Want) string { if i := strings.LastIndexByte(want.Pipeline, '.'); i >= 0 { if n, err := strconv.ParseInt(want.Pipeline[i+1:], 10, 64); err == nil && n > 0 { return strconv.FormatInt(n, 10) } } + var newest int64 if p.graph != nil { - if _, source, ok := p.graph.keptNow(); ok && source > 0 { - return strconv.FormatInt(source, 10) + if _, source, ok := p.graph.keptNow(); ok { + newest = source } } - return "" + if held != nil { + newest = max(newest, runNumber(held.Run)) + } + if newest <= 0 { + return "" + } + return strconv.FormatInt(newest, 10) } // runNumber is a want's run as a number, 0 for none. @@ -345,7 +353,7 @@ func (p *passer) wantWritten(ctx context.Context, node, module, key string, want held = &h } } - want.Run = p.runOf(want) + want.Run = p.runOf(want, held) if held != nil { same := *held same.Run = want.Run