Read every step when a card's or to-do's embedded list is cut off

Merged
JE
2mo ago
+255-3

Basecamp embeds at most 100 subtasks in a card's or to-do's steps array and marks nothing as cut off. subtasks_count carries the real total (bc3 _card.json.jbuilder:16, _todo.json.jbuilder:24). The CLI treated the embed as the whole list.

Card: https://app.basecamp.com/2914079/buckets/46292715/card_tables/cards/10334306488

Before, for a card with 135 steps:

  • cards steps returned 100 and said "100 steps on card".
  • cards show, todos show, and show card|todo|<url> emitted the first 100 steps.
  • The TUI board showed x/100.

After:

  • When subtasks_count is larger than the embed, these commands read the full list through the SDK's Subtasks service, the same one subtasks list uses since #791. They then emit all 135 steps. Output shapes don't change. If that read fails, the command fails rather than printing a short list.
  • Otherwise the embed is complete and is used as is, with no extra request. Production Basecamp always sends subtasks_count, so there is no fallback for a record without it.
  • The TUI uses the card's own subtasks_count and subtasks_completed_count. It makes no extra request per card.

Tests. I wrote them first, against stubs that embed 100 steps with a count of 135:

  • cards steps, cards show, todos show, and show (card, Todo, Todolist::Todo) return all 135 steps.
  • A cut-off that can't be read fails.
  • A complete embed makes no subtasks request.
  • mapCardInfo counts 135 and 40.

Mutation-checked: without the fix, each of these tests sees 100 steps or 0 completed.

make check. Compared against clean origin/main 70eb0802 on the same machine, there is no change in results. The remaining failures exist on main too: TTY and interactive-stdio tests, and lint findings in another worktree's connector file.

Out of scope: having the API itself mark the inlined array as truncated. That is a separate ask for a bc3 owner.


Summary by cubic

Fixes the CLI treating a card's or to-do's embedded subtasks as the whole list. Basecamp embeds at most 100 steps under steps; the real total lives in subtasks_count. Commands now read the full list when the embed is cut off.

  • cards steps, cards show, todos show, and show emit all subtasks when subtasks_count exceeds the embed, via the same SDK Subtasks service subtasks list uses. show treats Kanban::Card, Todo, and Todolist::Todo as parents. Output shapes are unchanged.
  • A complete embed makes no extra request; a known cut-off that can't be read errors.
  • The TUI board now counts the card's real progress using the card's own subtasks_count and subtasks_completed_count instead of the capped embed.