H-A-337: a held module's owned paths are laid over the whole resolution's

Review of 94a2e6ed: composing the owned paths over the modules not held
changed which module owns a path by the rules between modules (a seat path
over a module's own tools, a seat path stepping back), so a hold's start
told /etc/resolv.conf to the uplink instead of the held resolver, and the
words changed once. The owned paths are now composed over the whole
resolution, less each entry a held module owns, with each running entry of
a held module where no entry left names its path.

Builds: design 47 H H-A-337, H-A-335, H-A-306 (3)
This commit is contained in:
2026-11-21 22:17:27 +01:00
parent 94a2e6ede0
commit b605449d47
2 changed files with 36 additions and 9 deletions
+25 -4
View File
@@ -326,7 +326,14 @@ func aHeldModulesShareOfTheHoldersWordsIsWhatRuns(t *testing.T) {
}
oldLamp, newLamp := lampAt("/var/lib/lamp/old/token", "/var/lib/lamp-old"), lampAt("/var/lib/lamp/new/token", "/var/lib/lamp-new")
ranPlaces := `["/var/lib/lamp/old","/var/lib/mesh-reads","/var/lib/mesh/node-tools"]`
ranOwned := `{"/var/lib/lamp-old":"lamp (its own tools)"}`
// The resolver, held, and the uplink: by the rules between modules the resolver's file is the resolver's (it steps
// back for node-resolver here), the uplink's only without the resolver (the review of 94a2e6ed).
resolver := catalogue.Manifest{Module: "resolver", Version: "1", Claims: []catalogue.Claim{{Name: catalogue.ResolverSeat}},
Resources: []map[string]any{{"id": "stub", "type": "file", "path": catalogue.ResolverFile, "content": "nameserver 127.0.0.53\n"}}}
uplink := catalogue.Manifest{Module: "uplink", Version: "1", Claims: []catalogue.Claim{{Name: "node-uplink"}},
Resources: []map[string]any{{"id": "resolv", "type": "file", "path": catalogue.ResolverFile, "content": "nameserver 192.0.2.1\n"}}}
resolverOwns := `"` + catalogue.ResolverFile + `":"resolver (` + catalogue.ResolverSeat + `)"`
ranOwned := `{"/var/lib/lamp-old":"lamp (its own tools)",` + resolverOwns + `}`
process := func(id, module string, words map[string]map[string]string) json.RawMessage {
body, _ := json.Marshal(words)
env, _ := json.Marshal(map[string]string{catalogue.RuntimeToolEnv: string(body)})
@@ -345,11 +352,14 @@ func aHeldModulesShareOfTheHoldersWordsIsWhatRuns(t *testing.T) {
stubs []catalogue.Manifest
// What lamp gives of the places and owned paths, and what it no longer gives.
wantPlace, gonePlace, wantOwned, goneOwned string
resolvers bool // the resolver held and the uplink beside lamp
}{
{"held, its stub differing pass by pass", true, []catalogue.Manifest{Stub(newLamp), Stub(catalogue.Manifest{Module: "lamp", Version: "1"})},
"/var/lib/lamp/old", "/var/lib/lamp/new", "/var/lib/lamp-old", "/var/lib/lamp-new"},
"/var/lib/lamp/old", "/var/lib/lamp/new", "/var/lib/lamp-old", "/var/lib/lamp-new", false},
{"answered, its build changed", false, []catalogue.Manifest{newLamp, newLamp},
"/var/lib/lamp/new", "/var/lib/lamp/old", "/var/lib/lamp-new", "/var/lib/lamp-old"},
"/var/lib/lamp/new", "/var/lib/lamp/old", "/var/lib/lamp-new", "/var/lib/lamp-old", false},
{"held, a path another module owns only without it", true, []catalogue.Manifest{Stub(newLamp), Stub(newLamp)},
"/var/lib/lamp/old", "/var/lib/lamp/new", "/var/lib/lamp-old", "/var/lib/lamp-new", true},
} {
in := aMesh(t)
in.Catalogue["node-tools"], in.Catalogue["artifacts"], in.Catalogue["mesh-reads"] = runtime, store, reads
@@ -361,13 +371,21 @@ func aHeldModulesShareOfTheHoldersWordsIsWhatRuns(t *testing.T) {
if row.held {
anchor.Held = map[string]bool{"lamp": true}
}
if row.resolvers {
in.Catalogue["resolver"], in.Catalogue["uplink"] = resolver, uplink
anchor.Assigned = append(anchor.Assigned, "resolver", "uplink")
anchor.Held["resolver"] = true
}
anchor.RunsRuntime, anchor.RunsRuntimes = RuntimeRunning(ran), RuntimesRunning(ran)
fps := map[string]string{overlay.Name: fpFor('a'), "artifacts": fpFor('5'), "node-tools": fpFor('e'),
"mesh-reads": fpFor('6'), "files": fpFor('7'), "lamp": fpFor('8')}
"mesh-reads": fpFor('6'), "files": fpFor('7'), "lamp": fpFor('8'), "resolver": fpFor('9'), "uplink": fpFor('b')}
digests := map[string][]string{}
said := map[string]string{}
for _, stub := range row.stubs {
anchor.Kept = map[string]catalogue.Manifest{"lamp": stub}
if row.resolvers {
anchor.Kept["resolver"] = Stub(resolver)
}
out, _, _, err := CompositionsIn(in, "anchor", fps, Foreseeing)
if err != nil {
t.Fatalf("%s: %v", row.name, err)
@@ -413,6 +431,9 @@ func aHeldModulesShareOfTheHoldersWordsIsWhatRuns(t *testing.T) {
t.Errorf("%s: %s are %s, want %s among them and not %s", row.name, what, words, want, gone)
}
}
if owned := said["node-tools.runtime owned"]; row.resolvers && !strings.Contains(owned, resolverOwns) {
t.Errorf("%s: the owned paths are %s, want %s among them", row.name, owned, resolverOwns)
}
if len(said) != 3 {
t.Errorf("%s: the holders are told %v", row.name, said)
}