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
41 lines
1.7 KiB
Go
41 lines
1.7 KiB
Go
package resolution
|
|
|
|
import (
|
|
"testing"
|
|
|
|
mcat "git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
// Replay of novox/hq issue 279 (2026-10-06): the media managers' recycle-bin folders were declared owned by
|
|
// a literal user and group, and on a machine whose puid and pgid settings named another account the apps
|
|
// refused them as not writable. A directory's owner could not follow the account its module runs as. Written
|
|
// only with what the catalogue had before its fix (mesh-controller #260): Compose, LeftOut, a setting layer,
|
|
// and the adoption tests' anchor, so it is laid over the commit before.
|
|
func TestReplay279(t *testing.T) {
|
|
r := anAdoptedAnchor()
|
|
r.Modules = append(r.Modules, mcat.Manifest{Module: "sonarr",
|
|
Resources: []map[string]any{
|
|
{"id": "recycle-bin", "type": "directory", "path": "/srv/sonarr/recycle", "mode": "0755",
|
|
"owner": "${setting:puid}:${setting:pgid}"},
|
|
{"id": "identity", "type": "file", "path": "/srv/sonarr/identity.env", "mode": "0644",
|
|
"content": "PUID=${setting:puid}\nPGID=${setting:pgid}\n"},
|
|
},
|
|
})
|
|
with := anchorRendering(false)
|
|
with.Settings["sonarr"] = []mcat.Layer{{From: "node anchor", Values: map[string]any{"puid": "1001", "pgid": "2000"}}}
|
|
composed, err := Compose(r, with)
|
|
if err != nil {
|
|
t.Fatalf("the machine did not compose: %v", err)
|
|
}
|
|
if why, left := composed.LeftOut["sonarr"]; left {
|
|
t.Fatalf("the module was left out: %s", why)
|
|
}
|
|
got, ok := byID(composed.Resources)["sonarr.recycle-bin"]
|
|
if !ok {
|
|
t.Fatal("the recycle bin was not declared")
|
|
}
|
|
if got["owner"] != "1001:2000" {
|
|
t.Fatalf("the recycle bin reaches the node-engine owned by %v, not the account the module runs as (1001:2000)", got["owner"])
|
|
}
|
|
}
|