From b007fee8fb5b39a5f9b369c59af71ac9e795ceaf Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Fri, 17 Jul 2026 22:22:37 +0000 Subject: Implement linear task chains and recurring maintenance buckets Backend, web timeline, and Android widget wiring for the last two unimplemented items from doot-future-task-scheduling-ideas. Chains: task_chains table + chain_id/chain_position/chain_unlocked on native_tasks (migration 026), WIP-limit-1 advancement hooked into CompleteNativeTask, locked tasks excluded from all date-based queries, 5 new /api/widget/chains* endpoints, an N/M position badge on web and Android widget rows. Buckets: maintenance_buckets table + bucket_id/bucket_state/ bucket_last_active_at on native_tasks (migration 027), staleness-then-priority selection scoring, a new RunBucketCycleCheck scheduler loop, 5 new endpoints including the distinct Defer action, a Defer button on web and Android widget rows. Also corrected stale "not yet approved" status headers on the two already-shipped specs this work depended on (labels/projects, budgets/ availability) -- their headers were never updated after implementation. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01EZ7ikw2ukGJFTHE3bJS7zL --- migrations/027_maintenance_buckets.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 migrations/027_maintenance_buckets.sql (limited to 'migrations/027_maintenance_buckets.sql') diff --git a/migrations/027_maintenance_buckets.sql b/migrations/027_maintenance_buckets.sql new file mode 100644 index 0000000..50c6d7e --- /dev/null +++ b/migrations/027_maintenance_buckets.sql @@ -0,0 +1,18 @@ +-- Recurring maintenance buckets: a finite pool of native_tasks that get +-- repeatedly activated/deactivated (state flip, not a new row per cycle, +-- unlike due-date recurrence) every cycle_days, picking pick_n dormant +-- items per cycle. +CREATE TABLE maintenance_buckets ( + id TEXT PRIMARY KEY, + name TEXT NOT NULL, + cycle_days INTEGER NOT NULL, + pick_n INTEGER NOT NULL, + last_cycle_at DATETIME, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP +); + +ALTER TABLE native_tasks ADD COLUMN bucket_id TEXT DEFAULT ''; +ALTER TABLE native_tasks ADD COLUMN bucket_state TEXT DEFAULT ''; +ALTER TABLE native_tasks ADD COLUMN bucket_last_active_at DATETIME; + +CREATE INDEX IF NOT EXISTS idx_native_tasks_bucket ON native_tasks(bucket_id); -- cgit v1.2.3