diff --git a/documentation/audits/build-release-4b-2026-11-15/A/redproof-review-7.txt b/documentation/audits/build-release-4b-2026-11-15/A/redproof-review-7.txt new file mode 100644 index 00000000..5a05971d --- /dev/null +++ b/documentation/audits/build-release-4b-2026-11-15/A/redproof-review-7.txt @@ -0,0 +1,7 @@ +# Review finding 7 — the guard n.Told() in endNoticeStuck had no test. The new test, by mutation of the guard: +== MUTATION: the stuck line no longer asks whether somebody was told + RED on the mutant, GREEN on the real file + --- FAIL: TestReview7_ARowToldToTheOperatorNeverGetsTheStuckLine (0.05s) + end_notice_review_test.go:169: a row that was told to the operator got the „told nobody” line: [{ID:2 CustomerID:c1 EventType:offsite_end_notice_stuck Severity:warning Message:Off-site: the household c1 removed the app "vikunja" w + +1 mutations, 0 not a red-proof diff --git a/hub/CHANGELOG.md b/hub/CHANGELOG.md index a270791f..dd89d954 100644 --- a/hub/CHANGELOG.md +++ b/hub/CHANGELOG.md @@ -1,5 +1,10 @@ ## Unreleased (after v0.182.0) +- **Review of the notice lock, finding 7 (2026-11-15 night): a test for a guard that had none.** `endNoticeStuck` + skips a row that was told (`n.Told() ||`); removing the guard left the suite green. New test + `TestReview7_ARowToldToTheOperatorNeverGetsTheStuckLine`: a row told to the operator whose later household mail + waits for the daily limit must not get the line „the notice has not gone out”. No code change; the guard's + removal is seen red. - **Review of the notice lock, finding 2 (2026-11-15 night): a send that errors AFTER the mail service accepted it is not mailed every hour.** A client timeout is logged `failed` although the mail may have gone; the notice was tried again every hour and the daily limit counted only `sent` rows — 12 household mails in 12 hours in the review's diff --git a/hub/internal/api/end_notice_review_test.go b/hub/internal/api/end_notice_review_test.go index 0cf37970..0ff3068b 100644 --- a/hub/internal/api/end_notice_review_test.go +++ b/hub/internal/api/end_notice_review_test.go @@ -137,3 +137,35 @@ func TestReview2_ASendThatErrorsAfterItWasAcceptedIsNotMailedEveryHour(t *testin }) } } + +// Finding 7. The guard `n.Told() ||` in endNoticeStuck had no test: without it the suite stayed green. A row that +// WAS told to the operator (the household had no address then) and whose later household mail waits for the daily +// limit has told somebody — the operator must NOT get the line „the notice has not gone out”. +func TestReview7_ARowToldToTheOperatorNeverGetsTheStuckLine(t *testing.T) { + r := newNoticeRig(t, "") + r.report(repPressed) + if n, _ := r.notice("vikunja"); n.ToldTo != store.EndNoticeOperator { + t.Fatalf("fixture: the operator was not told: %+v", n) + } + // five days pass; the household now has an address, and its daily limit is used up by other notices + old := time.Now().UTC().Add(-5 * 24 * time.Hour) + if err := r.st.SetEndNoticeForTest("c1", "vikunja", "2026-11-15T10:00:00Z", old, old, store.EndNoticeOperator); err != nil { + t.Fatal(err) + } + if err := r.st.SaveNotificationPrefs("c1", household, []string{}, 6); err != nil { + t.Fatal(err) + } + for i := 0; i < 5; i++ { + if err := r.st.LogNotification("c1", "offsite_end_scheduled", "info", "offsite_end_scheduled other", "sent", "", "customer"); err != nil { + t.Fatal(err) + } + } + r.report(repPressed) + n, _ := r.notice("vikunja") + if n.ToldTo != store.EndNoticeOperator || !n.Told() || !strings.Contains(n.LastReason, "daily limit") { + t.Fatalf("fixture: the household's mail must have waited for the limit, the operator's notice standing: %+v", n) + } + if e := r.events(offsitekeys.EventEndNoticeStuck); len(e) != 0 { + t.Fatalf("a row that was told to the operator got the „told nobody” line: %+v", e) + } +}