Page the overdue report, and read every page of the account-wide lists

TH
16d ago
+496-73

Written by @thehalebot

basecamp reports overdue reads the overdue to-dos report once. Since basecamp/bc3#14519, Basecamp answers that report one page at a time: 15, 30, 50, then 100 to-dos, most recently due first, each page holding the same four lateness groups. So in production the command shows the first page as if it were the whole report, and its summary counts only that page. This change gives the command --page, has the summary say how many to-dos the whole report holds, and offers the next page as a breadcrumb while one remains. It also lets the CLI's MCP server (basecamp mcp) take the next_page its get_overdue_todos already answers, which it refuses in production as an unknown parameter.

The second commit is for basecamp/bc3#14537, which pages five more account-wide lists at 50 a page: overdue to-dos, overdue cards, completed assignments, the timesheet report and the assigned to-dos report, each answered whole until now. On basecamp-sdk v0.37.0 those commands would show the first page as the whole list once it ships. They now read every page, through basecamp/basecamp-sdk#1102.

Merge order: merge after basecamp/bc3#14537 and after basecamp/basecamp-sdk#1102, whose head this pins.

What changes for users

  • --page N reads page N of the report. Without it, the command reads the first page, as before. The help says the longest-overdue to-dos are on the last pages.
  • Summary: 15 of 214 overdue todos (…) when the report holds more than this page, from X-Total-Count. A report that fits on one page keeps 2 overdue todos (…).
  • Breadcrumb: next is basecamp reports overdue --page N+1 while Basecamp sends Link: rel="next", and is absent on the last page.
  • The output's data keeps its four lateness groups, holding this page's to-dos, plus the SDK's meta.
  • todos list --overdue, cards list --all-projects --overdue, assignments completed, timesheet report and reports assigned read every page and show the whole list, as before bc3#14537. The overdue listings keep their cap of 100, --all and --limit, and still refuse --page; they now say so when the SDK stops short of the last page.
  • The MCP server: get_overdue_todos takes page. Its dispatcher already wrapped any response with Link: rel="next" as {"next_page": N, "results": ...}, but it rejects parameters an operation doesn't declare. The vendored SDK model (internal/mcpserver/model/) is re-synced from 8f70192 with scripts/sync-mcp-model.sh, which declares page and describes the paging. The catalog snapshot changes by that one description line. After the #1102 pin, the model marks the five lists paginated, so get_everything_overdue_todos, get_everything_overdue_cards, get_my_completed_assignments, get_timesheet_report and get_assigned_todos take page too, and the snapshot marks them paginated.

History

  • The command was added in #84 (62de99f6) and has made one Reports().OverdueTodos call since, which was the whole report until bc3#14519 paged the endpoint. That change stopped a single request growing a Puma worker to several GB.
  • The SDK side is basecamp/basecamp-sdk#1100 (merged at 8f70192). OverdueTodos(ctx, page) reads exactly one page, following basecamp-sdk#617, and reports an unfollowed rel="next" as Meta.Truncated and X-Total-Count as Meta.TotalCount. It carries no pagination trait, because the report is an object of four arrays and the trait names one, the same carve-out as GetMyNotifications. So no SDK walks the report.
  • The paging shape follows notifications list, the CLI's other object-of-several-lists read on that carve-out: --page with an Int32Var defaulting to the first page, and a next breadcrumb (#799). #590 set the rule that a listing needs an escape hatch past its first read, which --page gives here.
  • The MCP server (#662, #663) builds its actions from the vendored SDK model, which TestCatalogModelProvenance holds to the SDK commit go.mod pins, so the model sync rides with the pin. #663 synthesized page for operations the model marks paginated without declaring it. The overdue report isn't marked paginated (no trait, as above), so it needed the parameter declared in the SDK, which #1100 did.
  • The Nix package pins a vendorHash that any go.sum change invalidates. #1034's SDK bump refreshed it in the same change, and so does this one.
  • API-COVERAGE.md and ACCOUNT-WIDE-LISTINGS.md call reports overdue a lateness-bucketed report, distinct from todos list --all-projects --overdue. That stays true, so they are unchanged.

Invariants

  • The first page sends no page, and a page with more names the next one. TestReportsOverduePageWithMoreNamesTheNextPage serves two to-dos with Link: rel="next" and X-Total-Count: 21. The request has no query, the summary is 2 of 21 overdue todos (1 <1 week, 1 >1 month), and the next breadcrumb is basecamp reports overdue --page 2. On main, the summary was 2 overdue todos and there was no next.
  • --page reaches the wire, and a later page names the page after it. TestReportsOverdueLaterPageNamesThePageAfterIt runs --page 2 against a page with a next link: the request is page=2, the summary is 2 of 95 …, and next is --page 3.
  • A report on one page reads as before. TestReportsOverdueWholeReportOnOnePageNamesNoNextPage sends no paging headers: the summary is 2 overdue todos (…), and there is no next breadcrumb.
  • The MCP server follows the overdue report's pages. TestServerPagesTheOverdueReport calls get_overdue_todos, gets next_page: 2, and passes it back as page. Before the model sync, the second call failed with unknown parameter "page" for action "get_overdue_todos".
  • The surface snapshot gains only the new flag. .surface adds FLAG basecamp reports overdue --page type=int32.
  • The five lists read every page, in order. TestAccountWideListsReadEveryPage serves each route as two Link-paged pages. Each command requests the first page, then page=2, and shows both records in order. The test transport gains linked routes, which send Link: rel="next" the way Basecamp does.
  • The MCP server pages exactly the lists the SDK marks paginated. TestCatalogPaginatedActionsTakePage counts 68 Link-paginated operations, up from 63, each with one page parameter.
  • The Nix flake builds with each commit's go.sum. Each vendorHash is regenerated with make update-nix-hash, which built the flake with it.
  • bin/ci passes, and so does CI.

Builds on

  • basecamp-sdk v0.37.0, which carries basecamp/basecamp-sdk#1100's page on the overdue report. The first commit bumps to it, with no code change beyond #1100's.
  • basecamp/basecamp-sdk#1102, open. The second commit pins its head 1d0f5e04 as v0.37.1-0.20261120012501-1d0f5e04225d, with make bump-sdk, the way #942 pinned an SDK commit. Bumping to the release that carries it needs no code change here.

Rejected Alternatives

  • Show the page number in the summary (page 4: 19 of 214). The absent next breadcrumb already marks the last page, and --page is what the caller just typed.
  • Read every page and merge them. That brings back the unbounded read bc3#14519 removed, from the client's side, and a merged report on a large account is too long to scan in a terminal anyway. notifications list pages the same way for the same reason.
  • Add --all beside --page. No one has asked for it, and the next breadcrumb already leads an agent through the pages.
  • Refuse --page 0 or a negative page, as comments list does. There the guard stops an explicit 0 from crawling every page. Here 0 means the first page and nothing crawls, so the command follows notifications list, which accepts it.

How to try it

Production Basecamp already pages the report. From this branch, make build, then ./bin/basecamp reports overdue on an account with more than 15 overdue to-dos: it says 15 of N overdue todos and offers --page 2. basecamp reports overdue from main says 15 overdue todos with no next page.

Further Work

  • --page on the two overdue listings. They read every page and trim to the cap locally, as when the endpoints were unpaged. Walking only until the cap, as the other account-wide listings do with accountWideCollect, would save requests on a long list.

  • The TUI's assignments hub polls reports assigned every minute per account, and now reads every page of it each time.

  • The SDK's description of the operation says "latest first", which the vendored MCP model and catalog snapshot carry. It means most recently due first; the wording belongs in basecamp-sdk and comes here with the next model sync.

Card: https://app.basecamp.com/2914079/buckets/27/card_tables/cards/10512247737