R-100: record the offsite last-SUCCESS anchor (v0.181.0)

LastRun records an attempt, not a result. New OffboxTarget.LastSuccess, set only on the
success branch via the pure offboxAnchorAfterRun rule, carried to the hub as last_success.
Closes two silent-wipe sites (settings save, hub re-apply).
This commit is contained in:
2026-07-28 13:12:37 +02:00
parent 4056feccee
commit e000e201af
6 changed files with 298 additions and 6 deletions
@@ -93,6 +93,10 @@ func (s *Server) offboxConfigHandler(w http.ResponseWriter, r *http.Request) {
}
if prev != nil { // preserve runtime status fields across an edit
tgt.LastRun, tgt.LastStatus, tgt.LastError = prev.LastRun, prev.LastStatus, prev.LastError
// R-100: LastSuccess is runtime status like the rest — an edit to the host/path/schedule must
// not erase the staleness anchor. Losing it here would silently reset the tier to "never
// succeeded" on a routine settings save. Pinned by TestOffboxEdit_PreservesLastSuccess.
tgt.LastSuccess = prev.LastSuccess
tgt.LastDuration, tgt.RepoSizeHuman, tgt.SnapshotCount = prev.LastDuration, prev.RepoSizeHuman, prev.SnapshotCount
tgt.LastWarning = prev.LastWarning
tgt.EscrowState = prev.EscrowState