Say an unhealthy resource's restart count as the engine's own since it began watching
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 delivered
mesh/delivery-group group fix/458-restarts-say-what-they-count delivered: every member is delivered

Beside the state it read as restarts since then (novox/hq issue 458).
This commit is contained in:
2026-10-12 10:47:07 +02:00
parent 3333a05a74
commit a18d09db75
2 changed files with 29 additions and 2 deletions
+9 -2
View File
@@ -1604,8 +1604,7 @@ func judgeWhatRuns(ctx context.Context, j *liveness.Judge, queue *link.Queue, sa
if changed {
for _, r := range st.Resources {
if r.State == liveness.Unhealthy {
say(fmt.Sprintf("%s (%s %s) is unhealthy: %s, %d restart(s) counted", r.ID, r.Kind, r.Target,
r.Reason, r.Restarts))
say(unhealthyWords(r))
}
}
}
@@ -2338,3 +2337,11 @@ func factsAsReported(f *store.Facts) map[string]any {
}
return out
}
// unhealthyWords is what the engine says of an unhealthy resource. Its restart count is the judge's own
// (kept.Counted): automatic restarts since it began watching the resource, kept across recreates and starts
// by hand, so it is said as that and never read as since the state began (novox/hq issue 458).
func unhealthyWords(r liveness.State) string {
return fmt.Sprintf("%s (%s %s) is unhealthy: %s, %d automatic restart(s) since this engine began watching it",
r.ID, r.Kind, r.Target, r.Reason, r.Restarts)
}
+20
View File
@@ -0,0 +1,20 @@
package main
import (
"strings"
"testing"
"github.com/novox/mesh-host/internal/liveness"
)
// The restart count the engine says is its own since it began watching the resource, never since the state
// began (novox/hq issue 458).
func TestAnUnhealthyResourceSaysWhatItsRestartCountCounts(t *testing.T) {
r := liveness.State{Resource: liveness.Resource{ID: "messenger.own-runtime", Kind: "process",
Target: "messenger-runtime.service"}, State: liveness.Unhealthy, Reason: liveness.ReasonRestarting, Restarts: 3890}
said := unhealthyWords(r)
if !strings.Contains(said, "3890 automatic restart(s) since this engine began watching it") ||
strings.Contains(said, "counted") {
t.Fatalf("the restart count is not said as what it counts: %s", said)
}
}