Name a watchman finding's reference Ref, as mesh-sdk does
mesh-sdk #150 (issue 1952) renamed health.Finding's Token to Ref, since the tool runner refuses state fields named like a credential, so the watchman no longer compiled against the latest mesh-sdk, which every module now builds against (ADR 0573 §2, issue 1585). The meaning is the same: the key's last part when it is not the kind. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
@@ -3,7 +3,7 @@ module mesh-delivery-watchman
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030201806-eff81f1220e2
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101005726-af4e4e60a3a0
|
||||
github.com/nats-io/nats-server/v2 v2.11.17
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030201806-eff81f1220e2 h1:RF73nVI1dTrrmlFosVDTMJmpUQ+rEeB7++BHH/RvZFg=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030201806-eff81f1220e2/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101005726-af4e4e60a3a0 h1:q6ywchpTM9fwaJ1UNwDSuOjb5FYDFcsaeiTrKoB4scc=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101005726-af4e4e60a3a0/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0-default-no-op h1:1BOWQJweNyvZMlpAHXGLiZQn9S+QXGcz3xh94lC0w6E=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
|
||||
|
||||
@@ -36,14 +36,14 @@ const (
|
||||
// operator reads (ADR 0253; empty leaves the keeper's wording of the kind), and the row or fact it comes from (Source).
|
||||
// It is written as health.Finding.
|
||||
type Finding struct {
|
||||
Scope, ID, Token, Kind, Machine string
|
||||
Also []string
|
||||
Severity string
|
||||
Summary, Said string
|
||||
Headline, Explanation string
|
||||
Needs, Resolved string
|
||||
Source string
|
||||
Observer string
|
||||
Scope, ID, Ref, Kind, Machine string
|
||||
Also []string
|
||||
Severity string
|
||||
Summary, Said string
|
||||
Headline, Explanation string
|
||||
Needs, Resolved string
|
||||
Source string
|
||||
Observer string
|
||||
// Since is when what it says began, as the watchman saw it: the finding's time and its observation's, so the same
|
||||
// thing observed again writes the same bytes.
|
||||
Since time.Time
|
||||
@@ -54,11 +54,11 @@ func FindingKey(scope, id, token string) string { return health.FindingKey(scope
|
||||
|
||||
// Key is the finding's key: its token, or its kind when it has none.
|
||||
func (f Finding) Key() string {
|
||||
token := f.Token
|
||||
if token == "" {
|
||||
token = f.Kind
|
||||
ref := f.Ref
|
||||
if ref == "" {
|
||||
ref = f.Kind
|
||||
}
|
||||
return FindingKey(f.Scope, f.ID, token)
|
||||
return FindingKey(f.Scope, f.ID, ref)
|
||||
}
|
||||
|
||||
// EncodeFinding is f in mesh-sdk's layout, refusing one the keeper could not make a condition of.
|
||||
@@ -67,7 +67,7 @@ func EncodeFinding(f Finding) ([]byte, error) {
|
||||
if said == "" {
|
||||
said = f.Summary
|
||||
}
|
||||
return health.EncodeFinding(health.Finding{Key: f.Key(), Kind: f.Kind, Token: f.Token,
|
||||
return health.EncodeFinding(health.Finding{Key: f.Key(), Kind: f.Kind, Ref: f.Ref,
|
||||
Subject: health.Subject{Scope: f.Scope, ID: f.ID, Machine: f.Machine, Also: f.Also},
|
||||
Severity: health.Severity(f.Severity), Summary: f.Summary, Headline: f.Headline, Explanation: f.Explanation,
|
||||
Resolved: f.Resolved, Needs: f.Needs, Evidence: []health.Evidence{{At: f.Since.UTC(), Said: said}},
|
||||
@@ -80,7 +80,7 @@ func DecodeFinding(data []byte) (Finding, error) {
|
||||
if err != nil {
|
||||
return Finding{}, err
|
||||
}
|
||||
f := Finding{Scope: h.Subject.Scope, ID: h.Subject.ID, Token: h.Token, Kind: h.Kind, Machine: h.Subject.Machine,
|
||||
f := Finding{Scope: h.Subject.Scope, ID: h.Subject.ID, Ref: h.Ref, Kind: h.Kind, Machine: h.Subject.Machine,
|
||||
Also: h.Subject.Also, Severity: string(h.Severity), Summary: h.Summary, Headline: h.Headline, Explanation: h.Explanation,
|
||||
Needs: h.Needs, Resolved: h.Resolved, Source: h.Source, Observer: h.Observer, Since: h.At}
|
||||
if len(h.Evidence) > 0 {
|
||||
|
||||
@@ -396,7 +396,7 @@ func TestTheWatchmansFindings(t *testing.T) {
|
||||
|
||||
func seedUnhealthy(t *testing.T, w *Watchman, o *fakeOut, sev string, since time.Time) {
|
||||
t.Helper()
|
||||
f := Finding{Scope: ScopeModule, ID: "web.ace", Token: "unhealthy", Kind: KindUnhealthy, Machine: "ace", Severity: sev, Source: "health", Since: since, Summary: "web on ace is not healthy: x"}
|
||||
f := Finding{Scope: ScopeModule, ID: "web.ace", Ref: "unhealthy", Kind: KindUnhealthy, Machine: "ace", Severity: sev, Source: "health", Since: since, Summary: "web on ace is not healthy: x"}
|
||||
v, _ := EncodeFinding(f)
|
||||
o.findings[f.Key()], _ = DecodeFinding(v)
|
||||
w.SeedFinding(f.Key(), v)
|
||||
|
||||
@@ -143,7 +143,7 @@ func (w *Watchman) rewrittenOf(m string, p delivery.NetworkPart, all []delivery.
|
||||
if w.control[m] {
|
||||
severity = Urgent
|
||||
}
|
||||
return Finding{Scope: ScopeMachine, ID: id, Token: "rewritten", Kind: KindNetworkRewritten, Machine: m, Severity: severity,
|
||||
return Finding{Scope: ScopeMachine, ID: id, Ref: "rewritten", Kind: KindNetworkRewritten, Machine: m, Severity: severity,
|
||||
Source: "health-report", Since: p.Since, Summary: summary,
|
||||
Said: fmt.Sprintf("since %s: %s", stampSec(p.Since), strings.Join(said, " | "))}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ func unitsOf(node string, u *delivery.UnitsHealth) (Finding, bool) {
|
||||
if len(u.Failed) > 1 {
|
||||
failed = fmt.Sprintf("%d failed services", len(u.Failed))
|
||||
}
|
||||
return Finding{Scope: ScopeMachine, ID: node, Token: "units", Kind: KindMachineUnits, Machine: node, Severity: Warning,
|
||||
return Finding{Scope: ScopeMachine, ID: node, Ref: "units", Kind: KindMachineUnits, Machine: node, Severity: Warning,
|
||||
Source: "health-report", Since: since,
|
||||
Summary: fmt.Sprintf("%s's service manager is degraded: %d failed unit(s) no module places — %s. Each is the machine's own: "+
|
||||
"mend or remove it there, or have a module place it", node, len(u.Failed), strings.Join(names, ", ")),
|
||||
@@ -388,7 +388,7 @@ func (w *Watchman) networks() {
|
||||
severity = Urgent
|
||||
summary += fmt.Sprintf("; %s cannot reach it", strings.Join(waiting, ", "))
|
||||
}
|
||||
f := Finding{Scope: ScopeMachine, ID: m, Token: "network", Kind: KindMachineNetwork, Machine: m, Severity: severity,
|
||||
f := Finding{Scope: ScopeMachine, ID: m, Ref: "network", Kind: KindMachineNetwork, Machine: m, Severity: severity,
|
||||
Source: "health-report", Since: w.health[m].Network.Since, Summary: summary, Said: strings.Join(said, " | ")}
|
||||
want[f.Key()] = true
|
||||
saysOwn[m] = true
|
||||
@@ -413,7 +413,7 @@ func (w *Watchman) networks() {
|
||||
if w.control[x] || slices.Contains(what, "the bus on it") {
|
||||
severity = Urgent
|
||||
}
|
||||
f := Finding{Scope: ScopeMachine, ID: x, Token: "unreachable", Kind: KindNetworkUnreachable, Machine: x, Also: from(x),
|
||||
f := Finding{Scope: ScopeMachine, ID: x, Ref: "unreachable", Kind: KindNetworkUnreachable, Machine: x, Also: from(x),
|
||||
Severity: severity, Source: "health-report",
|
||||
Summary: fmt.Sprintf("%s cannot be reached from %s: %s", x, strings.Join(from(x), ", "), strings.Join(what, ", ")),
|
||||
Said: strings.Join(said, " | ")}
|
||||
|
||||
@@ -350,13 +350,13 @@ func (w *Watchman) Stood(st Standing) {
|
||||
if st.Node != "" && st.Node != st.ProviderNode {
|
||||
also = []string{st.Node}
|
||||
}
|
||||
w.find(Finding{Scope: ScopeProvider, ID: id, Token: "failing", Kind: KindProviderFailing, Machine: st.ProviderNode, Also: also,
|
||||
w.find(Finding{Scope: ScopeProvider, ID: id, Ref: "failing", Kind: KindProviderFailing, Machine: st.ProviderNode, Also: also,
|
||||
Severity: Warning, Source: "provisioner.failing", Since: st.Since, Said: said,
|
||||
Summary: fmt.Sprintf("%s on %s keeps failing %s: %s, %d attempt(s) since %s", st.Module, st.ProviderNode, whom, class,
|
||||
st.Attempts, stamp(st.Since))})
|
||||
w.unfind(silentKey)
|
||||
now := w.now()
|
||||
w.signal("S8", id, ProviderSaysAgainWithin, signalDue{Do: dueFind, Finding: Finding{Scope: ScopeProvider, ID: id, Token: "silent",
|
||||
w.signal("S8", id, ProviderSaysAgainWithin, signalDue{Do: dueFind, Finding: Finding{Scope: ScopeProvider, ID: id, Ref: "silent",
|
||||
Kind: KindProviderSilent, Machine: st.ProviderNode, Severity: Warning, Source: "S8", Since: now,
|
||||
Summary: fmt.Sprintf("%s on %s said it keeps failing %s and has said nothing since %s: it stopped saying anything, so "+
|
||||
"its last word is all the mesh has", st.Module, st.ProviderNode, st.Consumer, stamp(now)),
|
||||
@@ -498,7 +498,7 @@ func (w *Watchman) haveFindings(key string, node, module string, h *delivery.Hav
|
||||
if h.Health == delivery.HealthFailed {
|
||||
if w.unhealthy[key] == 0 {
|
||||
w.unhealthy[key] = 1
|
||||
f := Finding{Scope: ScopeModule, ID: module + "." + node, Token: "unhealthy", Kind: KindUnhealthy, Machine: node,
|
||||
f := Finding{Scope: ScopeModule, ID: module + "." + node, Ref: "unhealthy", Kind: KindUnhealthy, Machine: node,
|
||||
Severity: Warning, Source: "health", Since: now,
|
||||
Summary: fmt.Sprintf("%s on %s is not healthy: %s", module, node, orWords(h.Detail, "its check failed")),
|
||||
Said: firstLine(orWords(h.Detail, "failed")),
|
||||
|
||||
Reference in New Issue
Block a user