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
33 lines
1.3 KiB
Go
33 lines
1.3 KiB
Go
package resolution
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestReflectsRenamedReadsBothShapes(t *testing.T) {
|
|
// The list arrives as []any when the resource was parsed from JSON, and as []string when it
|
|
// was composed in code — the overlay's registry trust is the second kind. A shape that was
|
|
// skipped would leave the reference unprefixed, pointing at nothing, and the service would
|
|
// never restart while every check passed (novox/hq issues 042/048, the run-8 diagnosis).
|
|
parsed := reflectsRenamed("mesh-wireguard", []any{"registry-trust"})
|
|
if !reflect.DeepEqual(parsed, []any{"mesh-wireguard.registry-trust"}) {
|
|
t.Fatalf("parsed shape: %v", parsed)
|
|
}
|
|
composed := reflectsRenamed("mesh-wireguard", []string{"registry-trust"})
|
|
if !reflect.DeepEqual(composed, []any{"mesh-wireguard.registry-trust"}) {
|
|
t.Fatalf("composed shape: %v", composed)
|
|
}
|
|
|
|
// A name already under a module keeps it: that is how a service reflects a file another
|
|
// module put on the machine.
|
|
kept := reflectsRenamed("resolver", []string{"mesh-wireguard.fact-node-names", "own-config"})
|
|
if !reflect.DeepEqual(kept, []any{"mesh-wireguard.fact-node-names", "resolver.own-config"}) {
|
|
t.Fatalf("dotted name was not kept: %v", kept)
|
|
}
|
|
|
|
if got := reflectsRenamed("any", nil); got != nil {
|
|
t.Fatalf("no list should rename to nothing, got %v", got)
|
|
}
|
|
}
|