Skip to content

fix(open): match --tag and --area names case-insensitively - #284

Merged
ryanlewis merged 3 commits into
mainfrom
claude/optimistic-johnson-gmuoy3
Sep 30, 2026
Merged

ryanlewis merged 3 commits into
mainfrom
claude/optimistic-johnson-gmuoy3

Conversation

@ryanlewis

@ryanlewis ryanlewis commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Symptom

things open --tag work fails with "tag not found" when the tag is titled Work, and things open --area work fails the same way for an area titled Work. Things.app itself matches these names ignoring case, and so does the CLI's own tag check on writes (UnknownTags, behind --strict-tags and --create-tags). So a tag name that --strict-tags accepts could still fail in open.

Fix

FindTagUUID and FindAreaUUID now match titles ignoring case and surrounding space, with strings.EqualFold. A blank ref never matches an untitled row. Which row wins: a UUID match first, then an exact-case title, then the first title that matches ignoring case, in Things' list order. Before this change, LIMIT 1 with no ORDER BY left ties to SQLite.

The match happens in Go, not with SQLite's COLLATE NOCASE, because NOCASE only folds ASCII. With NOCASE, open --tag ärger would still miss a tag named Ärger. Things does match it: read-only AppleScript lookups resolve tag "BOOKINGS" to the tag Bookings, and resolve a to-do named …Bifröst when asked for …BIFRÖST.

This folds in #285, which fixed the tag half with NOCASE and an exact-match preference. Its extra URGENT test case is included here.

open is the only caller of these two lookups. docs/content/commands.md and internal/skill/SKILL.md now say names match case-insensitively.

Testing

  • Tests for both lookups: case-folded, exact-case preferred, UUID, missing, blank, and non-ASCII (ärger/ÄRGER → Ärger, CAFÉ → Café, ΚΟΣ → κος). The non-ASCII cases fail with the NOCASE version.
  • make test and make lint pass.

Ran as part of a weekly bughunt routine.

@ryanlewis ryanlewis added bughunt Found by the weekly bughunt routine fix Bug fix labels Sep 30, 2026
claude and others added 3 commits September 30, 2026 04:11
SQLite's NOCASE folds ASCII only, so `open --tag ärger` missed a tag
named "Ärger" while Things itself matches it. Match in Go with the
same fold UnknownTags uses, keeping UUID-first and exact-case-first.
ToLower misses case variants such as final sigma, and a blank ref
folded onto an untitled row. Found by /code-review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bughunt Found by the weekly bughunt routine fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants