hub: the off-site copies of a removed app end after 30 days — the hub agrees first, the allowance is beside the cap, the household's mail (R-1374 part 1, D72, D84)

Built, not deployed. `07-backup-architecture.md` §8.2f parts 3-4 and decision 309.

- store: the hub's own record of which apps a box runs, by the hub's clock
  (offsite_app_presence, fed by every controller report); it goes with the household.
- offsitekeys: window-open takes the box's due end records and answers
  ended_allowed / ended_refused. An app is agreed only after 30 days of absence
  in the hub's record; an id only when the hub's own listing holds it, uploaded
  before that absence. The cap (max_remove) is unchanged; the close keeps only
  agreed ids from removed_for_ended_apps and allows them beside the cap.
- The 07:10 audit explains the ended apps' vanished files by name and still
  raises for every other vanished file.
- notify: offsite_end_scheduled is a household receipt — one mail per press to
  the household's own address, whatever its switches; the operator is not mailed.
- Two operator-only hub records: offsite_ended_app_removed (info),
  offsite_ended_app_refused (warning).

Tests TestD72_*, TestD84_*; 44 mutations seen red, 5 after a redo
(documentation/audits/build-release-4-2026-11-15/A/redproof-hub-*.txt).

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-15 13:26:13 +01:00
1 parent 552e19cd3d
commit 01a106b78c
33 files changed
+1834 -24

No files matched your search

@@ -0,0 +1,29 @@
### internal/api/handler.go
== MUTATION: a report does not feed the hub's app record
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_ReportFeedsTheHubsOwnAppRecord (0.05s)
d84_ended_test.go:41: immich is listed: map[]
== MUTATION: a pending end record does not start the hub's clock
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_ReportFeedsTheHubsOwnAppRecord (0.05s)
d84_ended_test.go:46: oldapp must be absent since NOW by the hub's clock (the box's 2024 date is not read): {Present:false AbsentSince:0001-01-01 00:00:00 +0000 UTC} ok=false
== MUTATION: a report with no app list empties the record
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_ReportFeedsTheHubsOwnAppRecord (0.05s)
/mnt/5_hdd/felhom.eu/git/felhom.eu/hub/internal/api/d84_ended_test.go:27 +0x23d
/mnt/5_hdd/felhom.eu/git/felhom.eu/hub/internal/api/d84_ended_test.go:50 +0x4b7
== MUTATION: a box cannot send the receipt (400)
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_EventTypes (0.00s)
d84_ended_test.go:79: offsite_end_scheduled must be accepted from a box (POST /event would answer 400)
4 mutations, 0 not a red-proof
### internal/api/offsite.go
== MUTATION: the window-open drops the box's claims
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_WindowOpenCarriesTheEndedClaims (0.04s)
d84_ended_test.go:72: the service did not receive the claim: []
1 mutations, 0 not a red-proof
@@ -0,0 +1,111 @@
### internal/offsitekeys/ended.go
== MUTATION: an installed app is agreed
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:110: refusal for "vikunja" = "the hub's record of when the app left cannot be read", want it to say "lists the app as installed" (all: [{App:vikunja Reason:the hub's record of when the app left cannot be read} {App:
ended_test.go:110: refusal for "immich" = "the hub's record of when the app left cannot be read", want it to say "installed" (all: [{App:immich Reason:the hub's record of when the app left cannot be read} {App: Reason:1 snapshot i
--- FAIL: TestD84_Window_TheEndedAllowanceIsBesideTheCap (0.05s)
== MUTATION: the 30 days are not checked
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:106: agreed ids = [a1b2c685], want [] (refused: [])
ended_test.go:106: agreed ids = [a1b2c685], want [] (refused: [])
ended_test.go:106: agreed ids = [a1b2c685], want [] (refused: [])
== MUTATION: an app with no hub record is not refused as such
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/offsitekeys [build failed]
internal/offsitekeys/ended.go:75:6: declared and not used: known
== MUTATION: an unreadable absence date reads as long ago
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide/an_absence_whose_date_cannot_be_read_is_never_long_ago (0.00s)
ended_test.go:110: refusal for "vikunja" = "", want it to say "cannot be read" (all: [{App: Reason:1 snapshot id(s) refused: uploaded after the hub saw the app leave}])
== MUTATION: _shares and the marker are eligible
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:110: refusal for "_shares" = "", want it to say "not an app" (all: [{App: Reason:2 snapshot id(s) refused: uploaded after the hub saw the app leave}])
== MUTATION: a snapshot also listed under a refused app is agreed
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:106: agreed ids = [a1b2c685 a1b2c686], want [a1b2c685] (refused: [{App:immich Reason:the box's newest report lists the app as installed}])
== MUTATION: a file uploaded after the app left is agreed
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:106: agreed ids = [a1b2c685 a1b2c68b], want [a1b2c685] (refused: [])
ended_test.go:106: agreed ids = [a1b2c685 a1b2c688], want [a1b2c685] (refused: [])
== MUTATION: a shared snapshot is measured against the FIRST app only
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:106: agreed ids = [a1b2c685 a1b2c68b], want [a1b2c685] (refused: [])
== MUTATION: ids are agreed with no hub listing
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:106: agreed ids = [a1b2c685], want [] (refused: [])
== MUTATION: a file with no upload time is agreed
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:106: agreed ids = [a1b2c689 a1b2c68a], want [a1b2c68a] (refused: [])
== MUTATION: an id the hub's listing does not hold is not refused as such
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/offsitekeys [build failed]
internal/offsitekeys/ended.go:139:7: declared and not used: listed
== MUTATION: every refusal is told to the operator
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Window_ARefusalTellsTheOperatorOnlyWhenItIsClear (0.04s)
ended_test.go:250: the operator must hear kimai (2 days) and immich (installed), and not `nearly` (an hour early); heard [kimai nearly immich]
== MUTATION: an installed app's refusal is NOT told
*** NOT A RED-PROOF *** (mutant rc=0 built=True real rc=0)
13 mutations, 3 not a red-proof
### internal/offsitekeys/service.go
== MUTATION: the ended ids get no allowance of their own (they count under the cap)
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Window_TheEndedAllowanceIsBesideTheCap (0.05s)
ended_test.go:185: a fall of cap + agreed ended ids raised the drop alarm: [{typ:offsite_window_drop sev:error msg:Off-site clean-up window 1: the snapshot count fell 20 -> 4, more than a window may remove (10).}]
== MUTATION: the allowance takes the box's word, not the agreed ids
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Window_TheEndedAllowanceIsBesideTheCap (0.05s)
ended_test.go:206: a fall beyond the cap with NO agreed id must raise the drop alarm, got [{typ:offsite_ended_app_refused sev:warning msg:Off-site clean-up: the box of c1 asked to remove the off-site copies of the removed app "imm
== MUTATION: the grant does not carry what the hub agreed to
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Window_TheEndedAllowanceIsBesideTheCap (0.05s)
ended_test.go:173: agreed ids = [], want the six of vikunja
== MUTATION: the grant does not say what was refused
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Window_TheEndedAllowanceIsBesideTheCap (0.04s)
ended_test.go:176: the window must say that immich was refused, and why: []
== MUTATION: no per-app record at the close
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Window_TheEndedAllowanceIsBesideTheCap (0.05s)
ended_test.go:189: want one info record for vikunja with 6 snapshots: []
5 mutations, 0 not a red-proof
### internal/offsitekeys/snapshot_watch.go
== MUTATION: the audit spends the ended allowance on OTHER vanished files
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Audit_ExplainsEndedAppsAndStillRaisesForTheRest (0.09s)
ended_test.go:300: one file vanished outside the agreement: want it judged alone, got 0
== MUTATION: the audit does not explain the ended apps' files
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Audit_ExplainsEndedAppsAndStillRaisesForTheRest (0.04s)
ended_test.go:286: the ended apps' files were judged as vanished (3)
2 mutations, 0 not a red-proof
### internal/offsitekeys/ended.go — the three mutations done again
== MUTATION: REDO (the first mutant did not compile): an app with no hub record is not refused as such
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:110: refusal for "ghost" = "the hub's record of when the app left cannot be read", want it to say "no record" (all: [{App:ghost Reason:the hub's record of when the app left cannot be read} {App: Reason:1 snapshot id(
== MUTATION: REDO (the first mutant did not compile): an id the hub's listing does not hold is not refused as such
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:110: refusal for "" = "1 snapshot id(s) refused: no upload time in the hub's own listing", want it to say "not in the hub's own listing" (all: [{App: Reason:1 snapshot id(s) refused: no upload time in the hub's own l
== MUTATION: REDO (the first mutant was EQUAL to the real code: `p.Present` was redundant beside the zero date and was removed from the source): an installed app's refusal is NOT told
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Window_ARefusalTellsTheOperatorOnlyWhenItIsClear (0.04s)
ended_test.go:250: the operator must hear kimai (2 days) and immich (installed), and not `nearly` (an hour early); heard [kimai]
3 mutations, 0 not a red-proof
@@ -0,0 +1,44 @@
### internal/notify/dispatcher.go
== MUTATION: the receipt reads the household's switches
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Receipt_ReachesTheHouseholdWhateverItsSwitches (0.04s)
d84_receipt_test.go:43: mails = 0, want exactly one (to the household): []
--- FAIL: TestD84_Receipt_FollowsTheHouseholdsLanguage (0.04s)
d84_receipt_test.go:70: mails = 0: []
== MUTATION: the receipt's cooldown is per type, not per press
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Receipt_OncePerPress (0.04s)
d84_receipt_test.go:97: three presses gave 1 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: no receipt branch: an info event mails nobody
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Receipt_ReachesTheHouseholdWhateverItsSwitches (0.04s)
d84_receipt_test.go:43: mails = 0, want exactly one (to the household): []
--- FAIL: TestD84_Receipt_FollowsTheHouseholdsLanguage (0.05s)
d84_receipt_test.go:70: mails = 0: []
== MUTATION: the receipt also mails the operator
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Receipt_ReachesTheHouseholdWhateverItsSwitches (0.04s)
d84_receipt_test.go:43: mails = 2, want exactly one (to the household): [{to:operator@felhom.eu subject:[Felhom] ⚠️ c1: offsite_end_scheduled body:Customer: c1
--- FAIL: TestD84_Receipt_FollowsTheHouseholdsLanguage (0.04s)
d84_receipt_test.go:70: mails = 2: [{to:operator@felhom.eu subject:[Felhom] ⚠️ c1: offsite_end_scheduled body:Customer: c1
== MUTATION: the hub-made records are not operator-only
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_EventTypes (0.00s)
d84_ended_test.go:89: offsite_ended_app_removed must be operator-only
5 mutations, 0 not a red-proof
### internal/notify/templates.go
== MUTATION: the receipt carries the raw details
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Receipt_ReachesTheHouseholdWhateverItsSwitches (0.04s)
d84_receipt_test.go:58: the body carries the raw details:
== MUTATION: the receipt's subject does not name the app
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_Receipt_ReachesTheHouseholdWhateverItsSwitches (0.04s)
d84_receipt_test.go:50: the subject does not name the app: "[Felhom] Információ: %s: a távoli másolatok törlésre kijelölve"
--- FAIL: TestD84_Receipt_FollowsTheHouseholdsLanguage (0.04s)
d84_receipt_test.go:74: not the English receipt:
2 mutations, 0 not a red-proof
@@ -0,0 +1,16 @@
== MUTATION: the window block never shows the removed-apps line
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_TheWindowBlockSaysWhatWasAgreedAndRefused (0.15s)
offsite_window_test.go:261: the window block lacks "id=\"window-ended\""
offsite_window_test.go:261: the window block lacks "3 snapshot(s) agreed outside the cap, 2 removed"
offsite_window_test.go:261: the window block lacks "<strong>refused</strong> immich: the box&#39;s newest report lists the app as installed"
== MUTATION: the window block does not say what was refused
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_TheWindowBlockSaysWhatWasAgreedAndRefused (0.16s)
offsite_window_test.go:261: the window block lacks "<strong>refused</strong> immich: the box&#39;s newest report lists the app as installed"
== MUTATION: the removed-apps line shows on every window
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_TheWindowBlockSaysWhatWasAgreedAndRefused (0.15s)
offsite_window_test.go:249: a window with no removed app must not render the removed-apps line
3 mutations, 0 not a red-proof
@@ -0,0 +1,61 @@
### internal/store/offsite_ended.go
== MUTATION: an absent app's date moves at every report
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/store [build failed]
internal/store/offsite_ended.go:92:11: declared and not used: p
== MUTATION: an install does not end the absence
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_NoteAppList_TheHubsOwnClock (0.05s)
d84_ended_test.go:43: an install must end the absence: {Present:false AbsentSince:2026-11-01 04:00:00 +0000 UTC}
== MUTATION: a repeated claim moves the hub's date
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_NoteAppList_TheHubsOwnClock (0.05s)
d84_ended_test.go:54: a claimed, never-seen app must be absent since the first claim (2026-11-04 11:00:00 +0000 UTC): {Present:false AbsentSince:2026-11-04 21:00:00 +0000 UTC} ok=true
== MUTATION: a claim makes a LISTED app absent
*** NOT A RED-PROOF *** (mutant rc=0 built=True real rc=0)
== MUTATION: the box's result stores ids the hub never agreed to
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_EndedRemoved_OnlyAgreedIdsAreStored (0.04s)
d84_ended_test.go:129: kept = [a1 a2 living zz] err=<nil>, want [a1 a2]
5 mutations, 2 not a red-proof
### internal/store/offsite_keys.go
== MUTATION: a closed window explains every AGREED id, not the ones the box named
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_WindowCredits_TheEndedAllowanceIsBesideTheCap (0.04s)
d84_ended_test.go:93: a: want cap 9 + ended 3 = 12, got {ID:1 Explains:12 CapExplains:8 EndedIDs:[x1 x2 x3 x4]}
== MUTATION: the ended ids are also spent from the cap
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_WindowCredits_TheEndedAllowanceIsBesideTheCap (0.04s)
d84_ended_test.go:93: a: want cap 9 + ended 3 = 12, got {ID:1 Explains:15 CapExplains:12 EndedIDs:[x1 x2 x3]}
2 mutations, 0 not a red-proof
### internal/store/customer_delete.go
== MUTATION: the app record is not in the household's delete
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecordGoesWithTheHousehold (0.04s)
d84_ended_test.go:152: the residue count does not see the app record: &{Reports:0 AppTelemetry:0 AppLogTails:0 LogTailRequests:0 NotificationPrefs:0 SelfBindTokens:0 ApplianceRegistrations:0 AppLogIssueRefs:0 OffsiteKeys:0 Offsite
1 mutations, 0 not a red-proof
### internal/store/orphan_rows.go
== MUTATION: the app record is not in the orphan sweep
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecordGoesWithTheHousehold (0.05s)
d84_ended_test.go:165: orphan sweep: map[] <nil>
1 mutations, 0 not a red-proof
### internal/store/offsite_ended.go — the two mutations done again
== MUTATION: REDO (the first mutant did not compile): an absent app's date moves at every report
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_NoteAppList_TheHubsOwnClock (0.05s)
d84_ended_test.go:35: vikunja must be absent since the first report without it (2026-11-01 04:00:00 +0000 UTC), got {Present:false AbsentSince:2026-11-01 08:00:00 +0000 UTC}
== MUTATION: REDO (the first run stayed green: the test had no listed app that was new to the hub; the case was added): a claim makes a LISTED app absent
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_NoteAppList_TheHubsOwnClock (0.04s)
d84_ended_test.go:62: a listed app named in an end record must be present: {Present:false AbsentSince:2026-11-04 22:00:00 +0000 UTC} ok=true
2 mutations, 0 not a red-proof