From 40ad2650bdffd31fab1cefacd57081885ca482b2 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 01:22:52 +0100 Subject: [PATCH] A4: a want of no pipeline carries the newest source held for it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A placement's build or a put written after a delivery carried the kept graph's trunk source as its run, which can be older than the delivered want's, so the compare-and-set refused a person's act (the whole test of a placement back at a module's first build). The newest source the assigner holds for such a want is now the kept trunk source or the run of the want written, whichever is newer. Builds: design 47 H2 §813 (1); H-A-416 --- .../mesh-delivery-assigner/graphkept_test.go | 5 +++++ .../cmd/mesh-delivery-assigner/pass.go | 20 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) 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