Skip to content

fix(when): refuse a keyword typo that has a time after it - #472

Open
ryanlewis wants to merge 1 commit into
mainfrom
claude/optimistic-johnson-g6xwzr
Open

ryanlewis wants to merge 1 commit into
mainfrom
claude/optimistic-johnson-g6xwzr

Conversation

@ryanlewis

@ryanlewis ryanlewis commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Symptom

A misspelt --when keyword is refused with a hint, but only when it stands alone. Put a time after it and it goes to Things as typed:

$ things add "Call bank" --when tommorow
Error: unrecognised --when value "tommorow" (did you mean "tomorrow"? valid keywords: today, tomorrow, evening, anytime, someday)

$ things add "Call bank" --when tommorow@9am      # before this PR
# sends things:///add?title=Call%20bank&when=tommorow@9am

Things does not know the word, so the to-do is created with no date and no reminder. edit --when has the same gap, and when the edit carries another change it is confirmed with no warning at all (the first item in #425), so the missed reminder goes unnoticed.

After this PR:

$ things add "Call bank" --when tommorow@9am
Error: unrecognised --when value "tommorow@9am" (did you mean "tomorrow@9am"? valid keywords: today, tomorrow, evening, anytime, someday)

Nothing is sent. edit, project add and project edit get the same refusal, since they all go through NormalizeWhen. import already refused this value; its message now carries the hint.

Cause

NormalizeWhen compared the whole value against the keywords. tommorow@9am is more than two edits from tomorrow, so the typo check never fired and the value fell through as a free phrase.

Fix

The typo check now looks at the word before the @, and the hint keeps the time the user typed. A keyword or weekday name before the @ is skipped first, because monday is two edits from today and would otherwise be flagged; checkWhenShape has already judged its time by that point. Phrases and abbreviated weekdays before an @ (next friday@noon, fri@9pm, tonight@9pm) still pass through as before.

Tests

TestNormalizeWhenRejectsTyposWithTime in internal/things/dates_test.go was written first and failed on all four typo cases before the change. It also pins the values that must keep passing (tomorrow@18:00, Monday@9pm, evening@6pm, fri@9pm, mon@9pm, next friday@noon, tonight@9pm).

make test passes. make lint reports 0 issues with golangci-lint v2.12.2, the version CI pins.

Docs

README.md, docs/content/commands.md and internal/skill/SKILL.md now say the typo check covers a keyword with a time after it.

🤖 Generated with Claude Code

https://claude.ai/code/session_013sKKzsVkCbpmTQJtETQk7d

Ran as part of a weekly bughunt routine.

--when tommorow was refused with a "did you mean" hint, but the same
slip with a time (tommorow@9am) was compared whole against the keywords,
never came within two edits of one, and went to Things as typed. The
typo check now looks at the word before the @, and the hint keeps the
time. A keyword or weekday name before the @ is left alone: monday is
two edits from today.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_013sKKzsVkCbpmTQJtETQk7d
@ryanlewis ryanlewis added fix Bug fix bughunt Found by the weekly bughunt routine labels Nov 14, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

The check job is red on the govulncheck step only. Build, lint (0 issues) and go test -race all passed in the same job.

The failure is not from this diff. govulncheck reports GO-2026-6859 in the standard library (net/[email protected], fixed in go1.26.11), which comes from the toolchain directive in go.mod. This PR does not touch go.mod, so main fails the same step.

The fix already exists as #471 (chore(deps): update go toolchain directive to v1.26.11 [security]). Once that merges, updating this branch from main should turn the job green. I have left the toolchain bump out of this PR so it does not duplicate #471.


Generated by Claude Code

This branch has not been deployed

No deployments
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