mesh-delivery-builder: a bound's end raises nothing for a reservation whose every artifact is published (issue 1984, review round 2)

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
This commit is contained in:
2026-11-23 18:47:14 +01:00
parent 83f858df7a
commit ee80b0be47
2 changed files with 20 additions and 2 deletions
@@ -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))
@@ -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)
}
})
}