A folded module owns its manifest's paths, as the controller tells node-files them, not every path it runs at (issue 1126, seed-8: f1-circuits, snake and txt-game shifted node-tools' owned paths on ace)

This commit is contained in:
2026-10-28 14:07:59 +01:00
parent 06742d0448
commit eda82b1598
6 changed files with 149 additions and 28 deletions
+16 -13
View File
@@ -263,6 +263,10 @@ func NamesBuild(m catalogue.Manifest) bool {
// and nothing else of its own is composed (issue 1126: nats's ${dir:mesh-state} on novox). A module refused in a
// node's answer is composed so; a folded one the node runs is Carried.
func Stub(m catalogue.Manifest) catalogue.Manifest {
// The paths it owns stay its manifest's, as the controller tells the holder of node-files them (issue 1126, seed-8).
if m.OwnsPaths == nil {
m.OwnsPaths = catalogue.DeclaredPaths(m)
}
m.Build = nil
var dirs []map[string]any
for _, r := range m.Resources {
@@ -276,19 +280,21 @@ func Stub(m catalogue.Manifest) catalogue.Manifest {
// Carried is m, folded into its node's own composition at a build of the old form, as the node runs it (issue 1126,
// C5): nothing to build; its containers and directories those the node's own composition (runs) carries of it, their
// module's word taken off their ids, with the manifest's directories it does not run; and the path of every resource it
// runs (catalogue.Manifest.RunsAt). So what other modules read of it is what runs: the machine ports its containers
// publish (the filter's rules, the routes reaching it: MachineSide) and the paths it owns (the holder of node-files is
// told them). Its other resources are not taken, since the composition makes some of them again from its manifest (its
// secrets' files) and one id twice is refused; none of them is composed into what is applied either way (compositions
// leaves a carried module's out, and carries the ones that run). What it provides, requires, listens on and grants is
// its manifest's. A module whose resources runs holds none of is its Stub, as before.
// module's word taken off their ids, with the manifest's directories it does not run. So what other modules read of it
// is what runs: the machine ports its containers publish (the filter's rules, the routes reaching it: MachineSide). The
// paths it owns, which the holder of node-files is told, are its manifest's, as for its Stub: the controller composes
// them from the manifest, not from every path a resource of it runs at (issue 1126, seed-8: f1-circuits, snake and
// txt-game on ace, whose manifests leave their directories to the mesh). Its other resources are not taken, since the
// composition makes some of them again from its manifest (its secrets' files) and one id twice is refused; none of them
// is composed into what is applied either way (compositions leaves a carried module's out, and carries the ones that
// run). What it provides, requires, listens on and grants is its manifest's. A module whose resources runs holds none
// of is its Stub, as before.
func Carried(m catalogue.Manifest, module string, runs *delivery.Composed) catalogue.Manifest {
if runs == nil {
return Stub(m)
}
var taken []map[string]any
var at []string
runsAny := false
ids := map[string]bool{}
for _, raw := range runs.Resources {
var r map[string]any
@@ -303,9 +309,7 @@ func Carried(m catalogue.Manifest, module string, runs *delivery.Composed) catal
if owner != module {
continue
}
if p, ok := r["path"].(string); ok && p != "" {
at = append(at, p)
}
runsAny = true
if typ := r["type"]; typ != "container" && typ != "directory" {
continue
}
@@ -314,7 +318,7 @@ func Carried(m catalogue.Manifest, module string, runs *delivery.Composed) catal
ids[r["id"].(string)] = true
taken = append(taken, r)
}
if len(at) == 0 && len(taken) == 0 {
if !runsAny {
return Stub(m)
}
stub := Stub(m)
@@ -324,7 +328,6 @@ func Carried(m catalogue.Manifest, module string, runs *delivery.Composed) catal
}
}
stub.Resources = taken
stub.RunsAt = at
return stub
}