Migrate to basecamp-sdk TodoListOptions.Completed

Merged
JE
7mo ago
+235-80

Summary

basecamp-sdk PR #279 (merged 2026-04-23, unreleased — no tag past v0.7.3) restructures TodoListOptions:

  • Status becomes lifecycle-only ("archived", "trashed", or empty).
  • A new Completed bool field handles the completion filter.
  • Unsupported Status values are rejected at the wrapper boundary.
  • Status: "" no longer returns all todos — it now returns incomplete only.

The CLI today encodes the completion filter via Status: "completed" / Status: "pending" and relies on Status: "" returning all todos so listAllTodos can filter client-side. Both assumptions break under the new SDK.

This PR ships the SDK bump and the CLI migration together.

What changed

  • SDK bump — go.mod / go.sum / internal/version/sdk-provenance.json to v0.7.4-0.20260423230153-f54589f0924a (merge-commit pseudo-version).
  • internal/commands/todos.go — new resolveStatusFilter helper maps --status {completed,incomplete,archived,trashed} to (sdkStatus, sdkCompleted) and rejects everything else (including legacy pending) with ErrUsage. Threaded the pair through runTodosList → listTodosInList / listAllTodos → fetchTodosIncludingGroups. Deleted the incomplete→pending coercion and the cross-list client-side status filter — the server is now the single source of truth on both paths.
  • internal/tui/workspace/data/hub.go — CompletedTodos switches to {Completed: true}. Behavior fix in Hub.Todos: the empty {} now correctly returns only incomplete todos, so the active pane no longer leaks completed ones.
  • internal/tui/empty/messages.go — drop the dead "pending" alias from the empty-state context switch.
  • skills/basecamp/SKILL.md — --status flag values updated to (completed/incomplete/archived/trashed).
  • Tests — todos_test.go extended statusCapturingTransport to capture every /todos.json request's query params and to simulate server-side filtering. Rewrote 3 existing tests, added 8 new ones covering the matrix (single-list × cross-list × completed/archived/trashed, plus bogus and pending rejection asserting output.CodeUsage and totalCount == 0).
  • WithMaxRetries(0) → (1) sweep — the new SDK enforces a minimum of 1 attempt; (1) still means "no retries."

Breaking change

--status pending is no longer accepted and now returns ErrUsage. This is option A from the migration handoff (drop pending as a synonym for incomplete). Option B (keep pending as an alias mapped to the API default) is a one-line addition to resolveStatusFilter. Flag the choice if you'd prefer B before merge.

Test plan

  • bin/ci green (formatting, vet, lint, unit + e2e BATS, surface, skill drift, provenance, tidy)
  • --status completed, --status archived, --status trashed all send the expected query params on both single-list and cross-list paths (covered by new tests)
  • --status pending and bogus values return ErrUsage before any HTTP fires
  • No replace directive in go.mod; no legacy Status: "completed" / Status: "pending" strings remain in internal/
  • TUI manual check: ./bin/basecamp tui → project → completed-todos pane populates; active pane no longer mixes in completed todos

Summary by cubic

Migrates to github.com/basecamp/basecamp-sdk/go’s new TodoListOptions (lifecycle-only Status + Completed bool) and updates CLI/TUI filtering to use the server as the source of truth. Fixes the TUI active todos pane showing completed items and rejects --status pending.

  • Refactors

    • Map --status {completed,incomplete,archived,trashed} to (Status, Completed) via a new resolver; invalid values return ErrUsage.
    • Remove client-side status filtering for cross-list and single-list paths; API applies filters directly.
    • TUI: use {Completed: true} for completed panes; empty options now return only incomplete todos.
    • Tests: add coverage for query params and server-side filtering across single-list/cross-list.
    • Enforce WithMaxRetries(1) per new SDK requirement; bump SDK to v0.7.4-0.20260423230153-f54589f0924a.
  • Migration

    • Replace --status pending with --status incomplete.
    • Supported values are now: completed, incomplete, archived, trashed.