assigner: find the node-engine's entry by its served verbs in the catalog's seat: form (composition could never run)

This commit is contained in:
2026-11-16 13:02:04 +01:00
parent 19758f44cf
commit c5799d2f9b
2 changed files with 28 additions and 1 deletions
@@ -378,7 +378,8 @@ func caseOf(half mcc.Half) (map[string]composer.Manifest, map[string]json.RawMes
func nodeEngineEntry(entries map[string]meshcatalog.CatalogEntry) (meshcatalog.CatalogEntry, bool) {
for _, name := range slices.Sorted(mapsKeys(entries)) {
for _, s := range entries[name].Serves {
if strings.HasPrefix(s, ne.Seat+".") {
// The catalog writes a served seat verb as `seat:<seat>.<verb>` (as the compose words above are made).
if strings.HasPrefix(strings.TrimPrefix(s, "seat:"), ne.Seat+".") {
return entries[name], true
}
}
@@ -0,0 +1,26 @@
package main
import (
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
)
// The module claiming the seat node-engine is found by its served verbs, in the catalog's form `seat:<seat>.<verb>`
// and in the bare form (live, 2026-11-16: every composition step said "holds no module claiming the seat node-engine").
func TestTheNodeEngineEntryIsFoundByItsServedVerbs(t *testing.T) {
for _, c := range []struct {
name string
serves []string
found bool
}{
{"the catalog's seat form", []string{"seat:node-engine.compose", "seat:node-engine.acts"}, true},
{"the bare form", []string{"node-engine.compose"}, true},
{"another seat", []string{"seat:node-engine-x.compose", "seat:mesh-wants.ask"}, false},
} {
e, ok := nodeEngineEntry(map[string]meshcatalog.CatalogEntry{"other": {Serves: []string{"seat:mesh-builds.ask"}}, "engine": {Serves: c.serves}})
if ok != c.found || (ok && e.Serves[0] != c.serves[0]) {
t.Errorf("%s: found %v (%v), want %v", c.name, ok, e.Serves, c.found)
}
}
}