AM-D2: the grants part's own copy of the wire pattern goes

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
This commit is contained in:
2026-11-12 05:48:49 +01:00
parent 58e4a737d5
commit f3c35722d9
2 changed files with 4 additions and 14 deletions
@@ -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
@@ -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)
}