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:
1 parent
552e19cd3d
commit
01a106b78c
33 files changed
+1834
-24
No files matched your search
@@ -481,6 +481,9 @@ func (h *Handler) handleReport(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// D72 (`07` §8.2f part 4): the hub's own record of which apps this box runs, by the hub's clock.
|
||||
h.noteAppList(payload.CustomerID, body)
|
||||
|
||||
// Parse and save app telemetry (backward-compatible — old controllers won't have this field)
|
||||
var telemetryPayload struct {
|
||||
AppTelemetry []store.AppTelemetryRecord `json:"app_telemetry"`
|
||||
@@ -2490,6 +2493,10 @@ var allowedEventTypes = map[string]bool{
|
||||
// — who, app, the restore's date, size. Operator-only (notify.operatorOnlyEvents) — registered in BOTH in the same
|
||||
// commit.
|
||||
"restore_copy_deleted": true,
|
||||
// D84 (`09` §3 decision 309; `07` §8.2f): the household pressed „delete backup data” for an app — its off-site
|
||||
// copies end 30 days later. A household RECEIPT (notify.householdReceiptEvents): mailed to the household's own
|
||||
// address once per press, never to the operator; `mail.event.offsite_end_scheduled` in both bundles.
|
||||
"offsite_end_scheduled": true,
|
||||
// Special
|
||||
"test": true,
|
||||
}
|
||||
@@ -3663,3 +3670,36 @@ func (h *Handler) recordHeldApp(customerID, eventType string, raw json.RawMessag
|
||||
}
|
||||
h.logger.Printf("[DEBUG] [held-apps] %s/%s held (%s since %s)", customerID, d.StackName, d.Reason, d.Since)
|
||||
}
|
||||
|
||||
// noteAppList keeps the hub's own record of which apps a box runs (store.NoteAppList) from one controller report:
|
||||
// `stacks.deployed` is the app list, `offsite.ended_apps` the apps the box holds a pending off-site end record for.
|
||||
// A report with no `stacks` object changes nothing — an absent list is not an empty list. The box's dates in
|
||||
// `ended_apps` are not read: the clock is the hub's (D72, `09` §3 decision 292).
|
||||
func (h *Handler) noteAppList(customerID string, body []byte) {
|
||||
var p struct {
|
||||
Stacks *struct {
|
||||
Deployed []string `json:"deployed"`
|
||||
} `json:"stacks"`
|
||||
Offsite *struct {
|
||||
EndedApps []struct {
|
||||
App string `json:"app"`
|
||||
// The box's own dates. Carried on the wire for the operator's reading of a stored report; the
|
||||
// hub decides by its own clock and never by these.
|
||||
RemovedAt string `json:"removed_at"`
|
||||
EndsAt string `json:"ends_at"`
|
||||
} `json:"ended_apps"`
|
||||
} `json:"offsite"`
|
||||
}
|
||||
if err := json.Unmarshal(body, &p); err != nil || p.Stacks == nil {
|
||||
return
|
||||
}
|
||||
var claimed []string
|
||||
if p.Offsite != nil {
|
||||
for _, e := range p.Offsite.EndedApps {
|
||||
claimed = append(claimed, e.App)
|
||||
}
|
||||
}
|
||||
if err := h.store.NoteAppList(customerID, p.Stacks.Deployed, claimed, time.Now()); err != nil {
|
||||
h.logger.Printf("[WARN] [api] report from %s: the hub's own app record could not be updated: %v", customerID, err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user