hub (unreleased): a box cannot mint operator events — only a queued job is told as refused, the give-up list is bounded (R-1383); docs for the clock-step fix and HSTS (R-1395, R-1050)
gates / gates (push) Successful in 2m3s

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-14 17:43:33 +01:00
1 parent 1886030782
commit 186f3fca58
11 files changed
+184 -14

No files matched your search

+23
View File
@@ -59,6 +59,15 @@ func TestSignedJobOutcome_RefusedIsToldDoneIsNot(t *testing.T) {
if evs[0].Severity != "error" || !strings.Contains(evs[0].DetailsJSON, `"reason":"expired"`) {
t.Errorf("event = %+v", evs[0])
}
// a box „clears” job ids that were never in its queue: no event — a box cannot mint operator mails
for _, id := range []string{"never-queued", "never-queued-2", "x%0Ay"} {
if rr := do(h, http.MethodDelete, "/hosts/h1/jobs/"+id+"?outcome=rejected&reason=expired&op=agent_update", "HKEY", ""); rr.Code != 200 {
t.Fatalf("DELETE of an unknown job: %d", rr.Code)
}
}
if evs := r1383Events(t, st, eventSignedJobRefused); len(evs) != 1 {
t.Fatalf("clearing ids that were never queued raised events: %d, want still 1", len(evs))
}
// a failed run, and words the hub does not know: told, and the box's own text never reaches the mail
del("j-fail", "?outcome=failed&reason=execution_failed&op=agent_config_update")
del("j-odd", "?outcome=rejected&reason=%3Cscript%3E&op=%3Cb%3EX")
@@ -133,4 +142,18 @@ func TestGuestPowerGaveUp_ToldOnceClearedOnlyByARunningGuest(t *testing.T) {
if c := counts(); c != "gave_up=2 ok=1" {
t.Fatalf("a new down period: %s", c)
}
// the list is the box's: a vmid the same report does not list is not read, and a long list is cut
many := "["
for i := 0; i < 500; i++ {
many += fmt.Sprintf(`{"vmid":%d,"since":"2026-11-14T02:00:00Z","attempts":3},`, 5000+i)
}
many += `{"vmid":101,"since":"2026-11-14T02:00:00Z","attempts":3}]` // 101 IS a guest of the report (stopped), but entry 501
post("stopped", many)
if c := counts(); c != "gave_up=2 ok=1" {
t.Fatalf("500 invented guests and a list past the cap: %s, want no new alarm", c)
}
post("stopped", `[{"vmid":101,"since":"2026-11-14T02:00:00Z","attempts":3},{"vmid":7777,"since":"x","attempts":3}]`)
if c := counts(); c != "gave_up=3 ok=1" {
t.Fatalf("a real second guest (101) within the cap: %s, want one more alarm and none for vmid 7777", c)
}
}