Repository navigation
fix(add): warn when --list or --heading will not resolve, accept a uuid, read tags once - #343
Merged
Merged
Conversation
…gs once - add warns on stderr when --list/--project names no open project or area (Things files the to-do in the Inbox) or --heading names no heading of that project (Things drops it). The add still goes ahead. - verifyTags returns the names Things will drop, so edit's no-op check uses them instead of reading the tag list a second time.
Things matches list by title only, so add --project <uuid> landed in the Inbox. A uuid of an open project or area now goes as list-id. AddTarget also prefers an exact-case title when open projects differ only in case.
This was referenced Oct 3, 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.
Follow-ups from the reviews of #330 and #332:
addnow says when Things will file a to-do somewhere other than where you asked, a project or area UUID now works, andeditreads the tag list once.What was wrong
--list,--projector--headinggave no warning. I added throwawayzz things-cli testto-dos to the real app to see what Things does. It matcheslistagainst open, untrashed projects and areas by title, ignoring case. If nothing matches, it puts the to-do in the Inbox and says nothing. That happens for an unknown name, a completed project and a trashed project. Aheadingthat the project doesn't have is dropped, and the to-do goes into the project with no heading. Aheadinggiven without a list is ignored, and the to-do goes to the Inbox. Heading names also match ignoring case.add --project <uuid>landed in the Inbox, even though the help says "Project name or UUID". Things matcheslistby title only. The today-due worker hit the same bug.editread the tag list twice. The unknown-tag check (verifyTags) and the no-op check (droppedTags, from fix(edit): treat tags Things does not have as no change in the no-op check #330) each calleddb.UnknownTags.What changed
db.AddTarget(internal/db/lists.go) resolveslistandheadingthe way Things did in those tests.listmatches an open, untrashed project or an area, by title ignoring case or by UUID.headingmatches an untrashed heading of that project, ignoring case. If open projects differ only in case, the CLI checks the one whose title matches exactly. Which one Things picks is unknown.addwarns on stderr and still sends the write:warning: Things has no open project or area called "Nowhere"; it will put the to-do in the Inboxwarning: "Tools" has no heading "Later"; Things will add the to-do there without a headingwarning: --heading "Later" needs --list or --project; Things will ignore it and put the to-do in the InboxIf the database can't be read, this check stays quiet. The tag check or the read-back already reports that.
--listor--projectis the UUID of an open project or area,addsends it aslist-id(newAddParams.ListID). A title is still sent aslist. I checked this against the real app: a project UUID, an area UUID, and a project UUID with--heading(both the exact name and a different case) all landed in the right place.verifyTagsnow returns the names Things will drop.edituses that list for its no-op check, anddroppedTagsis replaced by a smallfoldTagshelper, so the tag list is read once.docs/content/commands.mdandinternal/skill/SKILL.mddescribe the warnings and UUID support.Not changed
Item 3 from the follow-up list (tags in add/edit output in a different order from
show) is dropped. On the live database, all 132 items with more than one tag come back in the same order fromshow's query and from both read-back queries. The order comes from GROUP_CONCAT, which SQLite does not define, and all three queries share it.Tests
Written first and shown failing on the unfixed code:
TestEditReadsTagListOncewraps the SQLite connection to count queries against the tag list. It counted 2 reads before this change and counts 1 after.TestAddWarnsOnUnresolvedListOrHeadingchecks no warning for a known project, area, project UUID, area UUID and heading, and a warning for an unknown list, a completed project, a completed project's UUID, an unknown heading, a heading under an area and a heading with no list. The write is sent in every case.TestAddSendsUUIDAsListIDchecks that a UUID goes aslist-idwith nolistbeside it, and that a title goes aslist. Both UUID cases fail with the fix turned off.TestAddTargetandTestAddTargetPrefersExactCasecover the DB lookup.make testandmake lintpass. Two/code-review medium --fixpasses ran. The first added the exact-case preference. The second found nothing.Every throwaway to-do used in testing, and the one throwaway project, is in the Trash.