From ee80b0be4782ee4ee0f6f50f19d20bb42b4c06e3 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 23 Nov 2026 18:47:14 +0100 Subject: [PATCH] mesh-delivery-builder: a bound's end raises nothing for a reservation whose every artifact is published (issue 1984, review round 2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bound's end (ended) raised version-unreleased for a built reservation whose every artifact was published, saying "an artifact is unpublished", while arm past the bound leaves that reservation waiting for its version-released. 1984/AC5 raises only for a built reservation left unmarked past its bound, so ended now raises nothing when no artifact is missing. Builds: issue 1984 note 8 (1984/AC5), design 47 G ยง369 --- .../cmd/mesh-delivery-builder/reserve.go | 6 ++++-- .../cmd/mesh-delivery-builder/reserve_test.go | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve.go b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve.go index 46f804285..16d5eff87 100644 --- a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve.go +++ b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve.go @@ -314,7 +314,9 @@ func (rv *reservations) unreleasedWords(ctx context.Context, v versions.Reserved } // ended is told each change of the state bounds: a reservation's bound whose time ended raises version-unreleased while -// the reservation stands built (lapsed: a standing one keeps its words). +// the reservation stands built with an artifact unpublished (lapsed: a standing one keeps its words); one with every artifact +// published is not left unmarked (issue 1984 note 8, 1984/AC5) and waits for its version-released, as arm leaves it past the +// bound. func (rv *reservations) ended(ctx context.Context, e jetstream.KeyValueEntry) bool { key, ok := versions.ReservedBoundOf(e.Key()) if !ok { @@ -324,7 +326,7 @@ func (rv *reservations) ended(ctx context.Context, e jetstream.KeyValueEntry) bo return true } v, found, err := rv.r.At(ctx, key) - if err != nil || !found || v.BuiltAt.IsZero() { + if err != nil || !found || v.BuiltAt.IsZero() || len(v.Missing()) == 0 { return true } rv.lapsed(ctx, v, fmt.Sprintf("nothing within %s of its build", rv.bound)) diff --git a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve_test.go b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve_test.go index 23162f468..456d21c62 100644 --- a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve_test.go +++ b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve_test.go @@ -576,6 +576,22 @@ func TestABuiltReservationIsTakenInFromItsState(t *testing.T) { if got := unreleased("ends"); !strings.Contains(got, "ends:b unpublished") || !strings.Contains(got, "nothing within") { t.Errorf("at the bound's end with none standing, version-unreleased reads %q, want nothing within naming ends:b", got) } + // One whose every artifact is published is not left unmarked (1984/AC5): its bound's end raises nothing, and it waits for + // its version-released. + all := recordedLost("endsall", now.Add(-time.Minute), "a", "b") + if err := rv.Built(ctx, "endsall", all.Version, all.Artifacts, nil); err != nil { + t.Fatal(err) + } + if cur, _, _ := rv.r.Of(ctx, "endsall", all.Version); len(cur.Missing()) != 0 { + t.Fatalf("endsall: %v unpublished after the take-in, want every artifact published", cur.Missing()) + } + rv.ended(ctx, purged{key: versions.ReservedBoundKey("endsall", "0.1")}) + if got := unreleased("endsall"); got != "" { + t.Errorf("at the bound's end, a reservation whose every artifact is published raised %q, want no version-unreleased", got) + } + if cur, found, _ := rv.r.Of(ctx, "endsall", all.Version); !found || cur.BuiltAt.IsZero() { + t.Errorf("at the bound's end, the reservation of endsall %s stands no more, want it waiting for its version-released", all.Version) + } }) }