Define sorting options, defaults and hierarchy behavior #115
Description
Work
Specify Created newest/oldest and Updated newest sorting for web and MCP. Distinguish creation time from update time and priority. Document tie-breakers, parent/child ordering, paging and initial web defaults.
Acceptance
- Explicit web default and backward-compatible MCP default documented.
- Examples cover equal timestamps, edited old items, parents with new subtasks and imported/renumbered items.
- No inference that a larger public number means newer or more important.
Settled contract
ItemSort in Services/ItemSort.cs is the single vocabulary for both lists:
| Value | Meaning |
|---|---|
created_desc |
Newest created first. Web default for tasks and memories. |
created_asc |
Oldest created first. MCP default for task_list, preserving the FIFO decision #9. |
updated_desc |
Most recently changed first. MCP default for memory_search, its previous behaviour. |
- Ties break on the internal identity (
Id), which is stable and never reused. The public project number is never an ordering signal. - An unknown value from MCP is refused and the refusal names the accepted values. An unknown value in a URL falls back to the page default, because a stale link must still render.
- Parents are ordered by the chosen sort and each subtree follows its parent. A new subtask therefore never moves an old parent under
created_desc. - Order and filters are decided across the whole project before any cap. A capped old page is never reversed afterwards.
- A task whose parent was filtered away counts as a root, so a reopened subtask under a closed parent stays reachable.
- Sort and filter state lives in the query string, so reload, sharing and Back all restore the same view.
Deliberate departure from the original proposal
The proposal kept the MCP defaults only "until a deliberate contract change is selected". The directions are unchanged, but task_list now groups each subtree under its parent instead of returning one flat creation-ordered stream. That is a correctness fix for the same acceptance criterion about hierarchy, not a change of default order.