R-518: a press with the local storage absent backs up nothing (never the off-site tier as a stand-in); an agent that flags no primary keeps the first tier

09 §3 decision 156 says the button makes the local copy only.
Test: TestManualRunTiers_NoPrimaryAvailable_BacksUpNothing (red-proved on the previous version).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-10-06 15:09:37 +02:00
parent d720495cd5
commit 9d2d62831a
2 changed files with 48 additions and 10 deletions
+16 -4
View File
@@ -82,12 +82,24 @@ func TestManualRun_UnknownStorageNotSkipped(t *testing.T) {
// `09` §3 decision 156: a press backs up ONE tier. When no available tier is flagged primary (the
// primary's storage is absent), the first available tier is backed up — never nothing.
func TestManualRunTiers_NoPrimaryAvailable_BacksUpFirstAvailable(t *testing.T) {
// `09` §3 decision 156: the press makes the LOCAL copy only. With the local storage absent it makes no copy at
// all — the off-site tier is never its stand-in (it runs at night) — and stops no app.
func TestManualRunTiers_NoPrimaryAvailable_BacksUpNothing(t *testing.T) {
be := newTierBackend()
be.tiers = []BackupTier{{Target: "local", Primary: true, StorageAbsent: true}, {Target: "felhom-pbs"}, {Target: "other"}}
l := newTierLoop(t, be, &fakeStacks{}, nil)
st := &fakeStacks{}
l := newTierLoop(t, be, st, nil)
got := l.manualRunTiers(context.Background())
if len(got) != 1 || got[0].target != "felhom-pbs" {
t.Fatalf("want exactly the first available tier, got %+v", got)
if len(got) != 0 {
t.Fatalf("want no tier (the local copy's storage is absent), got %+v", got)
}
if err := l.quiesceAndPollTiers(context.Background(), got); err != nil {
t.Fatalf("empty window: %v", err)
}
if len(be.started) != 0 {
t.Fatalf("an off-site backup was started for a manual press: %v", be.started)
}
if n := len(st.stoppedNames()); n != 0 {
t.Fatalf("%d app(s) were stopped for a press that backs up nothing", n)
}
}