Say a secret given in plain words, and log words the keeper refuses
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate pass: builds build-agent, mesh-controller, route-proxy → ace, g14, novox, shanks; no bus step; every machine composes with the change as it…
mesh/repo-check pass: its merge-check.sh passed

The secret-given condition's explanation carried a clock time, which the
plain rule refuses, so the operator read the scope's fallback ("needs a
look") instead of what changed. Its words now carry no time and say the
secret's name as words; a test holds them to the rule through a keeper.
With no test hook set, the keeper logs a refused or missing wording once
per kind and reason, so a fallback is never silent again (hq issue 359).
This commit is contained in:
jochen
2026-10-09 23:41:22 +02:00
parent 19eefb66c6
commit 988e501ccc
4 changed files with 103 additions and 13 deletions
+26
View File
@@ -1,7 +1,10 @@
package conditions
import (
"bytes"
"encoding/json"
"log"
"os"
"strings"
"testing"
)
@@ -245,3 +248,26 @@ func TestAChangeOfWordsIsSaid(t *testing.T) {
t.Fatalf("%+v", said)
}
}
// **Words that fall back are never silent** (hq issue 359): with no test listening, the keeper logs which
// kind is said in borrowed words and why — once, however often the condition is observed.
func TestBorrowedWordsAreLogged(t *testing.T) {
k, _, _, _ := keeper(t)
before := Unworded
Unworded = nil
t.Cleanup(func() { Unworded = before })
var out bytes.Buffer
log.SetOutput(&out)
t.Cleanup(func() { log.SetOutput(os.Stderr) })
for i := 0; i < 3; i++ {
if _, err := k.Observe(t.Context(), Observation{Scope: ScopeMachine, ID: "ace", Kind: "test-clock", Machine: "ace",
Severity: Warning, Source: "test", Summary: "s", Headline: "ace was given a secret",
Explanation: "It was given at 23:32.", Resolved: "Seen"}); err != nil {
t.Fatal(err)
}
}
if got := out.String(); strings.Count(got, "\n") != 1 || !strings.Contains(got, `"test-clock"`) ||
!strings.Contains(got, "a clock time or date") {
t.Errorf("the log said %q", got)
}
}