A seat definition's events of the seat list, and mesh-sdk's four finding events (views.FindingSubjects), so a `*` emitter before one reaches each declaring module's own stream; any other `*` entry stays the shared stream's. Builds: design 47 G §386, §474, §644 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
28 lines
1.3 KiB
Go
28 lines
1.3 KiB
Go
package grants
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
// Design 47 G §386, §474, §644: a `*` emitter before one of mesh-sdk's finding events reaches each declaring module's own
|
|
// stream, with no seat list read; one before an event no definition names stays the shared stream's.
|
|
func TestAStarEmitterBeforeAFindingEventReachesEachDeclaringStream(t *testing.T) {
|
|
shelf := map[string]catalogue.Manifest{
|
|
"a": {Module: "a", Streams: []catalogue.StreamDeclaration{{Name: "a-findings", Events: []string{"finding-written"}}}},
|
|
"b": {Module: "b", Streams: []catalogue.StreamDeclaration{{Name: "b-usage", Events: []string{"usage"}}}},
|
|
}
|
|
none := func(string, string) []any { return nil }
|
|
defined := func(e string) bool { return definedEventsOf(nil)[e] }
|
|
keeper := catalogue.Manifest{Module: "keeper", Consumes: []string{"*.finding-written", "*.usage"}}
|
|
hears, touches, onEvents := hearsOf(keeper, shelf, "ace", none, keeper.Consumes, defined)
|
|
if !touches || len(hears) != 1 || hears[0].Emitter != "a" || !slices.Equal(onEvents, []string{"*.finding-written", "*.usage"}) {
|
|
t.Fatalf("heard %+v (touches %v, on EVENTS %v)", hears, touches, onEvents)
|
|
}
|
|
if hears, _, _ := hearsOf(keeper, shelf, "ace", none, keeper.Consumes, nil); len(hears) != 0 {
|
|
t.Fatalf("with no event defined, heard %+v", hears)
|
|
}
|
|
}
|