R-1348: the mail of an interrupted put-back names a restore, not an off-site run (seen on the live proof); changelog: R-1347, R-1348 proven live on 9202. Commit only.
gates / gates (push) Successful in 32s

This commit is contained in:
admin committed 2026-11-03 01:12:19 +01:00
1 parent c4b6844d34
commit 37644458c7
4 files changed
+40 -7

No files matched your search

+10
View File
@@ -78,6 +78,16 @@ func heldStoppedOperatorText(h settings.RestoreHold) (msg, leg, reason string) {
}
}
// heldRunKind names the run in the mail's subject. A hold that does not say which restore wrote it is an off-site one, the
// pre-R-1340 rule, EXCEPT an interrupted put-back: its record names no kind, and its restore may be either, so „restore" (R-1348,
// seen live 2026-11-03: a local restore's mail read „offsite-reconstitute"). Pinned by TestR1348_HeldRunKind.
func heldRunKind(h settings.RestoreHold) string {
if h.RestoreKind == settings.RestoreKindLocal || h.MixedCause == settings.MixedCauseInterruptedPutBack {
return "restore"
}
return "offsite-reconstitute"
}
func mixedHoldText(h settings.RestoreHold, kind, tail string) (msg, leg, reason string) {
stack := h.Stack
leg = "restore-hold-mixed"
+1 -5
View File
@@ -1560,11 +1560,7 @@ func main() {
holdNotify := func(stack string, replayErr, rollbackErr error) {
h := heldHoldFromNotify(sett.GetRestoreHold, stack, replayErr, rollbackErr)
msg, leg, reason := heldStoppedOperatorText(h)
runKind := "offsite-reconstitute"
if h.RestoreKind == settings.RestoreKindLocal {
runKind = "restore"
}
d := notify.BackupRunFailuresDetails{RunKind: runKind, Failed: 1, Attempted: 1}
d := notify.BackupRunFailuresDetails{RunKind: heldRunKind(h), Failed: 1, Attempted: 1}
d.Apps = append(d.Apps, notify.RunFailureDetail{App: stack, Leg: leg, Reason: reason})
notifier.NotifyBackupRunFailures(msg, d)
}
@@ -1,6 +1,10 @@
package main
import "testing"
import (
"testing"
"gitea.dooplex.hu/admin/felhom-controller/internal/settings"
)
// R-1347 and R-1348: each seam is CALLED from main.go (an AST walk) — a seam built and never wired is the project's
// oldest shape.
@@ -17,3 +21,21 @@ func TestR1348_HeldNotifyIsWiredAtStartup(t *testing.T) {
t.Fatal("main.go never calls SetHeldNotify — a failed put-back at start-up would mail nobody")
}
}
// The mail's run name for an interrupted put-back. RED (2026-11-03, live on 9202): the sink showed run_kind offsite-reconstitute for a
// local restore.
func TestR1348_HeldRunKind(t *testing.T) {
for _, c := range []struct {
h settings.RestoreHold
want string
}{
{settings.RestoreHold{Reason: settings.HoldReasonRestoreMixed, MixedCause: settings.MixedCauseInterruptedPutBack}, "restore"},
{settings.RestoreHold{RestoreKind: settings.RestoreKindLocal}, "restore"},
{settings.RestoreHold{RestoreKind: settings.RestoreKindOffsite}, "offsite-reconstitute"},
{settings.RestoreHold{Reason: settings.HoldReasonRestoreMixed}, "offsite-reconstitute"},
} {
if got := heldRunKind(c.h); got != c.want {
t.Errorf("%+v: run kind %q, want %q", c.h, got, c.want)
}
}
}