Skip to content

fix(import): refuse payloads Things saves differently from what they say - #418

Merged
ryanlewis merged 3 commits into
mainfrom
fix/import-shapes
Oct 9, 2026
Merged

ryanlewis merged 3 commits into
mainfrom
fix/import-shapes

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

import sent some payloads that Things accepts but saves as something else. The CLI then either reported the item missing ("None of them appeared"), which leads an agent to re-run and create a duplicate, or reported success for an item with the wrong date. It also refused a date format Things accepts. This change refuses those payloads before anything is sent, and accepts the date format.

Now refused before sending

  • A key given twice in one object, such as two titles. Things keeps the first value, while Go's decoder keeps the last, so the read-back looked for a title that was never saved. New reason duplicate-key, with the key in blocked. The raw JSON is walked token by token to find these.
  • A title over 4000 characters, or notes over 10000. Things cuts the title to 4000. The notes limit was not measured, so it is the limit add already enforces. New reason too-long.
  • items on a to-do, or checklist-items on a project, whatever their value. Things ignores them and creates the item without them. Reason invalid-item. A string value was refused before as invalid-type. It is still refused, now with a message saying Things would ignore it.
  • A creation-date or completion-date in the future, more than a minute ahead. Things saves it as now. New reason future-date. This includes an hour past 23 that rolls into the future, such as today's date at T25:00:00.
  • A when or deadline Things would misread. For example, when of 2026-13-01 or 18:00 lands in Today, and deadline of 2026-13-01 becomes 1 January. Reason invalid-date. The check runs the same functions add uses, so a misspelt keyword, or a keyword used as a deadline, is refused. Those functions let through any date or time they cannot read, and the Things JSON format only documents keywords, a date and a date with a time. So a value that starts with a digit must be a real YYYY-MM-DD, or YYYY-MM-DD@HH:MM for when. Weekdays and English phrases are still sent unchanged, as add sends them.

Other changes

  • A lowercase z in a date is now accepted. Things accepts it; only a lowercase t is rejected.
  • The docs now say the CLI is stricter than Things on malformed dates such as +012 or a five-digit year. Things guesses at those or drops the date without saying so, so import still refuses them.
  • Created titles are reported as Things saves them, with padding kept and each line feed shown as a space.
  • The import sections of commands.md and agents.md, the bundled skill, and the reason list in errors.go cover all of the above.

Testing

Table-driven tests cover every refusal and every accepted form listed above. make test and make lint pass.

Refuse before sending: a key given twice in one object (duplicate-key),
a title over 4000 characters or notes over 10000 (too-long), items on a
to-do or checklist-items on a project (invalid-item), a creation-date or
completion-date in the future (future-date), and a when or deadline Things
would misread (invalid-date). Accept a lowercase z in a date, which Things
takes. Report created titles as Things saves them, padding included.
Report a created title with line feeds as spaces, as Things saves it,
name each refused attribute once, and say in the when/deadline refusal
that weekdays and phrases pass through.
A when with an @ must have today, tomorrow, evening or a real
YYYY-MM-DD before it and a real time of day after it. Things files
tomorrow@25:00 with no reminder and ignores the time after someday or
anytime. A deadline with an @ is refused too.
@ryanlewis
ryanlewis merged commit 223120f into main Oct 9, 2026
10 checks passed
@ryanlewis
ryanlewis deleted the fix/import-shapes branch October 9, 2026 17:27
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