hub v0.162.0 (built, not deployed): no repeat mail after a restart for a known-down host or an already-reported stale restore test (R-1001); the Day-0 agent list leaves out packages without the felhom-agent file, a vouch of one is refused (R-1011); an absent tunnel reads 'none set up' (R-1070)
gates / gates (push) Successful in 7m20s

This commit is contained in:
admin committed 2026-10-19 20:27:01 +02:00
1 parent a28f162c66
commit 5f31da04bc
16 files changed
+443 -17

No files matched your search

+24
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"log"
"strings"
"sync"
"time"
@@ -277,6 +278,9 @@ func (c *RestoreTestChecker) checkStaleness(customerID, latestJSON string, now t
c.mu.Unlock()
switch {
case state == "stale" && prev == "" && c.staleAlreadyReported(customerID, tier, proven[tier], now):
// R-1001: the first sweep after a hub restart — this tier's stale run was already reported.
c.logger.Printf("[INFO] restore-test staleness: %s %s tier still unproven, already reported before the restart — not re-sent (R-1001)", customerID, tier)
case state == "stale" && prev != "stale":
c.emit(customerID, EventRestoreTestStale, "warning", v.reason)
case v.verdict == verdictUnknown && prev == "":
@@ -287,6 +291,26 @@ func (c *RestoreTestChecker) checkStaleness(customerID, latestJSON string, now t
}
}
// staleAlreadyReported (R-1001, hub 0.162.0): the edge state lives in memory, so a hub restart forgot that a tier's
// stale signal was already sent and the first sweep re-sent it (measured 2026-10-13, Tester 2). The DB holds the
// answer: a restore_test_stale event for this tier („<tier> tier: …") inside the read window and newer than the
// tier's last proof means this run of staleness was reported. The window bound keeps it honest — a pass between that
// event and now would be inside the window and newer than it. An event older than the window, or a failed read, lets
// the signal through (the alarm, never the silence). Pinned by TestRestoreTestStale_R1001_RestartDoesNotReMail.
func (c *RestoreTestChecker) staleAlreadyReported(customerID, tier string, provenAt, now time.Time) bool {
evs, err := c.store.GetEventsByType(customerID, EventRestoreTestStale, now.Add(-restoreWindowRead))
if err != nil {
c.logger.Printf("[WARN] restore-test staleness: could not read the past signals for %s (%v) — sending (R-1001)", customerID, err)
return false
}
for _, e := range evs {
if strings.HasPrefix(e.Message, tier+" tier:") && e.CreatedAt.After(provenAt) {
return true
}
}
return false
}
// assessRestoreProven is the per-tier verdict. PURE (now and the window injected) so the policy is
// unit-tested — the property that made R-81 provable, kept deliberately.
//