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
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:
1 parent
c7e4ec9b5e
commit
c5acb91a44
10 files changed
+179
-5
No files matched your search
@@ -86,12 +86,18 @@ type agreeingHub struct {
|
||||
allowAll func() []string
|
||||
refuse []OffsiteEndedRefusal
|
||||
maxRm int
|
||||
// oldHub: a hub from before ended apps — it never says accepts_ended. notGranted: the answer of an ordinary night.
|
||||
oldHub bool
|
||||
notGranted bool
|
||||
}
|
||||
|
||||
func (h *agreeingHub) Open(ctx context.Context, n int, ended []OffsiteEndedClaim) (OffsiteWindow, error) {
|
||||
h.opened++
|
||||
h.claims = ended
|
||||
w := OffsiteWindow{Granted: true, ID: 7, NewestAllowed: time.Now(), MaxRemove: h.maxRm, EndedAllowed: h.allow, EndedRefused: h.refuse}
|
||||
w := OffsiteWindow{Granted: true, ID: 7, NewestAllowed: time.Now(), MaxRemove: h.maxRm, EndedAllowed: h.allow, EndedRefused: h.refuse, AcceptsEnded: !h.oldHub}
|
||||
if h.notGranted {
|
||||
w = OffsiteWindow{Reason: "not due", AcceptsEnded: !h.oldHub}
|
||||
}
|
||||
if h.allowAll != nil {
|
||||
w.EndedAllowed = h.allowAll()
|
||||
}
|
||||
@@ -113,6 +119,9 @@ func endedBox(t *testing.T, living ...string) (*Manager, *settings.Settings, *en
|
||||
tagged("k1", old, "kimai"),
|
||||
}}
|
||||
m.SetOffboxRunner(er.run)
|
||||
if err := sett.SetOffsiteHubAcceptsEnded(true); err != nil { // the box has heard this hub say it knows ended apps
|
||||
t.Fatal(err)
|
||||
}
|
||||
hub := &agreeingHub{maxRm: 5}
|
||||
hub.allowAll = func() []string {
|
||||
var all []string
|
||||
|
||||
Reference in new issue
Block a user