R-1271 (P2): „use my kept data” never takes a copy dated in the future — a copy more than 10 minutes past the box's clock never counts as the newest (the newest true date wins, tie local); alone it is still offered, said and not recommended. Red-proved. Commit only.
gates / gates (push) Successful in 1m33s

This commit is contained in:
2026-10-25 09:44:56 +01:00
parent 2d71270858
commit bd9f4f7b74
13 changed files with 278 additions and 32 deletions
+9 -1
View File
@@ -20,6 +20,10 @@ type keptChoiceData struct {
UseDesc string `json:"use_desc"` // "" when use is off
UseOff string `json:"use_off"` // "" when use is offered
UseOffered bool `json:"use_offered"` // a database copy exists for these files
// UseFuture / UseWarn (R-1271): the only copy is dated in the future — offered, NOT recommended (the page draws
// „use" as the plain button), and the sentence says why.
UseFuture bool `json:"use_future,omitempty"`
UseWarn string `json:"use_warn,omitempty"`
FreshLabel string `json:"fresh_label"`
FreshDesc string `json:"fresh_desc"`
NotBacked string `json:"not_backed_up"`
@@ -71,13 +75,17 @@ func (r *Router) keptDataAtInstall(w http.ResponseWriter, req *http.Request, nam
}
if cp.ok {
data.UseDesc = r.msgLang(lang, "kept.choice.use.desc_from", r.keptCopyName(lang, cp.c))
if cp.c.Future {
data.UseFuture = true
data.UseWarn = r.msgLang(lang, "kept.choice.use.future", localMinute(cp.c.Time))
}
} else {
data.UseOff = r.msgLang(lang, "kept.choice.use_off")
}
switch choice {
case "":
r.logger.Printf("[INFO] [api] Deploy %s: the drive already holds its old data %v (%d bytes) — asking the household (use offered: %v)", name, old, size, cp.ok)
r.logger.Printf("[INFO] [api] Deploy %s: the drive already holds its old data %v (%d bytes) — asking the household (use offered: %v, future-dated: %v)", name, old, size, cp.ok, cp.c.Future)
writeJSON(w, http.StatusConflict, apiResponse{OK: false, Error: data.Title, Data: data})
return true
case stacks.KeptChoiceUse: