From aef8b9c7cb99a02f0bee81b87a999038c4013486 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 4 Nov 2026 15:40:33 +0100 Subject: [PATCH] Join: mesh-config's whole test reads the subject the runtime publishes on from the manifest The seat definition names mesh-config's renamed, retiring and retired on its own stream (mesh.stream, A1c), and the runtime publishes an event the module's stream carries there; the test assumed EVENTS (mesh.mod) for every event and failed at the joined heads. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig --- .../cmd/mesh-config/whole_integration_test.go | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/modules/mesh-config/cmd/mesh-config/whole_integration_test.go b/modules/mesh-config/cmd/mesh-config/whole_integration_test.go index 75380dd7..c89b4d14 100644 --- a/modules/mesh-config/cmd/mesh-config/whole_integration_test.go +++ b/modules/mesh-config/cmd/mesh-config/whole_integration_test.go @@ -22,6 +22,7 @@ import ( "os" "os/exec" "path/filepath" + "slices" "strings" "sync" "testing" @@ -32,8 +33,10 @@ import ( "git.novox.be/novox/mesh-contracts/go/seats/meshconfig" oc "git.novox.be/novox/mesh-contracts/go/seats/operatorchannel" + "git.novox.be/novox/mesh-sdk/go/catalogue" "git.novox.be/novox/mesh-sdk/go/delivery" "git.novox.be/novox/mesh-sdk/go/health" + "git.novox.be/novox/mesh-sdk/go/process" "git.novox.be/novox/mesh-sdk/go/testbus" ) @@ -452,7 +455,13 @@ func (p *player) conforms(key string, into any, subject func(holder string) stri if err := dec.Decode(into); err != nil { p.t.Errorf("the published %s %s does not match the seat's definition: %v", key, s.Body, err) } - if got, want := "mesh.mod."+Module+".event."+s.Key, subject(Module); got != want { + // The runtime publishes an event its manifest's own stream carries on that stream (mesh.stream), any other on + // EVENTS (mesh.mod). + got := "mesh.mod." + Module + ".event." + s.Key + if streamCarries(p.t, s.Key) { + got = process.ModuleStreamSubject(Module, s.Key) + } + if want := subject(Module); got != want { p.t.Errorf("%s is published on %s, the definition names %s", key, got, want) } } @@ -788,3 +797,22 @@ func TestConfigWholeRenamesAndRetiresAgainstTheBus(t *testing.T) { p2.conforms(EventRetired, &meshconfig.RetiredHolderEvent{}, meshconfig.HolderSubjectRetired) eventually(t, "the retirement is dropped", func() bool { _, ok := p2.get(RetiringState, "radio.band"); return !ok }) } + +// streamCarries says whether the module's manifest names event among its own streams' events. +func streamCarries(t *testing.T, event string) bool { + t.Helper() + raw, err := os.ReadFile(filepath.Join("..", "..", "module.json")) + if err != nil { + t.Fatal(err) + } + m, err := catalogue.Decode(raw) + if err != nil { + t.Fatal(err) + } + for _, st := range m.Streams { + if slices.Contains(st.Events, event) { + return true + } + } + return false +}