From 8ca820b05e9e699a7b563a2e37ff2a0629a5505a Mon Sep 17 00:00:00 2001 From: Doot Agent Date: Sun, 5 Jul 2026 08:22:17 +0000 Subject: fix: native tasks missing from Tasks tab and blank title on completion Bug 1: BuildUnifiedAtomList never called GetNativeTasks(), so doot-sourced tasks were absent from the web Tasks tab. Added GetNativeTasks() fetch and NativeTaskToAtom conversion (new model helper, SourceDoot constant). Bug 2: handleAtomToggle called getAtomDetails after CompleteNativeTask, but GetNativeTasks filters WHERE completed=0, so the task was already gone and the title came back blank. Moved getAtomDetails call to before the completion switch so all sources (including doot) capture title/dueDate first. Also fixed widget_test.go compile error: TestHandleWidgetComplete_NonTodoist called HandleWidgetComplete as a package-level function but it is a method on *Handler. Rewrote the file as package handlers (internal) and construct &Handler{} directly. Regression tests added for both bugs in atoms_test.go and handlers_test.go. Co-Authored-By: Claude Sonnet 4.6 --- internal/handlers/atoms_test.go | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'internal/handlers/atoms_test.go') diff --git a/internal/handlers/atoms_test.go b/internal/handlers/atoms_test.go index 3be82f8..521b147 100644 --- a/internal/handlers/atoms_test.go +++ b/internal/handlers/atoms_test.go @@ -16,8 +16,36 @@ func (m *mockClaudomatorClient) GetActiveStories(ctx context.Context) ([]models. return m.stories, nil } +func TestBuildUnifiedAtomList_WithNativeTasks(t *testing.T) { + s, err := store.New(":memory:", "../../migrations") + if err != nil { + t.Fatalf("failed to create in-memory store: %v", err) + } + defer s.Close() + + if err := s.CreateNativeTask(models.Task{ID: "native-1", Content: "Buy milk"}); err != nil { + t.Fatalf("failed to create native task: %v", err) + } + + atoms, _, err := BuildUnifiedAtomList(s, nil) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + found := false + for _, a := range atoms { + if a.Source == "doot" && a.Title == "Buy milk" { + found = true + break + } + } + if !found { + t.Errorf("expected atom with Source='doot' and Title='Buy milk'; got atoms: %+v", atoms) + } +} + func TestBuildUnifiedAtomList_WithClaudomator(t *testing.T) { - s, err := store.New(":memory:", "../store/migrations") + s, err := store.New(":memory:", "../../migrations") if err != nil { t.Fatalf("failed to create in-memory store: %v", err) } -- cgit v1.2.3