Files
mesh-catalog/modules/mesh-self-check/cmd/mesh-self-check/words.go
T
2026-11-11 21:47:00 +01:00

53 lines
2.4 KiB
Go

package main
// The operator's words for the kinds the self-check raises, written into a finding's headline and explanation
// (novox/hq ADR 0564 §2; design 47 G §689).
// worded gives a finding the operator's words registered for its kind, where it says none of its own.
func worded(f Finding) Finding {
w, ok := words[f.Kind]
if !ok {
return f
}
if f.Headline == "" {
f.Headline = w.Headline
}
if f.Explanation == "" {
f.Explanation = w.Explanation
}
if f.Needs == "" {
f.Needs = w.Needs
}
return f
}
type plain struct{ Headline, Explanation, Needs string }
// words are the controller's words for each kind the self-check raises (mesh-controller plain_words.go), the
// controller's name for itself replaced by the self-check's where the words spoke of it.
var words = map[string]plain{
"stream-wrong": {Headline: "Part of the bus's storage is wrong",
Needs: "check the machine the bus runs on; the details say what is missing.",
Explanation: "A store the mesh keeps on the bus is missing or not as defined, so what it keeps there may be lost."},
"bus-reconnects": {Headline: "A client keeps losing the bus",
Explanation: "One of the mesh's clients lost its connection to the bus again and again in the last hour. While " +
"it reconnects, what it says and what it is asked waits."},
"core-unhealthy": {Headline: "The bus is not healthy",
Needs: "check the machine the bus runs on; the details say what fails.",
Explanation: "The bus, which carries every message in the mesh, is not healthy. Instructions, builds and tool " +
"calls may fail until it recovers."},
"watchdogs-silent": {Headline: "The mesh's watchdogs stopped",
Needs: "restart the watchman if this stays, from the mesh MCP server.",
Explanation: "The watchdogs, which notice when something expected does not happen, do not answer, so missed " +
"signals are not noticed."},
"probe-failed": {Headline: "A check of the mesh could not run",
Explanation: "One of the mesh's own checks could not run, so what it watches is unknown for now. It runs again " +
"every few minutes."},
}
// confirm says one look can be wrong about the finding: it is written only when two runs in a row see it (issue 277).
// The kinds are the self-check's own: a probe that could not run, and a holder that measured nothing of the data.
func confirm(o Finding) bool {
return o.Kind == "probe-failed" || o.Kind == kindDataUnmeasured
}