Make delivery and integration failures explicit

Persist reminder presentations and retry state, atomically complete collapsed deliveries, fall back across away reaches, and block permanent failures visibly (V-715, V-678). Fail closed when enabled integrations lack credentials and keep remote arms explicitly dark (V-691). Give mavweb one sanitized, request-correlated error contract (V-689). Owner explicitly requested direct commits to master.
This commit is contained in:
2026-08-13 02:50:59 +04:00
parent da9114b623
commit 35c6ff5a71
67 changed files with 3174 additions and 477 deletions
+15 -5
View File
@@ -3,7 +3,7 @@ package main
import (
_ "embed"
"encoding/json"
"log"
"fmt"
"net/http"
"strings"
@@ -26,6 +26,7 @@ type reminderRow struct {
Created string
Fires string
Status string
Detail string
Text string
}
@@ -50,10 +51,19 @@ func reminderText(payload string) string {
func reminderRows(rs []ipc.Reminder) []reminderRow {
out := make([]reminderRow, 0, len(rs))
for _, r := range rs {
status := r.Status
detail := ""
if !r.DeliveryBlockedTs.IsZero() {
status = "blocked"
detail = r.DeliveryBlockedError
} else if r.DeliveryAttempts > 0 && !r.NextAttemptTs.IsZero() {
detail = "retry " + r.NextAttemptTs.Local().Format("02 Jan 15:04")
}
out = append(out, reminderRow{
Created: r.CreatedTs.Local().Format("02 Jan 15:04"),
Fires: r.FireTs.Local().Format("02 Jan 15:04"),
Status: r.Status,
Status: status,
Detail: detail,
Text: reminderText(r.Payload),
})
}
@@ -61,13 +71,13 @@ func reminderRows(rs []ipc.Reminder) []reminderRow {
}
func handleReminders(w http.ResponseWriter, r *http.Request, core ipc.CoreAPI) {
if !requireCore(w, core, "reminders") {
if !requireCore(w, r, core, "reminders") {
return
}
reminders, err := core.ListReminders(r.Context(), 50)
if err != nil {
log.Printf("reminders: %v", err)
http.Error(w, "reminders error: "+err.Error(), http.StatusBadGateway)
writeProblem(w, r, http.StatusBadGateway, problemCoreReadFailed,
"reminders unavailable", fmt.Errorf("list reminders: %w", err))
return
}
renderPage(w, remindersTmpl, map[string]any{"Reminders": reminderRows(reminders)})