nudges: a resolved outcome and a way to close a pending alarm (V-535)
The sev4 repeat path reads the nudges table, so ending an alarm means writing an ending there. 'resolved' is the daemon closing it because the condition cleared, which is neither 'acted' nor 'ignored'. ResolvePendingTelegram is rule-scoped and accepts only the two endings the daemon may write. OldestPendingTelegram backs the age cap and scans into a NullInt64, because MIN over an empty set is one NULL row, not zero rows. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,9 @@ CREATE TABLE IF NOT EXISTS nudges (
|
||||
rule TEXT NOT NULL,
|
||||
channel TEXT NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
outcome TEXT NOT NULL DEFAULT 'pending' CHECK (outcome IN ('pending','acted','snoozed','ignored')),
|
||||
-- 'resolved' is the daemon closing an alarm because the condition cleared,
|
||||
-- as opposed to 'acted' (he answered) or 'ignored' (nobody ever did).
|
||||
outcome TEXT NOT NULL DEFAULT 'pending' CHECK (outcome IN ('pending','acted','snoozed','ignored','resolved')),
|
||||
outcome_ts INTEGER
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_nudges_rule_ts ON nudges (rule, ts DESC);
|
||||
|
||||
Reference in New Issue
Block a user