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
@@ -40,6 +40,9 @@ func TestD84_WindowClient_SendsTheClaimsAndReadsTheAgreement(t *testing.T) {
|
||||
if err := json.Unmarshal(gotBody["ended"], &sent); err != nil || len(sent) != 1 || sent[0].App != "vikunja" || strings.Join(sent[0].SnapshotIDs, ",") != "aa,bb,cc" || sent[0].RemovedAt != "2026-11-15T10:00:00Z" {
|
||||
t.Fatalf("the hub did not receive the claim: %s (%v)", gotBody["ended"], err)
|
||||
}
|
||||
if w.AcceptsEnded {
|
||||
t.Fatal("an answer WITHOUT accepts_ended (an older hub) reads as a hub that knows end records")
|
||||
}
|
||||
if !w.Granted || w.ID != 9 || w.MaxRemove != 10 || strings.Join(w.EndedAllowed, ",") != "aa,bb" || len(w.EndedRefused) != 1 || w.EndedRefused[0].App != "immich" {
|
||||
t.Fatalf("window = %+v, want the agreement (aa,bb) and the refusal of immich", w)
|
||||
}
|
||||
@@ -52,9 +55,13 @@ func TestD84_WindowClient_SendsTheClaimsAndReadsTheAgreement(t *testing.T) {
|
||||
t.Fatalf("a request with no claim carries `ended`: %v", gotBody)
|
||||
}
|
||||
|
||||
// A window that is NOT granted carries no agreement, whatever the answer holds.
|
||||
answer = `{"granted":false,"reason":"not due","ended_allowed":["aa","bb"]}`
|
||||
// A window that is NOT granted carries no agreement, whatever the answer holds — and it does carry the hub's
|
||||
// word that it reads end records (the box learns it on an ordinary night).
|
||||
answer = `{"granted":false,"reason":"not due","ended_allowed":["aa","bb"],"accepts_ended":true}`
|
||||
w2, err := c.Open(context.Background(), 20, claims)
|
||||
if err == nil && !w2.AcceptsEnded {
|
||||
t.Fatal("accepts_ended of a not-granted answer was not read")
|
||||
}
|
||||
if err != nil || w2.Granted || len(w2.EndedAllowed) != 0 {
|
||||
t.Fatalf("not granted: %+v %v — an agreement without a window must not reach the box", w2, err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user