Skip to content

fix(add): check a created item's destination in the read-back - #381

Merged
ryanlewis merged 2 commits into
mainfrom
fix/concurrent-create
Oct 4, 2026
Merged

ryanlewis merged 2 commits into
mainfrom
fix/concurrent-create

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

Two commands that add the same title to different places at the same moment could each confirm the other's row. Both snapshot before either saves, so each sees the other's row as new. If one write was dropped or saved late, its caller got the other item's uuid, and later edits or completions went to the wrong task.

The add, project add and import read-backs now only accept a new row filed where the write sent it:

  • add: the project or area --list/--project resolved to, and the heading if Things has it. With no list, or one Things will not match, the row must be in no project or area (the Inbox).
  • project add: the area --area resolved to, or no area.
  • import: a to-do's list-id/list/heading, a project's area-id/area, or the parent project for a to-do in a project's items. A list, heading or area the database does not have before the import is not checked, since it may be a project the same payload creates. When an unchecked item could claim a row that another item's destination also fits, neither is confirmed.

Destinations are compared by the resolved uuid, so a list named by uuid and by title is one place. Title matching is only used for a project the same import creates, or for several areas that share a title. Several rows fitting still gives "ambiguous". There is no locking. The When bucket is not checked.

Docs (commands.md, agents.md) and the bundled skill describe the new check.

Checked: make test and make lint pass. The new regression tests fail on main. In Things, two parallel things add runs with the same title to two test projects each confirmed their own item. On main the same run reported both as ambiguous.

Two commands adding the same title to different places at the same moment
could each take the other's row as their own. The add, project add and
import read-backs now only accept a new row filed where the write sent it.
Compare destinations by the resolved uuid so a list-id and a title naming
the same project pair as one, trim a created parent project's title, and
let an import item with an unchecked destination fail rather than share a
row with a checked one.
@ryanlewis
ryanlewis merged commit b834159 into main Oct 4, 2026
10 checks passed
@ryanlewis
ryanlewis deleted the fix/concurrent-create branch October 4, 2026 11:51
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