Repository navigation
fix(add): check a created item's destination in the read-back - #381
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/--projectresolved 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--arearesolved to, or no area.import: a to-do'slist-id/list/heading, a project'sarea-id/area, or the parent project for a to-do in a project'sitems. 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 testandmake lintpass. The new regression tests fail on main. In Things, two parallelthings addruns with the same title to two test projects each confirmed their own item. On main the same run reported both as ambiguous.