From f3c35722d913625e5003730e29729085fc117f08 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 05:48:49 +0100 Subject: [PATCH] AM-D2: the grants part's own copy of the wire pattern goes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A reader turns a stream's events into the bus's subjects with mesh-sdk's buscompose.WirePattern; the grants part's copy goes. The catalog graph entry already carries the validated manifest whole, its needs-approval, emits and streams with their grant among it (design 47 G §443). Builds: design 46 7-approval-mark §5 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- .../mesh-grants/internal/buscompose/modstreams.go | 13 +------------ modules/mesh-grants/internal/grants/records.go | 5 +++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/modules/mesh-grants/internal/buscompose/modstreams.go b/modules/mesh-grants/internal/buscompose/modstreams.go index 0c724157..94805b01 100644 --- a/modules/mesh-grants/internal/buscompose/modstreams.go +++ b/modules/mesh-grants/internal/buscompose/modstreams.go @@ -29,23 +29,12 @@ func ModuleStreamSubject(module, event string) string { // OnAModuleStream says a subject is one a module's own stream takes. func OnAModuleStream(subject string) bool { return strings.HasPrefix(subject, moduleStreamPrefix) } -// WirePattern is a local event pattern as the bus spells it: `**` is `>`. -func WirePattern(local string) string { - parts := strings.Split(local, ".") - for i, p := range parts { - if p == "**" { - parts[i] = ">" - } - } - return strings.Join(parts, ".") -} - // A ModuleStream is one module's declared stream as the bus holds it. type ModuleStream struct { Module string // Name is its name on the bus, `MAIL`. Name string - // Events are the events it carries, as the bus spells them (WirePattern). + // Events are the events it carries, as the bus spells them (mesh-sdk buscompose.WirePattern). Events []string MaxAgeDays int MaxMiB int diff --git a/modules/mesh-grants/internal/grants/records.go b/modules/mesh-grants/internal/grants/records.go index 724d063b..1442daf8 100644 --- a/modules/mesh-grants/internal/grants/records.go +++ b/modules/mesh-grants/internal/grants/records.go @@ -3,6 +3,7 @@ package grants import ( "fmt" "git.novox.be/novox/mesh-contracts/go/seats/meshbroker" + sdkbc "git.novox.be/novox/mesh-sdk/go/buscompose" "maps" "reflect" "slices" @@ -409,7 +410,7 @@ func streamsOf(m catalogue.Manifest) []buscompose.ModuleStream { for _, s := range m.Streams { events := make([]string, 0, len(s.Events)) for _, e := range s.Events { - events = append(events, buscompose.WirePattern(e)) + events = append(events, sdkbc.WirePattern(e)) } out = append(out, buscompose.ModuleStream{Module: m.Module, Name: s.BusName(), Events: events, MaxAgeDays: s.Days(), MaxMiB: s.Cap(), Restricted: s.Grant != nil, @@ -491,7 +492,7 @@ func hearsOf(m catalogue.Manifest, declared map[string]catalogue.Manifest, node for _, p := range parts { h := buscompose.Heard{Stream: p.Stream.BusName(), Emitter: p.Emitter, Restricted: p.Stream.Grant != nil} for _, pattern := range p.Patterns { - h.Filters = append(h.Filters, buscompose.ModuleStreamSubject(p.Emitter, buscompose.WirePattern(pattern))) + h.Filters = append(h.Filters, buscompose.ModuleStreamSubject(p.Emitter, sdkbc.WirePattern(pattern))) } out = append(out, h) }