Skip to content

fix(project): warn when project add --area names no area - #352

Merged
ryanlewis merged 1 commit into
mainfrom
fix/project-add-area-warning
Oct 3, 2026
Merged

ryanlewis merged 1 commit into
mainfrom
fix/project-add-area-warning

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

What was wrong

add warns on stderr when --list/--project/--heading won't land where you asked (#343). project add --area had no such warning. When --area matches no area, Things creates the project with no area and doesn't say so. I confirmed that with a throwaway project.

What changed

project add now checks --area against the areas in the database before sending. If nothing matches, it prints this and still creates the project:

warning: Things has no area called "Nowhere"; it will create the project with no area

A uuid of an area still goes to Things as area-id (#344). The check follows what Things itself matches, which I tested with throwaway projects:

  • personal matches an area called Personal, so Things ignores case.
  • " Personal " with surrounding spaces does not match, so Things does not ignore surrounding space.

I also tried add --list " Personal " with a throwaway to-do. It went to the Inbox, so Things does not trim the list parameter either. db.AddTarget (behind add's warning) and the FoldTag comment still assume Things trims, so a padded --list currently gets no warning. That's left for a separate change. A comment in projectAreaID records this.

Because of that, the new check compares the real area titles without trimming instead of reusing FindAreaUUID. That covers areas whose own titles have trailing spaces too.

commands.md and SKILL.md describe the warning.

How it was tested

  • The new TestProjectAddWarnsOnUnknownArea covers seven cases: title, other case, uuid, unknown name, padded input, padded stored title, and padded stored title with unpadded input. In every case the project is still sent once. The cases failed before the fix, and the two stored-title cases failed against my first, input-only version.
  • make test and make lint pass.
  • With the built binary against the real app: an unknown area and " Personal " printed the warning and got no area. personal and the area's uuid printed nothing and were filed under Personal. All throwaway items are in the Trash.

Things creates the project with no area when --area matches none, and
says nothing. It matches the title ignoring case but not surrounding
space, which I checked with throwaway projects.

project add now warns on stderr in that case, as add does for --list,
and still sends the project.
@ryanlewis
ryanlewis merged commit d767458 into main Oct 3, 2026
10 checks passed
@ryanlewis
ryanlewis deleted the fix/project-add-area-warning branch October 3, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant