Surface Todoset-level todos in todos list

Merged
RO
5mo ago
+594-6

Summary

Fixes #474. In Basecamp 5, todos can live directly under the Todoset without a Todolist (parent.type: "Todoset"). todos list enumerated todos by looping over the todoset's todolists, so these "listless" todos were invisible — the command returned 0 for projects whose todos all live at the Todoset level.

Root cause

listAllTodos lists a project's todolists and fetches todos per-list. When there are zero todolists (or todos parented to the Todoset directly), nothing is returned. Verified live: the API accepts a todo created against a Todoset ID and returns it with parent.type: "Todoset", but GET /todolists/{todosetId}/todos.json 404s — so listless todos are only reachable via the Recordings API (which is why recordings todos was the documented workaround).

Fix

After aggregating todolist todos, listAllTodos now calls a new fetchTodosetLevelTodos helper that:

  • Queries the Recordings API (type=Todo, scoped to the project bucket, status mapped from the todos-list filter).
  • Keeps only recordings parented directly to this todoset.
  • Hydrates each via Todos().Get — the SDK Recording type lacks the completion/assignee/due fields the list output and its filters need.
  • Applies the completed/incomplete split client-side, since Recordings status is lifecycle-only (active/archived/trashed).

Existing assignee/overdue filters then apply uniformly. Recordings errors are non-fatal, so the todolist path never regresses. CLI-only change — no SDK bump or API change required.

Verification

Validated end-to-end against a live project with mixed Todolist + Todoset-level todos:

  • Default view returns the todolist todo and the incomplete listless todo; the completed listless todo is correctly hidden.
  • --completed returns only the completed listless todo.
  • --list <id> and projects without listless todos are unaffected.

Two unit tests added (surfacing listless todos + completion-split filtering). Full bin/ci is green.


Summary by cubic

Surface Todoset-level todos in todos list, enforce correct --limit semantics, and bound/order the recordings scan to avoid full-project traversals. Allow cross-list --sort with --assignee/--overdue, and error on invalid project IDs. Fixes #474.

  • Bug Fixes
    • Include Todoset-level (“listless”) todos via Recordings and hydrate with Todos().Get; existing filters still apply.
    • With --assignee/--overdue, fetch all candidates and apply --limit after filtering (mirrors single-list).
    • Apply completed/incomplete split client-side for listless todos; Recordings errors are non-fatal.
    • Respect --limit and scan efficiently: cap kept listless todos after parent filtering (0=default 100, -1=all); scan a recent, most-recent-first window by default, use --all for exhaustive scans.
    • Allow --sort when results aren’t sampled (--all or --assignee/--overdue); return a usage error on unparseable project IDs.