Review fix 5: the box sends its end records only to a hub that says it reads them (version skew)
gates / gates (push) Successful in 32s

A new box with an older hub sent `ended` in the window request; that hub reads
4 KiB of it, decided the window on a wrong count, and the weekly clean-up
stalled.

- The box sends `ended` only when the hub's last window answer said
  accepts_ended (kept in settings, re-read from every answer, so a rolled-back
  hub stops getting them after one answer). Otherwise the request is the one
  every hub always got, and the ordinary clean-up runs.
- One request carries at most 5000 snapshot ids.

Tests seen red before the fix; 6 mutations seen red (felhom.eu
documentation/audits/build-release-4-2026-11-15/A/redproof-review-5.txt).

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-15 15:05:38 +01:00
1 parent c7e4ec9b5e
commit c5acb91a44
10 files changed
+179 -5

No files matched your search

@@ -169,3 +169,22 @@ func (s *Settings) GetOffsiteEndsDone() []OffsiteEndDone {
defer s.mu.RUnlock()
return append([]OffsiteEndDone(nil), s.OffsiteEndsDone...)
}
// OffsiteHubAcceptsEnded: did the hub's LAST window answer say that it reads end records (`accepts_ended`)? Kept in
// settings so a controller restart does not cost a week: the box sends its end records only to a hub that said so.
func (s *Settings) GetOffsiteHubAcceptsEnded() bool {
s.mu.RLock()
defer s.mu.RUnlock()
return s.OffsiteHubAcceptsEnded
}
// SetOffsiteHubAcceptsEnded records the hub's last answer; it writes only on a change.
func (s *Settings) SetOffsiteHubAcceptsEnded(v bool) error {
s.mu.Lock()
defer s.mu.Unlock()
if s.OffsiteHubAcceptsEnded == v {
return nil
}
s.OffsiteHubAcceptsEnded = v
return s.save()
}
+2
View File
@@ -233,6 +233,8 @@ type Settings struct {
// OffsiteEndsDone is the short history of ends a clean-up window has carried out. See offsite_ends.go.
OffsiteEnds map[string]OffsiteEnd `json:"offsite_ends,omitempty"`
OffsiteEndsDone []OffsiteEndDone `json:"offsite_ends_done,omitempty"`
// OffsiteHubAcceptsEnded: the hub's last window answer said it reads end records (offsite_ends.go).
OffsiteHubAcceptsEnded bool `json:"offsite_hub_accepts_ended,omitempty"`
// UnhealthyStops (v0.269.0, decision 28) — when the box last stopped each app for a crash loop or an
// out-of-memory storm (RFC3339). Survives the hold being lifted by Start, so a second stop within
// 24 h is known to be a second one.