node-engine: at its first pass after an update, a process taken as running gets its unit written again with MESH_NODE (1984/AC16, AC17; H-A-711, H-A-713, H-A-714)

A module taken as running its want's composition at the start (the agent's TakenAtStart, now the named
takenAtStartIn the node agent hands it) has the unit of each process whose composed unit differs from its
applied record's written again, by one function (apply.ProcessWrote, which the apply builds its record with
too), and the record takes it, so a second pass finds nothing. Nothing is applied: no backup, no other
resource, the have unchanged. A held module, or one whose want names a new fingerprint, is never taken as
running and is not touched. A process whose record names another bundle, or none, is left as it is and said
(H-A-714); a failed units reload is said.

What restarts: services only. Run-once steps and scheduled processes' units are written, not run or started.
Brother's two processes (brother-device, brother-watch; neither run-once nor scheduled) are services: each
restarts once, if brother runs its want's composition.

Builds: design 47 G A-342, H-A-711, H-A-713, H-A-714
This commit is contained in:
2026-11-25 15:34:13 +01:00
parent c312e6a30e
commit 3c2e60dc1f
7 changed files with 253 additions and 9 deletions
+2 -1
View File
@@ -195,7 +195,8 @@ type Env struct {
Settled func(module string)
// TakenAtStart is told, outside the agent's lock, each module taken as running at this start from its have or the
// kept declaration, with no apply, and the composition it runs: the node-engine converges the owner and mode of each
// record-held directory entry of it (H-A-374, H-A-392). Nil tells nothing.
// record-held directory entry of it (H-A-374, H-A-392) and writes again the unit of each process of it whose unit
// lacks its node's name, restarting a service (H-A-713). Nil tells nothing.
TakenAtStart func(module string, runs compositions.Composed)
// DirectoryDrift reads, for the verb composition's diff, each directory entry of runs the mesh made whose owner or
// mode on disk differ (apply.DirectoryDrifts, H-A-392). Nil reads none.
+7
View File
@@ -1083,6 +1083,13 @@ func testADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) {
if got := r.appliedList(); len(got) != 0 {
t.Fatalf("applied behind a hold with no answer: %v", got)
}
// 1984/AC17 (H-A-713): a held module is not taken as running at the start, so nothing of it is written again.
r.mu.Lock()
taken := len(r.takenAtStart)
r.mu.Unlock()
if taken != 0 {
t.Fatalf("a held module was told as taken at the start: %v", r.takenAtStart)
}
r.wants.put(wk, selfWant(row.later))
eventually(t, "the read tool does not say the answer", func() bool {
v, err := r.ag.Composition(context.Background(), "nats", "", false)