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
+23
View File
@@ -351,6 +351,29 @@ ALTER TABLE reminders ADD COLUMN next_fire_ts INTEGER;`, // #2
source TEXT NOT NULL DEFAULT '',
encoder_id TEXT NOT NULL DEFAULT ''
);`,
// #25 — durable reminder delivery state (V-651). A reminder can remain
// pending for a long time when every reachable transport is unhealthy. The
// phrased text belongs to that delivery occurrence, so retaining it here
// avoids spending the resident model again on every retry and across daemon
// restarts. next_attempt_ts makes transport failures wait on a bounded
// exponential backoff instead of retrying at the tick rate. delivery_group
// keeps the originals of a collapsed catch-up bundle together; a reminder
// that becomes due later must not make the old bundle get re-phrased.
`ALTER TABLE reminders ADD COLUMN delivery_group TEXT NOT NULL DEFAULT '';
ALTER TABLE reminders ADD COLUMN phrase_body TEXT NOT NULL DEFAULT '';
ALTER TABLE reminders ADD COLUMN phrase_summary TEXT NOT NULL DEFAULT '';
ALTER TABLE reminders ADD COLUMN phrase_mood TEXT NOT NULL DEFAULT '';
ALTER TABLE reminders ADD COLUMN delivery_attempts INTEGER NOT NULL DEFAULT 0 CHECK (delivery_attempts >= 0);
ALTER TABLE reminders ADD COLUMN next_attempt_ts INTEGER;
ALTER TABLE delivery_attempts ADD COLUMN delivery_group TEXT NOT NULL DEFAULT '';
ALTER TABLE reminders ADD COLUMN delivery_blocked_ts INTEGER;
ALTER TABLE reminders ADD COLUMN delivery_blocked_error TEXT NOT NULL DEFAULT '';
CREATE INDEX IF NOT EXISTS idx_reminders_due
ON reminders (next_fire_ts, next_attempt_ts)
WHERE status = 'pending';
CREATE INDEX IF NOT EXISTS idx_delivery_attempts_reminder_group
ON delivery_attempts (delivery_group, status)
WHERE kind = 'reminder' AND delivery_group <> '';`,
}
// migrate applies every migration with a number greater than the DB's current