feat(notify): due-soon Taskwarrior notifications #5

Merged
jmz merged 3 commits from feat/task-notify into feat/today-tasks 2026-10-09 18:58:29 +00:00
Owner

Stacked on #4 (feat/today-tasks). Adds Taskwarrior due-soon pings to the kal notify daemon, reusing the read-only kal.tasks runner.

Behaviour

  • A pending task notifies task_lead before it is due: title = description (truncated to about 80 chars), message due in 15 min · 21:00 · sospel (project omitted when empty).
  • Fires once per task per due time. The dedup key is task:{uuid}@{due iso}, so moving the due re-arms it.
  • Skips waiting/snoozed tasks (wait still in the future) and anything not pending (completed, deleted).
  • Date-only / end-of-day dues (local 00:00:00 or 23:59:59) get no lead-time ping at 23:44. Instead they get one "due today" ping at task_morning, or on the first scan after it (key task-today:{uuid}@{date}).
  • Wall-clock rules are DST-safe. The daemon uses system local time, as event notifications already do.

Daemon

run_once (when tasks is on) queries only status:pending due.after:now-1min due.before:now+<lead+tick+1m> plus +DUETODAY status:pending. Any task failure (not installed, timeout, garbage output, or an unexpected exception) is logged and swallowed, so event notifications keep working. The task runner is injectable (task_runner=).

Config ([notify], all defaults on)

tasks = true
task_lead = "15m"
task_morning = "09:00"

Tests

tests/test_notify_tasks.py (54 tests) covers timing and the poll-tick grace, dedup, re-arm on due change, the wait skip, the end-of-day morning ping and catch-up, DST spring/fall in Europe/Monaco, system-local vs explicit zone, and config parse/save. A daemon test with a fake runner proves that task errors don't break event notifications. The full suite passes under TZ=Europe/Monaco and TZ=UTC (364 passed), and ruff check . is clean.

🤖 Generated with Claude Code

Stacked on #4 (`feat/today-tasks`). Adds Taskwarrior due-soon pings to the `kal notify` daemon, reusing the read-only `kal.tasks` runner. ## Behaviour - A pending task notifies `task_lead` before it is due: title = description (truncated to about 80 chars), message `due in 15 min · 21:00 · sospel` (project omitted when empty). - Fires once per task per due time. The dedup key is `task:{uuid}@{due iso}`, so moving the due re-arms it. - Skips waiting/snoozed tasks (`wait` still in the future) and anything not pending (completed, deleted). - Date-only / end-of-day dues (local 00:00:00 or 23:59:59) get no lead-time ping at 23:44. Instead they get one "due today" ping at `task_morning`, or on the first scan after it (key `task-today:{uuid}@{date}`). - Wall-clock rules are DST-safe. The daemon uses system local time, as event notifications already do. ## Daemon `run_once` (when `tasks` is on) queries only `status:pending due.after:now-1min due.before:now+<lead+tick+1m>` plus `+DUETODAY status:pending`. Any task failure (not installed, timeout, garbage output, or an unexpected exception) is logged and swallowed, so event notifications keep working. The task runner is injectable (`task_runner=`). ## Config (`[notify]`, all defaults on) ```toml tasks = true task_lead = "15m" task_morning = "09:00" ``` ## Tests `tests/test_notify_tasks.py` (54 tests) covers timing and the poll-tick grace, dedup, re-arm on due change, the wait skip, the end-of-day morning ping and catch-up, DST spring/fall in Europe/Monaco, system-local vs explicit zone, and config parse/save. A daemon test with a fake runner proves that task errors don't break event notifications. The full suite passes under `TZ=Europe/Monaco` and `TZ=UTC` (364 passed), and `ruff check .` is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(notify): add due-soon Taskwarrior notifications
All checks were successful
check / check (push) Successful in 1m23s
check / check (pull_request) Successful in 1m23s
7e3d2d5faf
The notify daemon now also pings for pending Taskwarrior tasks a
configurable lead time before they are due ("due in 15 min · 21:00 ·
sospel"), reusing the read-only kal.tasks runner.

- Pure due_task_notifications(): fires once per task per due time
  (key task:{uuid}@{due}, so moving the due re-arms it); skips
  non-pending and still-waiting (snoozed) tasks.
- Date-only / end-of-day dues (local 00:00 or 23:59:59) get no 23:44
  lead ping; they get one "due today" ping from task_morning instead
  (key task-today:{uuid}@{date}). Wall-clock rules are DST-safe.
- run_once queries only the lead window plus +DUETODAY; any task
  failure is logged and swallowed so event notifications keep working.
- Config under [notify]: tasks = true, task_lead = "15m",
  task_morning = "09:00".
- Task gains status and wait fields parsed from the export.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(notify): treat UTC-midnight task dues as date-only
All checks were successful
check / check (push) Successful in 1m20s
check / check (pull_request) Successful in 1m22s
bc3b3189f9
A date-only due entered on a UTC host is stored as 00:00Z, which is 01:00 or
02:00 in Monaco: it would have pinged at night. Give it the morning
"due today" ping like local end-of-day dues.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(notify): log the daemon to ~/Library/Logs
All checks were successful
check / check (push) Successful in 1m23s
check / check (pull_request) Successful in 1m24s
7d8de94f25
The daemon's warnings went nowhere (no logging config, no launchd output
paths). Now --daemon logs to ~/Library/Logs/kal-notify.log (rotating, 1 MB x
2) including each sent notification, and the launchd plist sends
stdout/stderr (crashes) to kal-notify.err.log.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
jmz merged commit b734154501 into feat/today-tasks 2026-10-09 18:58:29 +00:00
jmz deleted branch feat/task-notify 2026-10-09 18:58:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/kal!5
No description provided.