From 026fb780d63f2c074998ae08dd68f1fc135a988d Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 02:18:31 +0100 Subject: [PATCH] R1-3: the waiting read names a seat's stream by mesh-sdk's one derivation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit seatStream derived the stream name itself and kept '.' where buscompose.SeatQueueStreamName writes '_'; QueueWaitingOf now calls buscompose (review round 1, finding 3, queue.go:34). Builds: design 47 H2 ยง777, H-A-410, P9 --- node-tools/internal/bus/queue.go | 10 ++++------ node-tools/internal/runtime/seat_traffic_test.go | 10 ++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/node-tools/internal/bus/queue.go b/node-tools/internal/bus/queue.go index bbd000f..1b700b3 100644 --- a/node-tools/internal/bus/queue.go +++ b/node-tools/internal/bus/queue.go @@ -8,6 +8,8 @@ import ( "time" "github.com/nats-io/nats.go/jetstream" + + "git.novox.be/novox/mesh-sdk/go/buscompose" ) // QueueWaitingMost is the most a waiting read holds, in its asks' ids and modules (design 47 H2 H-A-410). @@ -30,11 +32,6 @@ type QueueWaiting struct { Capped bool `json:"capped,omitempty"` } -// seatStream is the work-queue stream a seat's asks are kept on. -func seatStream(seat string) string { - return "SEAT_" + strings.ToUpper(strings.ReplaceAll(seat, "-", "_")) -} - // QueueWaitingOf reads, without consuming, the asks that wait on the seat's work queue for module, the holder whose // membership lists the queue's workers: its own store (ADR 0596). For each of its workers on the seat's stream, every message // after the worker's acknowledgement floor is read by a direct get by subject, never by a consumer of its own; one at or @@ -44,7 +41,8 @@ func (c *Conn) QueueWaitingOf(module, seat string) (QueueWaiting, error) { if err != nil { return QueueWaiting{}, err } - stream := seatStream(seat) + // The work-queue stream a seat's asks are kept on, by the one derivation every part takes (H-A-410, P9). + stream := buscompose.SeatQueueStreamName(seat) var workers []SeatWorker for _, w := range t.Workers { if w.Stream == stream { diff --git a/node-tools/internal/runtime/seat_traffic_test.go b/node-tools/internal/runtime/seat_traffic_test.go index f0c5c83..24f4980 100644 --- a/node-tools/internal/runtime/seat_traffic_test.go +++ b/node-tools/internal/runtime/seat_traffic_test.go @@ -222,9 +222,13 @@ func TestABundlePullsAndSettlesThroughItsModulesBus(t *testing.T) { } // Design 47 H2 H-A-410: the holder reads what waits on its own queue of the seat without consuming it (mesh/queue.waiting), // each ask with its id, the module that put it and its age; another module is refused, as is a seat it holds no queue of. - waiting := func(want string) { + waiting := func(want string, spelled ...string) { t.Helper() - raw, err := building.Seat("waiting", json.RawMessage(`{"seat":"node-build-go"}`), nil) + seat := "node-build-go" + if len(spelled) > 0 { + seat = spelled[0] + } + raw, err := building.Seat("waiting", json.RawMessage(`{"seat":"`+seat+`"}`), nil) var w bus.QueueWaiting if err != nil || json.Unmarshal(raw, &w) != nil || w.Capped { t.Fatalf("waiting = %s, %v", raw, err) @@ -274,4 +278,6 @@ func TestABundlePullsAndSettlesThroughItsModulesBus(t *testing.T) { t.Fatal(err) } waiting("mesh-delivery-pipeline:ask2:true:again") + // the seat's stream is the one mesh-sdk's buscompose names, '.' as '_' too (H-A-410, P9) + waiting("mesh-delivery-pipeline:ask2:true:again", "node-build.go") }