E3: compose every setting as the word the one settings reader takes

A module's settings reached its own process only as files its manifest
named, and its tools bundles not at all. The node-engine now composes each
setting the module declares as MESH_CONFIG_<KEY>, its value as text, into
each of its processes' environments and its slice of the tool runner's
MESH_TOOL_ENV alike, and the tool runner's own into its process; the
runner's drain-bound is a Go duration like every time setting.

Builds: design 47 H2 §781; H-A-350 DMC-13, H-A-370, H-A-377
This commit is contained in:
2026-11-22 00:09:04 +01:00
parent 84fc34398a
commit b33061088a
5 changed files with 152 additions and 35 deletions
@@ -1,6 +1,7 @@
package resolution
import (
"fmt"
"strings"
"testing"
@@ -64,7 +65,10 @@ func theNodeOverTheMeshOverTheDefault(t *testing.T) {
// layer overrides it.
func TestAComposedMachineGetsTheDefaultAndTheNodesValue(t *testing.T) {
r := anAdoptedAnchor()
r.Modules = append(r.Modules, notifier())
n := notifier()
n.Resources = append(n.Resources, map[string]any{"id": "daemon", "type": "process", "name": "notifier",
"run": []any{"/usr/bin/notifier"}, "env": map[string]any{"LANG": "C"}})
r.Modules = append(r.Modules, n)
with := anchorRendering(false)
composed, err := Compose(r, with)
if err != nil {
@@ -83,6 +87,17 @@ func TestAComposedMachineGetsTheDefaultAndTheNodesValue(t *testing.T) {
if c := byID(composed.Resources)["notifier.configuration"]["content"]; c != "font = Inter 13\nwidth = 250\n" {
t.Fatalf("composed with the node's font size as %q", c)
}
// Design 47 H2 §781, H-A-370: and each setting it declares reaches its process as the word the one settings reader
// takes it from, the value as text, beside the process's own words; one its own words give otherwise is refused.
env := fmt.Sprint(byID(composed.Resources)["notifier.daemon"]["env"])
if env != "map[LANG:C MESH_CONFIG_FONT_SIZE:13 MESH_CONFIG_WIDTH:250]" {
t.Errorf("the notifier's process is given %s", env)
}
n.Resources[1]["env"] = map[string]any{"MESH_CONFIG_WIDTH": "9"}
r.Modules[len(r.Modules)-1] = n
if _, err = Compose(r, with); err == nil || !strings.Contains(err.Error(), "MESH_CONFIG_WIDTH") {
t.Errorf("a process whose own word is its setting's composed: %v", err)
}
}
// A default fills ${setting:…} only: it never becomes a key of a mergeable file (issue 168).