The off-site copies of a removed app end 30 days after „delete backup data” — the box's half (felhom.eu R-1374 part 1; D72, D84)
gates / gates (push) Successful in 41s

Built, not released; no box has run it. felhom.eu `07-backup-architecture.md` §8.2f.
It does nothing without a hub that knows it: an older hub agrees to no id.

- The record: settings `offsite_ends` {app, removed_at, ends_at}. One writer
  (backup.StartOffsiteEnd), called by a removal only with „delete backup data”
  and by „Törlés 30 nap múlva” on the restore page. A second press changes
  nothing. No record, no deletion. Only on the hub-provisioned tier.
- The date is on the remove dialog before the press; the restore page shows
  „Törlésre kijelölve …” with „Mégis megtartom”, and one history line per
  carried-out end. An install of the same app deletes the record.
- The weekly window: after the guard has passed the policy's plan under the cap
  as before, it adds the snapshots whose app tags are ALL due records, that the
  hub agreed to and the box named in the same request; the result names them
  apart (removed_for_ended_apps). `_shares`, the box's own stacks and an
  installed app are never due.
- The report carries the pending records; the household gets one mail per
  press (offsite_end_scheduled), in both languages.

MinAgent unchanged (0.158.1). 143 parity fixtures gained the dialog's one new
script line (patched, not regenerated); one new parity case.
Tests TestD72_*, TestD84_*; 56 mutations seen red
(felhom.eu documentation/audits/build-release-4-2026-11-15/A/redproof-ctrl-*.txt).

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-15 14:09:47 +01:00
1 parent 591195fadd
commit f628cb5082
177 files changed
+3705 -164

No files matched your search

+37 -4
View File
@@ -56,6 +56,10 @@ type OffsiteWindow struct {
NewestAllowed time.Time
MaxRemove int
Reason string // why not granted (logged)
// D84 (`09` §3 decision 309): the snapshot ids of ENDED apps the hub agreed to — their own allowance, outside
// MaxRemove — and what it refused. Empty from a hub that does not know ended apps: then none is removed.
EndedAllowed []string
EndedRefused []OffsiteEndedRefusal
}
// OffsiteWindowResult is what the box reports when it is done (the hub closes the window on it).
@@ -66,11 +70,16 @@ type OffsiteWindowResult struct {
Removed int `json:"removed"`
Outcome string `json:"outcome"` // pruned | nothing | guard-refused | error
Reason string `json:"reason,omitempty"`
// RemovedForEndedApps names the snapshots this window removed for ended apps (D84) — only ids the hub agreed
// to, and only those that are really gone. The hub's 07:10 audit explains its vanished files by this list.
RemovedForEndedApps []string `json:"removed_for_ended_apps,omitempty"`
}
// OffsiteWindowClient is the hub side (offsiteapply.HubWindowClient in production).
type OffsiteWindowClient interface {
Open(ctx context.Context, countBefore int) (OffsiteWindow, error)
// Open asks for a window. ended are the box's DUE off-site end records with the ids it would remove (D72/D84);
// the hub answers which ids it agrees to.
Open(ctx context.Context, countBefore int, ended []OffsiteEndedClaim) (OffsiteWindow, error)
Close(ctx context.Context, r OffsiteWindowResult) error
}
@@ -225,7 +234,11 @@ func (m *Manager) offsiteWindowRetention(ctx context.Context, base, env []string
m.logger.Printf("[WARN] [offbox] retention skipped (%s): %v", why, err)
return
}
w, err := m.offsiteWindow.Open(ctx, len(snaps))
// D72/D84: the ended apps' candidates, from the records that are due. No record → no candidate.
due := dueOffsiteEnds(m.settings.GetOffsiteEnds(), m.now(), m.offsiteEndLiving)
m.dropEndsWithNoCopies(snaps, due)
claims, candidate := endedCandidates(snaps, due)
w, err := m.offsiteWindow.Open(ctx, len(snaps), claims)
if err != nil {
m.logger.Printf("[WARN] [offbox] retention skipped (%s): asking the hub for a window failed: %v", why, err)
return
@@ -255,6 +268,15 @@ func (m *Manager) offsiteWindowRetention(ctx context.Context, base, env []string
m.logger.Printf("[ERROR] [offbox] clean-up window %d: the fake-snapshot guard REFUSED — nothing deleted: %s (R-822)", w.ID, refuse)
return
}
for _, r := range w.EndedRefused {
m.logger.Printf("[WARN] [offbox] clean-up window %d: the hub REFUSED the ended app %q — nothing of it is removed: %s", w.ID, r.App, r.Reason)
}
// The ended apps' ids: outside the cap, only what the hub agreed to AND this box named in this window.
endedIDs := endedToRemove(w.EndedAllowed, candidate, ids)
if len(endedIDs) > 0 {
m.logger.Printf("[INFO] [offbox] clean-up window %d: %d snapshot(s) of removed apps are due and agreed by the hub — removed beside the policy's %d (D84)", w.ID, len(endedIDs), len(ids))
}
ids = append(ids, endedIDs...)
if len(ids) == 0 {
res.Outcome = "nothing"
m.logger.Printf("[INFO] [offbox] clean-up window %d: the policy removes nothing", w.ID)
@@ -271,8 +293,19 @@ func (m *Manager) offsiteWindowRetention(ctx context.Context, base, env []string
}
if after, lerr := m.listGuardSnaps(ctx, base, env); lerr == nil {
res.CountAfter = len(after)
// Named apart for the hub's audit — only the agreed ids that are REALLY gone from the repository.
still := make(map[string]bool, len(after))
for _, s := range after {
still[s.ID] = true
}
for _, id := range endedIDs {
if !still[id] {
res.RemovedForEndedApps = append(res.RemovedForEndedApps, id)
}
}
m.completeOffsiteEnds(claims, res.RemovedForEndedApps, after)
}
res.Removed = res.CountBefore - res.CountAfter
m.logger.Printf("[INFO] [offbox] clean-up window %d (%s): %d of %d planned snapshot(s) removed, %d -> %d, in %s",
w.ID, why, res.Removed, len(plan), res.CountBefore, res.CountAfter, time.Since(start).Round(time.Second))
m.logger.Printf("[INFO] [offbox] clean-up window %d (%s): %d of %d planned snapshot(s) removed (%d of them for removed apps), %d -> %d, in %s",
w.ID, why, res.Removed, len(ids), len(res.RemovedForEndedApps), res.CountBefore, res.CountAfter, time.Since(start).Round(time.Second))
}