From 4dcb3a44abf17281917a063e17c738ed90513195 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 5 Nov 2026 16:20:53 +0100 Subject: [PATCH] grants part, indexer and checker read the seat list again through the sdk's ReloadIfUnread; the checker's hub binds a late consumer (B9e; issue 1966) Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i --- .../cmd/mesh-delivery-checker/main.go | 10 ++++------ .../cmd/mesh-delivery-checker/seatlist.go | 5 ++--- .../cmd/mesh-delivery-indexer/seatlist.go | 4 +--- modules/mesh-grants/cmd/mesh-grants/seatlist.go | 6 ++---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/main.go b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/main.go index c819ad4b..a102ee90 100644 --- a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/main.go +++ b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/main.go @@ -461,12 +461,10 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro return nil } reader.Start(ctx, js, cred, process.AwaitBucket(ctx, js, conn, firstViewsBucket, "checker_first_views reads nothing and checker_first_view_again is not heard", logger.Printf)) - // Every part has registered. Where the consumer is not there yet no package registry's published is heard and a group's - // check fails at its publish bound until the checker starts again. - if err := hub.Start(ctx, js, cred); err != nil { - logger.Printf("%v, so no package registry's published is heard and a group's check fails at its publish bound until the checker starts again", err) - } else { - readIfUnread(seats.reader) + // Every part has registered. Where the consumer is not there yet the hub binds it as soon as it is, and the seat list is read + // again then if it is still unread. + if err := hub.StartUntilBound(ctx, js, cred, nil, func() { readIfUnread(seats.reader) }); err != nil { + logger.Printf("%v, so no package registry's published is heard until the consumer is there; the checker tries again", err) } defer hub.Stop() // The checks, the tries and the hand asks, once every first view is answered (the lead's ruling for DLV-M2): a check diff --git a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/seatlist.go b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/seatlist.go index 313d2d6d..73daac8f 100644 --- a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/seatlist.go +++ b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/seatlist.go @@ -54,8 +54,7 @@ func (s seatList) Definitions() ([]json.RawMessage, error) { // checker's consumer existed, whose events start at the stream's end: the first read found it silent and nothing else reads // again until its next event, so while the list is unread it is read now, on a goroutine of its own (ADR 0636 §1). func readIfUnread(reader *seatlist.Reader) { - if reader == nil || reader.Status().Heard { - return + if reader != nil { + reader.ReloadIfUnread() } - go func() { _ = reader.Reload() }() } diff --git a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/seatlist.go b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/seatlist.go index 508c0cac..e8341b9b 100644 --- a/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/seatlist.go +++ b/modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/seatlist.go @@ -142,9 +142,7 @@ func readWhenBound(reader *seatlist.Reader, states ...bucket) { } for _, state := range states { state.Ready(func(jetstream.KeyValue) { - if !reader.Status().Heard { - go func() { _ = reader.Reload() }() - } + reader.ReloadIfUnread() }) } } diff --git a/modules/mesh-grants/cmd/mesh-grants/seatlist.go b/modules/mesh-grants/cmd/mesh-grants/seatlist.go index 8d0c50a7..da8d824b 100644 --- a/modules/mesh-grants/cmd/mesh-grants/seatlist.go +++ b/modules/mesh-grants/cmd/mesh-grants/seatlist.go @@ -54,11 +54,9 @@ func (g *seatGate) follow(bus seatlist.Bus, changed func(), logf func(string, .. // part reads it now (ADR 0636 §1), on a goroutine of its own so the pass is not held; the reader changes the catalogue and wakes // the part when the seat answers, and stays unread, to be read at the seat's next event, when it does not. func (g *seatGate) eventsLive() { - r := g.reader.Load() - if r == nil || r.Status().Heard { - return + if r := g.reader.Load(); r != nil { + r.ReloadIfUnread() } - go func() { _ = r.Reload() }() } // tools are the two tools over whatever reader the gate holds at the call.