Unified Agent + reusable Go agent core.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: simplify recurring todo materialization

Lyric cb55900f 7c31f77e

+17 -9
+3 -8
internal/todo/recurring.go
··· 38 38 OK: true, 39 39 Action: "add_recurring", 40 40 RecurringCount: len(recur.Entries), 41 - Changed: Changed{ 42 - WIPAdded: 0, 43 - WIPRemoved: 0, 44 - DONEAdded: 0, 45 - }, 46 - Entry: &entry, 41 + Entry: &entry, 47 42 }, nil 48 43 } 49 44 ··· 83 78 return RecurringMaterializeResult{}, nil 84 79 } 85 80 86 - wip, done, err := s.readFiles() 81 + wip, err := s.readWIP(now) 87 82 if err != nil { 88 83 return RecurringMaterializeResult{}, err 89 84 } ··· 126 121 if err := validateWIPEntries(wip.Entries); err != nil { 127 122 return RecurringMaterializeResult{}, err 128 123 } 129 - if err := s.writeFiles(wip, done); err != nil { 124 + if err := s.writeWIP(wip); err != nil { 130 125 return RecurringMaterializeResult{}, err 131 126 } 132 127 if err := s.writeRECUR(recur); err != nil {
+4
internal/todo/recurring_test.go
··· 1 1 package todo 2 2 3 3 import ( 4 + "os" 4 5 "path/filepath" 5 6 "strings" 6 7 "testing" ··· 90 91 } 91 92 if result.Generated != 1 || result.Advanced != 1 { 92 93 t.Fatalf("result = %#v, want one generated and advanced", result) 94 + } 95 + if _, err := os.Stat(filepath.Join(root, "TODO.DONE.md")); !os.IsNotExist(err) { 96 + t.Fatalf("TODO.DONE.md should not be created by recurring materialize, stat err=%v", err) 93 97 } 94 98 95 99 wip, _, err := store.readFiles()
+10
internal/todo/store.go
··· 58 58 return nil 59 59 } 60 60 61 + func (s *Store) writeWIP(wip WIPFile) error { 62 + now := s.nowUTC().Format(time.RFC3339) 63 + if strings.TrimSpace(wip.CreatedAt) == "" { 64 + wip.CreatedAt = now 65 + } 66 + wip.UpdatedAt = now 67 + wip.OpenCount = len(wip.Entries) 68 + return fsstore.WriteTextAtomic(s.WIPPath, RenderWIP(wip), fsstore.FileOptions{DirPerm: 0o700, FilePerm: 0o600}) 69 + } 70 + 61 71 func (s *Store) readWIP(now time.Time) (WIPFile, error) { 62 72 nowRFC3339 := now.UTC().Format(time.RFC3339) 63 73 text, exists, err := fsstore.ReadText(s.WIPPath)
-1
internal/todo/types.go
··· 73 73 OK bool `json:"ok"` 74 74 Action string `json:"action"` 75 75 RecurringCount int `json:"recurring_count"` 76 - Changed Changed `json:"changed"` 77 76 Entry *RecurringEntry `json:"entry,omitempty"` 78 77 Warnings []string `json:"warnings,omitempty"` 79 78 }