From df2162e381f5c192884e81dbb49de782ac6ca9da Mon Sep 17 00:00:00 2001 From: jochens Date: Fri, 13 Nov 2026 01:52:15 +0100 Subject: [PATCH] tool runner: mesh/stream.publish is the capability stream-publish, taken out of bus-state-calls (A-44) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 42 zfs-owns-zfs ยง25, lead answer A-44 --- node-tools/internal/runtime/announce_test.go | 2 +- node-tools/internal/runtime/busstate.go | 5 ++++- node-tools/internal/runtime/ledgers_test.go | 2 +- node-tools/internal/runtime/stream_publish_test.go | 11 +++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/node-tools/internal/runtime/announce_test.go b/node-tools/internal/runtime/announce_test.go index 6965fea..2896130 100644 --- a/node-tools/internal/runtime/announce_test.go +++ b/node-tools/internal/runtime/announce_test.go @@ -139,7 +139,7 @@ func TestTheRunnerStatesTheCapabilitiesOfItsCallsInItsPing(t *testing.T) { t.Fatalf("ping of the instance: %v", err) } var ping micro.Ping - if err := json.Unmarshal(msg.Data, &ping); err != nil || ping.Metadata[announce.Capabilities] != "bus-state-calls,ledger-calls,seat-settle-delay" { + if err := json.Unmarshal(msg.Data, &ping); err != nil || ping.Metadata[announce.Capabilities] != "bus-state-calls,ledger-calls,seat-settle-delay,stream-publish" { t.Errorf("the runner states %q (%v), want its bus-state and ledger calls", ping.Metadata[announce.Capabilities], err) } } diff --git a/node-tools/internal/runtime/busstate.go b/node-tools/internal/runtime/busstate.go index 624f13e..fd43409 100644 --- a/node-tools/internal/runtime/busstate.go +++ b/node-tools/internal/runtime/busstate.go @@ -16,12 +16,15 @@ import ( const ( CapBusStateCalls = "bus-state-calls" CapLedgerCalls = "ledger-calls" + // CapStreamPublish is the call that says an event on the module's own bound stream (A-44). + CapStreamPublish = "stream-publish" ) // callFamilies are the methods each capability stands for, the ones BusState and BusStateWatch answer. var callFamilies = map[string][]string{ CapBusStateCalls: {buscalls.ObjectsPut, buscalls.ObjectsGet, buscalls.ObjectsList, buscalls.ObjectsDelete, buscalls.ObjectsInfo, - buscalls.ObjectsWatch, buscalls.StreamRead, buscalls.StreamFill, buscalls.StreamPublish, buscalls.WorkQueueSize, buscalls.WorkQueueDead}, + buscalls.ObjectsWatch, buscalls.StreamRead, buscalls.StreamFill, buscalls.WorkQueueSize, buscalls.WorkQueueDead}, + CapStreamPublish: {buscalls.StreamPublish}, CapLedgerCalls: {buscalls.LedgerApply, buscalls.LedgerGet, buscalls.LedgerHistory, buscalls.LedgerWatch, buscalls.LedgerQuery, buscalls.LedgerRebuild, buscalls.LedgerReindex, buscalls.LedgerSnapshot, buscalls.LedgerLag}, } diff --git a/node-tools/internal/runtime/ledgers_test.go b/node-tools/internal/runtime/ledgers_test.go index 805984a..23bf5fb 100644 --- a/node-tools/internal/runtime/ledgers_test.go +++ b/node-tools/internal/runtime/ledgers_test.go @@ -204,7 +204,7 @@ func TestABundleToolNamedAsALedgerRepairIsRefused(t *testing.T) { // no other name; none answers "the runtime answers no ...". func TestEveryCallOfAStatedCapabilityIsAnswered(t *testing.T) { m, _, _ := aLedger(t) - if got := strings.Join(CallCapabilities(), ","); got != "bus-state-calls,ledger-calls,seat-settle-delay" { + if got := strings.Join(CallCapabilities(), ","); got != "bus-state-calls,ledger-calls,seat-settle-delay,stream-publish" { t.Fatalf("the runner states %s", got) } for capability, methods := range callFamilies { diff --git a/node-tools/internal/runtime/stream_publish_test.go b/node-tools/internal/runtime/stream_publish_test.go index 130c566..0bc66ff 100644 --- a/node-tools/internal/runtime/stream_publish_test.go +++ b/node-tools/internal/runtime/stream_publish_test.go @@ -7,9 +7,12 @@ import ( "git.novox.be/novox/mesh-sdk/go/buscalls" ) -// A-42: mesh/stream.publish is part of the bus-state-calls capability a module's manifest asks for. -func TestStreamPublishIsPartOfTheBusStateCallsCapability(t *testing.T) { - if !slices.Contains(callFamilies[CapBusStateCalls], buscalls.StreamPublish) { - t.Fatal("bus-state-calls does not state mesh/stream.publish") +// A-44: mesh/stream.publish is a family of its own, the capability stream-publish, and no longer of bus-state-calls. +func TestStreamPublishIsACapabilityOfItsOwn(t *testing.T) { + if !slices.Equal(callFamilies[CapStreamPublish], []string{buscalls.StreamPublish}) || CapStreamPublish != "stream-publish" { + t.Fatal("stream-publish does not state only mesh/stream.publish") + } + if slices.Contains(callFamilies[CapBusStateCalls], buscalls.StreamPublish) { + t.Fatal("bus-state-calls still states mesh/stream.publish") } }