Repository navigation
Conversation
- An exact title on a completed, cancelled or trashed row (or a to-do in a trashed project) now wins over a substring match on an open row, so the write is refused or noted on that row instead of landing on an open twin whose title contains it. An open row with the exact title still wins. - Digits with a leading zero, and a bare 0, are not row numbers. They reach an exact title only. - A last-list cache file that exists but cannot be read (empty, garbled, truncated, not a file) refuses a bare-number ref instead of falling through to a title. - A uuid-shaped ref that is no item's uuid matches an exact title only, never a substring, since uuids are case-sensitive and titles are not. - An empty or blank ref is refused up front with the new `empty reference` JSON token.
A write (complete, cancel, edit, project edit) whose ref is an exact title that only completed, cancelled or trashed items carry now fails non-zero with `already closed` or `trashed`, naming the most recent of them and how many share the title. A uuid or row number that names a closed item keeps the exit-0 note. show still displays the item, or offers the closed items as candidates. Also from review: trim the ref before the uuid-shape check, fetch all exact-title rows in one query, reword the uuid-shaped not-found error, and update the ProjectTrashed comment and the skill's uuid shapes.
- A title that matches a closed or trashed item once case and surrounding space are set aside is refused too, before the case-folding substring match can reach an open lookalike. - show marks a to-do whose project is in the Trash "(in Trash)" and emits "projectTrashed": true; open refuses it with the trashed token. - Trashed-project refusals name the project, in text and in a new "project" JSON field. - A uuid-shaped ref padded with space is retried trimmed. - "Most recent" uses Things' modification date first, and a refusal over several closed items lists them in "matches". - Tests pin preferInstances on closed rows, the trim, and recency.
When the exact title misses, GetTask now matches open rows under the fold key first: one open match wins and several are ambiguous. Only when none exists does a closed or trashed fold match raise the closed-title refusal. Tests pin the trashed-project check and preferInstances on the folded path.
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.
Several kinds of task reference could make
complete,cancel,editorshowact on an item other than the one named. This closes those paths.What changes
Exact title on a closed or trashed item. Before,
complete "zz base"with "zz base" completed and "zz base extra" open completed "zz base extra". An exact title is now looked up across every status. An open item with the exact title still wins. When only closed or trashed items have it, a write fails non-zero withalready closedortrashed. The error names the most recent of those items and how many share the title, and says no open task was touched.showdisplays the item, or offers the closed items as candidates. A uuid or row number that names a closed item keeps the existing exit-0 note.Leading zeros.
07,00and0are no longer row numbers, since listings never print them. They match an exact title only, and the error suggests7when the last list has a row 7.Unreadable cache. A last-list cache file that exists but is empty, truncated, garbled or not a file now refuses a bare number with
stale list cache. Before, it was treated as no cache, and the number fell through to a task titled with it. A missing cache still falls through to an exact title, as documented in A numeric ref past the end of the last list falls through to a title match #375.uuid-shaped refs. A ref that looks like a Things uuid but matches none now gets exact-title matching only, never substring matching. That shape is 21 or 22 ASCII letters and digits, or the 36-character hex form. uuids match case-sensitively and titles do not, so a uuid typed in the wrong case could reach a task whose title contained it.
Empty refs. An empty or all-space ref is refused before any lookup, with a new
empty referenceJSON token. Other refs are not trimmed.Case and space variants. A title that matches a closed or trashed item once case and surrounding space are set aside is refused the same way. So
complete "pay rent"with only a completed "Pay rent" no longer closes the open "Re: Pay rent deposit" through the case-folding substring match. An open item that matches with case and space set aside, such as an open "pay rent" for"PAY RENT", still wins over a closed one.Tasks in a trashed project. This partly addresses Items filed into a trashed project show no Trash hint #401.
showmarks a to-do whose project is in the Trash(in Trash), and--jsonadds"projectTrashed": trueonly when it is true.openrefuses such a to-do withtrashed, since Things has nowhere to show it. Refusals about it name the project, in the text and in a newprojectJSON field.Several closed items. "Most recent" is the item Things last modified, then the latest stop date, then the latest creation date. When several closed items share the title, the refusal lists them all in
matches.The commands and agents docs pages and the bundled skill file are updated to match.
Tests
Table-driven tests in
cmd/things/refs_test.gocover:0The cache package tests cover the new read errors.
make testandmake lintpass.Not in this PR
things --project <to-do uuid>still prints nothing and exits 0. That goes through the listing filter rather than ref lookup, so it is tracked separately.things open <title>can open a trashed or closed item by exact title. Things can show those, and nothing is written. A to-do in a trashed project is refused, as above.