ADR 0593 §7: the composer with its refusals leaves mesh-sdk, so mesh-sdk carries no composition rule. The catalogue functions only the node-engine's composition reaches (Resolve, Resolution's Compose, Declaration, DataItems, LeftOut, Rules and the rest, the settings, placeholder and template refusals, the rendering helpers) are copied with their tests into internal/compose/resolution; a method of a mesh-sdk shape becomes a function taking it first. The composition calls its own copies, and the captured catalogue its tests read lives here now, shared by mesh-compose's tests. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
26 lines
974 B
Go
26 lines
974 B
Go
package resolution
|
|
|
|
import (
|
|
"testing"
|
|
|
|
mcat "git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
func aChannel(module, kind string) mcat.Manifest {
|
|
return mcat.Manifest{Module: module, Claims: []mcat.Claim{
|
|
{Name: "channel", Scope: mcat.ScopeMesh, Kind: kind}, {Name: "intake", Scope: mcat.ScopeMesh, Kind: kind}}}
|
|
}
|
|
|
|
// Two kinds on one machine are two holders, and one kind on two machines is a second claimant.
|
|
func TestEachKindIsItsOwnHolderWhenResolved(t *testing.T) {
|
|
modules := []mcat.Manifest{aChannel("telegram", "telegram"), aChannel("desk-channel", "desktop")}
|
|
held, problems := checkClaims(modules, mcat.Node{Name: "anchor"}, nil, nil)
|
|
if len(problems) > 0 || len(held) != 4 {
|
|
t.Fatalf("two kinds on one machine: held %v, problems %v", held, problems)
|
|
}
|
|
_, problems = checkClaims([]mcat.Manifest{aChannel("telegram", "telegram")}, mcat.Node{Name: "home"}, held, nil)
|
|
if len(problems) == 0 {
|
|
t.Fatal("one kind held on two machines was not refused")
|
|
}
|
|
}
|