H2 owner-pass-with-units-stopped: the module's units and processes stop before the owner pass and start after it

Builds: design 47 H2 H-A-579 (1), H-A-602 (the pass back), H-A-641 (hq 6b8373ce), H-A-701 (hq 95cf2052)
This commit is contained in:
2026-11-25 17:09:52 +01:00
parent 204cd51e4b
commit 9c40b4a3fb
5 changed files with 179 additions and 5 deletions
+11 -1
View File
@@ -7,6 +7,7 @@ import (
"strings"
"git.novox.be/novox/mesh-sdk/go/declaration"
"github.com/novox/mesh-host/internal/compose/resolution"
"github.com/novox/mesh-host/internal/store"
"github.com/novox/mesh-host/internal/system"
)
@@ -14,7 +15,9 @@ import (
// StopModule stops the units and containers the node's record holds for a module and removes nothing: no unit, file,
// container, data or record, so what the module kept survives and a later Apply starts the build it is given (design 47
// G A-98, §297). Units come first, a timer before the service it starts, then containers; a unit the mesh never held
// (Stateless) is left as it is. It answers what it stopped, and the first failure.
// (Stateless) is left as it is. The module's processes are stopped with them (design 47 H2, H-A-641): the timer and the
// service of each, but never the tool runner's own process, which serves every other module's bundles. It answers what it
// stopped, and the first failure.
func StopModule(ctx context.Context, sys system.System, known store.State, module string, run Runner) ([]string, error) {
var timers, services, containers []store.Applied
for _, r := range known.Resources {
@@ -33,6 +36,13 @@ func StopModule(ctx context.Context, sys system.System, known store.State, modul
}
case string(declaration.TypeContainer):
containers = append(containers, r)
case string(declaration.TypeProcess):
// The tool runner is never stopped, whichever module's owner pass asks (H-A-641).
if strings.HasSuffix(r.ID, "."+resolution.RuntimeProcessID()) {
continue
}
timers = append(timers, store.Applied{ID: r.ID, Type: string(declaration.TypeService), Target: r.Target + ".timer"})
services = append(services, store.Applied{ID: r.ID, Type: string(declaration.TypeService), Target: r.Target + ".service"})
}
}
var stopped []string