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 --- cmd/dashboard/main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cmd') diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index 9691d5b..893a46f 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -328,6 +328,7 @@ func main() { // Unified task completion (for Tasks tab Atoms) r.Post("/complete-atom", h.HandleCompleteAtom) r.Post("/uncomplete-atom", h.HandleUncompleteAtom) + r.Post("/defer-atom", h.HandleDeferAtom) // Unified Quick Add (for Tasks tab) r.Post("/unified-add", h.HandleUnifiedAdd) @@ -395,6 +396,16 @@ func main() { r.With(widgetAuth).Post("/api/widget/task/estimate", h.HandleWidgetTaskEstimate) r.With(widgetAuth).Post("/api/widget/projects/budget-tracked", h.HandleWidgetProjectsBudgetTracked) r.With(widgetAuth).Post("/api/widget/labels/budget-tracked", h.HandleWidgetLabelsBudgetTracked) + r.With(widgetAuth).Post("/api/widget/chains", h.HandleWidgetChainsCreate) + r.With(widgetAuth).Get("/api/widget/chains/{id}", h.HandleWidgetChainGet) + r.With(widgetAuth).Post("/api/widget/chains/{id}/pause", h.HandleWidgetChainsPause) + r.With(widgetAuth).Post("/api/widget/chains/{id}/resume", h.HandleWidgetChainsResume) + r.With(widgetAuth).Post("/api/widget/chains/{id}/abandon", h.HandleWidgetChainsAbandon) + r.With(widgetAuth).Get("/api/widget/buckets", h.HandleWidgetBucketsGet) + r.With(widgetAuth).Post("/api/widget/buckets", h.HandleWidgetBucketsCreate) + r.With(widgetAuth).Post("/api/widget/buckets/{id}/items", h.HandleWidgetBucketItemsAdd) + r.With(widgetAuth).Post("/api/widget/buckets/{id}/items/remove", h.HandleWidgetBucketItemsRemove) + r.With(widgetAuth).Post("/api/widget/task/defer", h.HandleWidgetTaskDefer) } else { log.Println("WIDGET_TOKEN not set — /api/widget disabled") } @@ -413,6 +424,7 @@ func main() { // server's own lifecycle, cancelled alongside it on shutdown below). schedulerCtx, cancelScheduler := context.WithCancel(context.Background()) go scheduler.RunRecurrenceCheck(schedulerCtx, db, 15*time.Minute) + go scheduler.RunBucketCycleCheck(schedulerCtx, db, 15*time.Minute) // Graceful shutdown go func() { -- cgit v1.2.3