fix(list): include cancelled items in logbook - #225
Merged
Merged
Conversation
Closes #210 The Logbook is where Things files everything closed, not just everything finished: cancelling a to-do or a project logs it under its stopDate beside the completed rows, and the app shows both. The view filtered t.status = 3 alone, so cancelled items never appeared. The filter is now t.status IN (2, 3). Nothing else moved: ORDER BY t.stopDate DESC is unchanged, so cancelled rows interleave with completed ones by date rather than forming a block. Callers tell the two apart by status, which needed no output change — JSON already carries "completed" or "cancelled", plain output already prints [x] and [~]. Verified against the live database with sqlite3 -readonly, compared by uuid against the app's Logbook via AppleScript. The app lists 910 items; the CLI listed 1190 before and 1334 after, and the count of app rows the CLI was missing goes from 39 to 0. The 39 are 33 cancelled to-dos and 6 cancelled projects, including both uuids named in the issue. The CLI still returns rows the app folds away — children of closed or trashed projects, and items closed today before manualLogDate advances. Those predate this change in kind and are noted in the PR for their own issues. --include-completed is unaffected: it is rejected on any view but today.
ryanlewis
force-pushed
the
fix/issue-210-logbook-cancelled
branch
from
September 10, 2026 11:22
322e090 to
699cc09
Compare
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #210
What changed
logbooknow returns cancelled items alongside completed ones. The Logbook is where Things files everything closed, not just everything finished: cancelling a to-do or a project logs it under its stop date beside the completed rows, and the app shows both. The view filteredt.status = 3alone, so cancelled rows never appeared.The filter is now
t.status IN (2, 3). Nothing else about the view moved: it keepsORDER BY t.stopDate DESC, so cancelled rows interleave with completed ones by date rather than forming a block, and it keeps the literal reading of the database it shares withtrash.Callers tell the two apart by
status, which needed no output change. JSON already carries"completed"or"cancelled", and plain output already prints[x]and[~].Verified against the real database
Read the live database with
sqlite3 -readonly, compared against the app's own Logbook membership via AppleScript (id of to dos of list "Logbook"), by uuid.list logbookbeforelist logbookafterThe CLI now returns every row the app's Logbook shows. The 39 recovered are 33 cancelled to-dos and 6 cancelled projects, and all 6 projects are in the app's list. Both uuids named in the issue,
3p5oMeS6jVjUTNCRhuPEuWandPtV3Uvf1rRB7326cFPYvEN, are among them. Stop-date ordering stays monotonically non-increasing across the widened set, with cancelled rows interleaved rather than blocked.--include-completedis unaffected: it is rejected on any view buttoday,logbookincluded, and still is.What this does not fix
The CLI returns 1334 rows where the app shows 910, and the 424-row difference is not what this issue is about. I measured where it comes from, because it would otherwise look like this PR made the gap worse:
manualLogDateadvances, which is the same rule--include-completedalready implements for the today view.trashandlogbookreport deliberately under the decisions in bug: someday, anytime, upcoming, inbox and deadlines views lack the trashed-project guard #155 and fix(list): include projects in someday and logbook #209.None of these are cancelled-specific and all predate this change in kind. They are worth their own issues.
Tests
Five tests in
internal/db/tasks_test.goover a newseedLogbookCancelledhelper, whose stop dates interleave the two statuses while"index"runs against that order, so a view that grouped by status or fell back to"index"would fail:statusandtypeidentify each--areafinds a cancelled row through its area;--projectcannot match a project rowtoday,upcoming,anytime,somedayor the catch-all view, each seeded with a cancelled row shaped to land in that view but for its status, so only thet.status = 0clause keeps it out. Mutation-checked: dropping that clause fromsomedayorupcomingfails the test.TestListTasksViewsexpectedlogbookto hold onlyt-done, while its own fixture comment already labelledt-cancelledas a logbook row. That expectation now matches the comment.Docs
internal/skill/SKILL.md,docs/content/commands.md,docs/content/agents.mdandREADME.md: the Logbook is described as everything closed rather than everything completed, withstatusnamed as the way to separate the two and ajqfilter for agents that mean finished rather than closed.The review also caught that every
jq 'select(...)'example in the agent-facing docs was broken, including ones this PR did not add.-jemits a JSON array, sojq 'select(.status=="completed")'aborts withCannot index array with string. All of them now readjq '.[] | select(...)', which I checked by running both forms. Those examples ship in-binary for agents to copy literally, so leaving the pre-existing ones wrong while fixing the new one would have been worse than fixing the set.