Run the reader's batches: paced, judged, written as entries, unhealthy on failure (issue 1520)

This commit is contained in:
jochen
2026-10-21 00:18:37 +02:00
parent 83bc01e746
commit 42bffb9363
8 changed files with 952 additions and 25 deletions
@@ -2,7 +2,7 @@
-- numbered migration for the running store, and this for a fresh install).
create table mail_group (
id bigserial primary key,
label text not null default '',
label text not null unique default '',
created timestamptz not null default now());
create table mail_entry (
@@ -19,16 +19,27 @@ create table mail_entry (
mark text check (mark is null or mark in ('matters', 'scam warning', 'neither')),
why text not null default '',
due_date date,
told boolean not null default false);
told boolean not null default false,
judged timestamptz not null default now());
create index mail_entry_account_date on mail_entry (account, date desc);
create index mail_entry_judged on mail_entry (judged);
-- A reading lesson (novox/hq ADR 0459 §8, §9, issue 1428): the corrected mail's own headers (never a body),
-- the change made, when, and whether it was undone. sender_address and mail_group are its own matching keys
-- for the next batch's question (1427): a lesson matches a mail of the same sender, or already known to be
-- of the same mail group.
create table reading_lesson (
id bigserial primary key,
account text not null default '',
headers jsonb not null default '{}',
change text not null default '',
made timestamptz not null default now(),
undone boolean not null default false);
id bigserial primary key,
account text not null default '',
folder text not null default '',
sender_name text not null default '',
sender_address text not null default '',
subject text not null default '',
mail_group bigint references mail_group (id),
change text not null default '',
made timestamptz not null default now(),
undone boolean not null default false);
create index reading_lesson_sender on reading_lesson (sender_address);
-- Heard but not yet read (novox/hq ADR 0459 §3, §12, issue 1518): headers only, kept until reading takes them,
-- in the order they were heard (id, a bigserial, orders arrival regardless of the mail's own date). A mail