hub: review fix 4 — the hub writes the household's receipt; a box cannot word it or flood it (D84)
offsite_end_scheduled bypasses the household's switches and went through the ordinary customer leg: subject and body were the box's own sentence, and 50 invented subjects gave 50 mails. - processReceipt: the details must name a checked app (app-name shape, not reserved) and two parsed dates; the mail is rendered only from the hub's bundle with that app and the parsed end date — never the box's message. - The cooldown key is the checked app + the parsed time of the press. - At most 5 receipts per household in 24 hours, counted in the hub's sent log; drops are said once a day; old receipt keys leave the cooldown map. - Pinned: a blocked household and a household with no address get none. Tests seen red before the fix; 12 mutations seen red, 3 after a redo (documentation/audits/build-release-4-2026-11-15/A/redproof-review-4.txt). Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
875c339cf5
commit
be272b7cf4
10 files changed
+455
-26
No files matched your search
@@ -0,0 +1,105 @@
|
||||
FINDING 4 — offsite_end_scheduled let a box mail its household without limit and with its own words.
|
||||
|
||||
### RED: the new tests on the hub code before the fix (felhom.eu 875c339c)
|
||||
=== RUN TestD84_Receipt_ABoxCannotFloodOrWordTheHouseholdsMail
|
||||
d84_receipt_bounds_test.go:31: 50 mail(s) for receipts that name no app; subject="[Felhom] Információ: ANY WORDS THE BOX CHOOSES: pay at http://evil.example"
|
||||
--- FAIL: TestD84_Receipt_ABoxCannotFloodOrWordTheHouseholdsMail (0.06s)
|
||||
=== RUN TestD84_Receipt_IsBuiltFromCheckedDetailsOnly
|
||||
d84_receipt_bounds_test.go:81: removed_at is not a time: a mail went out: "[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: ends_at is not a time: a mail went out: "[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: ends before it was removed: a mail went out: "[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: no details: a mail went out: "[Felhom] Információ: box words"
|
||||
d84_receipt_bounds_test.go:81: a reserved name: a mail went out: "[Felhom] Információ: traefik: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: the shares: a mail went out: "[Felhom] Információ: _shares: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: no stack_name: a mail went out: "[Felhom] Információ: box words"
|
||||
d84_receipt_bounds_test.go:81: details are not JSON: a mail went out: "[Felhom] Információ: box words"
|
||||
d84_receipt_bounds_test.go:81: a sentence as the app name: a mail went out: "[Felhom] Információ: pay now at evil.example: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: markup as the app name: a mail went out: "[Felhom] Információ: <b>x</b>: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:89: the mail must carry the parsed end date and none of the box's text: [{to:customer@example.com subject:[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve body:Kedves Ügyfél!
|
||||
--- FAIL: TestD84_Receipt_IsBuiltFromCheckedDetailsOnly (0.49s)
|
||||
=== RUN TestD84_Receipt_ABlockedHouseholdGetsNone
|
||||
--- PASS: TestD84_Receipt_ABlockedHouseholdGetsNone (0.04s)
|
||||
FAIL
|
||||
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/notify 0.613s
|
||||
FAIL
|
||||
(TestD84_Receipt_ABlockedHouseholdGetsNone passed before the fix too: the customer leg already skipped a blocked household. It is a pin, and it has its own mutation below.)
|
||||
|
||||
### After the fix: mutations
|
||||
== MUTATION: the receipt goes through the ordinary customer leg again (the box's words, the box's subject)
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_ABoxCannotFloodOrWordTheHouseholdsMail (0.04s)
|
||||
d84_receipt_bounds_test.go:38: 50 presses in one burst gave 0 mails, want the daily limit 5
|
||||
--- FAIL: TestD84_Receipt_IsBuiltFromCheckedDetailsOnly (0.48s)
|
||||
d84_receipt_bounds_test.go:89: the mail must carry the parsed end date and none of the box's text: []
|
||||
== MUTATION: no daily limit
|
||||
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
|
||||
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/notify [build failed]
|
||||
internal/notify/dispatcher.go:872:2: declared and not used: sentToday
|
||||
== MUTATION: the limit trusts the sent log alone (a burst is faster than the log)
|
||||
*** NOT A RED-PROOF *** (mutant rc=0 built=True real rc=0)
|
||||
== MUTATION: the app name is not checked
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_IsBuiltFromCheckedDetailsOnly (0.40s)
|
||||
d84_receipt_bounds_test.go:81: a sentence as the app name: a mail went out: "[Felhom] Információ: pay now at evil.example: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: the shares: a mail went out: "[Felhom] Információ: _shares: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: markup as the app name: a mail went out: "[Felhom] Információ: <b>x</b>: a távoli másolatok törlésre kijelölve"
|
||||
== MUTATION: a reserved name gets a receipt
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_IsBuiltFromCheckedDetailsOnly (0.44s)
|
||||
d84_receipt_bounds_test.go:81: a reserved name: a mail went out: "[Felhom] Információ: traefik: a távoli másolatok törlésre kijelölve"
|
||||
== MUTATION: the dates are not checked
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_IsBuiltFromCheckedDetailsOnly (0.46s)
|
||||
d84_receipt_bounds_test.go:81: removed_at is not a time: a mail went out: "[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: ends_at is not a time: a mail went out: "[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve"
|
||||
d84_receipt_bounds_test.go:81: ends before it was removed: a mail went out: "[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve"
|
||||
== MUTATION: an end before the press is accepted
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_IsBuiltFromCheckedDetailsOnly (0.49s)
|
||||
d84_receipt_bounds_test.go:81: ends before it was removed: a mail went out: "[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve"
|
||||
== MUTATION: the press's key is the app alone
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_OncePerPress (0.04s)
|
||||
d84_receipt_test.go:97: three presses gave 2 mails, want 3: [{to:customer@example.com subject:[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve body:Kedves Ügyfél!
|
||||
== MUTATION: the press's time is keyed as the box wrote it (another zone = another press)
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_IsBuiltFromCheckedDetailsOnly (0.47s)
|
||||
d84_receipt_bounds_test.go:96: one press sent twice with a changed subject gave 2 mails
|
||||
== MUTATION: a blocked household gets the receipt
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_ABlockedHouseholdGetsNone (0.04s)
|
||||
d84_receipt_bounds_test.go:108: a blocked household was mailed: [{to:customer@example.com subject:[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve body:Kedves Ügyfél!
|
||||
== MUTATION: old presses stay in the cooldown map (and count against today)
|
||||
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
|
||||
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/notify [build failed]
|
||||
internal/notify/dispatcher.go:879:9: declared and not used: at
|
||||
== MUTATION: the mail's date is today, not the parsed end
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_IsBuiltFromCheckedDetailsOnly (0.47s)
|
||||
d84_receipt_bounds_test.go:89: the mail must carry the parsed end date and none of the box's text: [{to:customer@example.com subject:[Felhom] Információ: vikunja: a távoli másolatok törlésre kijelölve body:Kedves Ügyfél!
|
||||
--- FAIL: TestD84_Receipt_ReachesTheHouseholdWhateverItsSwitches (0.04s)
|
||||
d84_receipt_test.go:54: the body lacks "2026. 12. 15.":
|
||||
|
||||
12 mutations, 3 not a red-proof
|
||||
|
||||
### the three mutations done again
|
||||
== MUTATION: REDO (the first mutant did not compile): no daily limit
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_ABoxCannotFloodOrWordTheHouseholdsMail (0.07s)
|
||||
d84_receipt_bounds_test.go:38: 50 presses in one burst gave 50 mails, want the daily limit 5
|
||||
--- FAIL: TestD84_Receipt_TheDailyLimitSurvivesARestart (0.04s)
|
||||
d84_receipt_bounds_test.go:168: after a restart the household got mail number 6 of the day (limit 5)
|
||||
== MUTATION: REDO (the first mutant was built wrongly: it left the part it meant to remove; and the test that sees this one was added): the limit does not read the sent log (a restart gives five more)
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_TheDailyLimitSurvivesARestart (0.05s)
|
||||
d84_receipt_bounds_test.go:168: after a restart the household got mail number 6 of the day (limit 5)
|
||||
== MUTATION: REDO (the first mutant did not compile): old presses stay in the cooldown map (and count against today)
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestD84_Receipt_OldPressesLeaveTheCooldownMap (0.04s)
|
||||
d84_receipt_bounds_test.go:133: 30 presses of yesterday must not count against today's limit: 0 mail(s)
|
||||
|
||||
3 mutations, 0 not a red-proof
|
||||
|
||||
NOT PROVEN, said plainly: the in-memory half of the limit (`inFlight >= receiptsPerDay`). In a test the events are
|
||||
processed one after another, so the sent log is always written before the next one is judged and the log half
|
||||
alone holds the limit. The memory half is for a burst processed in parallel; it stays in the code and is not claimed.
|
||||
Reference in new issue
Block a user