hub: the off-site copies of a removed app end after 30 days — the hub agrees first, the allowance is beside the cap, the household's mail (R-1374 part 1, D72, D84)

Built, not deployed. `07-backup-architecture.md` §8.2f parts 3-4 and decision 309.

- store: the hub's own record of which apps a box runs, by the hub's clock
  (offsite_app_presence, fed by every controller report); it goes with the household.
- offsitekeys: window-open takes the box's due end records and answers
  ended_allowed / ended_refused. An app is agreed only after 30 days of absence
  in the hub's record; an id only when the hub's own listing holds it, uploaded
  before that absence. The cap (max_remove) is unchanged; the close keeps only
  agreed ids from removed_for_ended_apps and allows them beside the cap.
- The 07:10 audit explains the ended apps' vanished files by name and still
  raises for every other vanished file.
- notify: offsite_end_scheduled is a household receipt — one mail per press to
  the household's own address, whatever its switches; the operator is not mailed.
- Two operator-only hub records: offsite_ended_app_removed (info),
  offsite_ended_app_refused (warning).

Tests TestD72_*, TestD84_*; 44 mutations seen red, 5 after a redo
(documentation/audits/build-release-4-2026-11-15/A/redproof-hub-*.txt).

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-15 13:26:13 +01:00
1 parent 552e19cd3d
commit 01a106b78c
33 files changed
+1834 -24

No files matched your search

+26
View File
@@ -236,3 +236,29 @@ func TestR1299_CancelRemovesAWaitingGrant(t *testing.T) {
}
_ = evs
}
// D84 (`07` §8.2f part 4): the window says what the hub agreed to for removed apps and what it refused — per branch of
// the gate. RED-PROOF: documentation/audits/build-release-4-2026-11-15/A/redproof-hub-page.txt.
func TestD84_TheWindowBlockSaysWhatWasAgreedAndRefused(t *testing.T) {
_, st, h, _ := windowRig(t, windowReport)
id, err := st.OpenOffsiteWindowRow("acme", time.Now().Add(20*time.Minute), 40, 20)
if err != nil {
t.Fatal(err)
}
if strings.Contains(windowPage(t, h, ""), `id="window-ended"`) {
t.Error("a window with no removed app must not render the removed-apps line")
}
if err := st.SetOffsiteWindowEnded(id, []string{"a1", "a2", "a3"}, map[string][]string{"vikunja": {"a1", "a2", "a3"}},
[]store.EndedRefusal{{App: "immich", Reason: "the box's newest report lists the app as installed"}}); err != nil {
t.Fatal(err)
}
if _, err := st.SetOffsiteWindowEndedRemoved(id, []string{"a1", "a2"}); err != nil {
t.Fatal(err)
}
page := windowPage(t, h, "")
for _, want := range []string{`id="window-ended"`, "3 snapshot(s) agreed outside the cap, 2 removed", "<strong>refused</strong> immich: the box&#39;s newest report lists the app as installed"} {
if !strings.Contains(page, want) {
t.Errorf("the window block lacks %q", want)
}
}
}
@@ -1061,6 +1061,12 @@
<span class="label">Last window</span>
<span class="value">{{with .Last}}#{{.ID}} {{.OpenedAt.UTC.Format "2006-01-02 15:04"}} UTC &mdash; {{if .ClosedAt.IsZero}}open{{else}}{{.BoxResult}}, {{.CountBefore}} &rarr; {{.CountAfter}}{{end}}{{if .MaxRemove}} (cap {{.MaxRemove}}){{end}}{{else}}never{{end}}</span>
</div>
{{with .Last}}{{if or .EndedAgreed .EndedRefused}}
<div class="info-item" id="window-ended">
<span class="label">Removed apps (30 days after &bdquo;delete backup data&rdquo;)</span>
<span class="value">{{len .EndedAgreed}} snapshot(s) agreed outside the cap, {{len .EndedRemoved}} removed{{range .EndedRefused}}<br><strong>refused</strong>{{if .App}} {{.App}}{{end}}: {{.Reason}}{{end}}</span>
</div>
{{end}}{{end}}
</div>
{{if .Pending}}
<form method="POST" action="/offsite/window-grant/{{$.CustomerID}}" class="inline-confirm">