Merge pull request 'The node-engine leaves a setting's word out when it rebuilds a running module's bundles (§781, H-A-477)' (#251) from fix/setting-words-not-own into main

This commit was merged in pull request #251.
This commit is contained in:
2026-11-22 14:37:51 +00:00
2 changed files with 18 additions and 5 deletions
+10 -5
View File
@@ -13,6 +13,7 @@ import (
engcomp "github.com/novox/mesh-host/internal/compositions"
"git.novox.be/novox/mesh-networking/modules/mesh-wireguard/go/overlay"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/declaration"
"github.com/novox/mesh-host/internal/compose/resolution"
@@ -399,9 +400,10 @@ func FilterRunning(running []engcomp.Composed) *string {
// ToolsRunning is, by module, the tools bundles that run on the node (Node.RunsTools): each bundle archive a module's
// resource unpacks at its BundlePath, with what the runtime's own process loads of it and the words it hands it
// (catalogue.RuntimeToolModules, catalogue.RuntimeToolEnv, the mesh's own words left out). A bundle the runtime loads
// nothing of has no Loads: the runtime dropped it, and the composition reads its loads again from the module's build
// (issue 1126, review: shanks had already applied the drop of systemd-resolved). Nil when running holds no runtime process.
// (catalogue.RuntimeToolModules, catalogue.RuntimeToolEnv, the mesh's own words left out, its setting words among them).
// A bundle the runtime loads nothing of has no Loads: the runtime dropped it, and the composition reads its loads again
// from the module's build (issue 1126, review: shanks had already applied the drop of systemd-resolved). Nil when
// running holds no runtime process.
func ToolsRunning(running []engcomp.Composed) map[string][]catalogue.Bundle {
type resource struct {
ID string `json:"id"`
@@ -454,8 +456,11 @@ func ToolsRunning(running []engcomp.Composed) map[string][]catalogue.Bundle {
}
var own map[string]string
for w, v := range words[module] {
if w == catalogue.FilesOwnedPaths || w == catalogue.ReadsSecretPlaces || w == engcomp.FingerprintVar {
continue // the mesh's to say, composed again (the fingerprint is the want's, §519)
if w == catalogue.FilesOwnedPaths || w == catalogue.ReadsSecretPlaces || w == engcomp.FingerprintVar ||
strings.HasPrefix(w, stdio.SettingWord("")) {
// The mesh's to say, composed again: the fingerprint is the want's (§519), a setting's word its setting's
// (design 47 H2 §781, H-A-477), never a value the engine composed before.
continue
}
if own == nil {
own = map[string]string{}
+8
View File
@@ -179,6 +179,14 @@ func TestCompositionsAreTheDeclarationSplitByModule(t *testing.T) {
n.RunsOwn = &engcomp.Composed{Node: "anchor", Resources: []json.RawMessage{json.RawMessage(lampRuns)}}
return *n.RunsOwn
}, map[string]string{}, true, "", "", ""},
// H-A-477: a setting's word the runtime runs with is the mesh's, composed again, never the bundle's own word.
{"folded, a setting's word it runs with is not its own", func(n *Node) engcomp.Composed {
n.InOwn = map[string]bool{"lamp": true}
n.RunsOwn = &engcomp.Composed{Node: "anchor", Resources: []json.RawMessage{json.RawMessage(lampRuns)}}
return *n.RunsOwn
}, map[string]string{}, false,
`"MESH_TOOL_MODULES":"` + served + `","MESH_TOOL_ENV":` + strconv.Quote(`{"lamp":{"LAMP_CONF":"/var/lib/lamp/conf","MESH_CONFIG_PUBLISH_TRIES":"8"}}`),
"", ""},
// H-A-306: a held module's slice is what runs of it, verbatim: no fingerprint of its want where none runs.
{"held, its new build not delivered", held, map[string]string{"lamp": fpFor('1')}, false, "",
served, `{"lamp":{"LAMP_CONF":"/var/lib/lamp/conf"}}`},