Start again on removal what the mesh's own declaration stopped (hq ADR 0269)
mesh/merge-gate pass: builds mesh-host → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery superseded: a newer head of the same pull request

A unit found running and enabled that a declaration held stopped and disabled stayed stopped and
disabled when the declaration went: ADR 0118 never starts a unit on the way out. Unassigning the zfs
module would so have left the home server's pool with no scrub schedule at all, said nowhere.

The host now records what it declared for a service (Declared, beside Found). On removal, a unit found
running and declared stopped is started again, and one found enabled and declared disabled is enabled
again, each read back; the report says restored, and the plan says it first. A record from before the
field starts nothing.
This commit is contained in:
jochen
2026-10-09 01:35:27 +02:00
parent a2c2c35e85
commit 9d48b8baf9
4 changed files with 196 additions and 4 deletions
+12
View File
@@ -125,6 +125,18 @@ func Plan(d *declaration.Declaration, known store.State, origin string) []Step {
case f == nil:
step.Verb, step.Why = "forget", "no longer declared; recorded before the host kept what it "+
"found, so it is left as it is"
case orphan.Declared != nil && ((f.State == "running" && orphan.Declared.State == "stopped") ||
(f.Boot == "enabled" && orphan.Declared.Boot == "disabled")):
// startUnitBack's words (novox/hq ADR 0269): what the mesh's declaration stopped goes back.
var back []string
if f.State == "running" && orphan.Declared.State == "stopped" {
back = append(back, "started")
}
if f.Boot == "enabled" && orphan.Declared.Boot == "disabled" {
back = append(back, "enabled at boot")
}
step.Verb, step.Why = "restore", "no longer declared; the host found it running and enabled and "+
"the mesh held it stopped, so it is "+strings.Join(back, " and ")+" again"
case f.State == "stopped" || f.Boot == "disabled":
var back []string
if f.State == "stopped" {