Page the account-wide lists at 50 per page

TH
16d ago
+1886-611

Written by @thehalebot

Six account-wide operations in the spec and every SDK assume Basecamp answers them whole. basecamp/bc3#14537 pages all six at 50 records on every page, with a Link: rel="next" header while more remain and X-Total-Count on every page. Five of them were unpaged, so once it ships every SDK would return page 1 as if it were the whole answer. The sixth, the overdue to-dos report, was paged by basecamp/bc3#14519 at 15, 30, 50 and then 100, and #1100 described those sizes. With this PR every SDK follows the pages of the five, and the overdue report's spec and notes describe 50 a page.

Why 50, not 100. This follows bc3#14537's reason. Every API collection that pages at one fixed size already uses 50, among them search, notifications, the activity timeline, bookmarks and bubble-ups, so clients already handle it. The cost per record is flat, about 3 KB and 4,400 allocations a to-do, so 100 would double each request's work: in bc3's measurement the overdue to-dos feed took 280–330 ms at 50 and 560–1,150 ms at 100. 50 halves that work for twice as many requests.

Merge order: merge after basecamp/bc3#14537, which pages these routes on Basecamp's side. basecamp/basecamp-mcp-server#385 and basecamp/basecamp-cli#1044 merge after this.

There is one commit per route, plus one that moves Go's person progress onto the wrapped-page follower the assigned report needed.

What changes for callers

RouteOperationShapeNow
GET /todos/overdue.jsonGetEverythingOverdueTodosarraylink pagination, page
GET /cards/overdue.jsonGetEverythingOverdueCardsarraylink pagination, page
GET /my/assignments/completed.jsonGetMyCompletedAssignmentsarraylink pagination, page
GET /reports/timesheet.jsonGetTimesheetReportarraylink pagination, page
GET /reports/todos/assigned/:id.jsonGetAssignedTodosobjectwrapped pagination over todos, page
GET /reports/todos/overdue.jsonGetOverdueTodosobject of four arraysunchanged from #1100: page, no walk
  • Arrays carry the @basecampPagination(style: "link", maxPageSize: 50) trait, as the other paged lists do. Without page, each SDK still returns every record, one request per 50. A positive page returns that page alone.
  • The assigned to-dos report is the same shape as GetPersonProgress ({person, events}), so it takes the same trait with key: "todos". Each SDK walks todos and keeps the first page's person and grouped_by, which bc3 repeats on every page. Its three members are marked @required, as bc3's jbuilder writes all three unconditionally; the Rust generator refuses a wrapped key that may be absent.
  • The overdue report keeps #1100's surface. Only its doc, MIGRATING.md and the page-2 test fixtures change, from the geared sizes to 50.
  • Go: EverythingService.OverdueTodos and OverdueCards take page int32 and return *TodoListResult / *CardListResult. MyAssignmentsService.Completed takes page int32 and returns the new *MyAssignmentListResult. TimesheetService.Report returns *TimesheetListResult and honours Limit and Page, sharing one tail with ProjectReport and RecordingReport. ReportsService.AssignedTodos takes AssignedTodosOptions.Page and its response gains Meta.
  • Other SDKs: the generated methods return each SDK's paged list type (ListResult, Ruby's lazy ListEnumerator, Rust's first Page). Kotlin and Swift return a typed AssignedTodosResult where they returned JSON.
  • Breaking, pre-1.0: every signature above changes with no alias. MIGRATING.md has one Unreleased section covering all five, per SDK.

Invariants

  • Without page, a call returns every record across pages, in order. Go and TypeScript tests for each route serve page 1 with a rel="next" link and page 2 without one, and assert two requests and the ids of both pages in order with Meta{TotalCount, Truncated: false}. Python and Ruby cover the overdue feeds.
  • A positive page is one request for that page. A Go test per route asks for page 2, gets a link to page 3, and asserts one request to ?page=2 with Truncated: true.
  • The assigned report keeps its wrapper. The Go and TypeScript tests assert person and grouped_by from page 1 and the to-dos of both pages, with group_by carried into the followed URL.
  • Filters still reach the wire. The existing overdue filter tests and the timesheet params test pass with page added.
  • Every new public type is reachable from outside the package. TypeScript's index.ts re-exports the four new option types. Swift's PublicAPIConsumer builds GetAssignedTodosResponseContent with its three required members, beside GetPersonProgressResponseContent, now that the model has no zero-argument init.
  • Generated files match the spec. Regenerated with make generate at every commit (Swift through the swift:6.2 image, since this host has no Swift toolchain).
  • make check passes on Go, TypeScript, Python, Kotlin and Rust, rs-deny included now that main uses jiff. Its four Ruby steps (rb-test, the Ruby conformance runner and its tests, and the YARD half of check-deprecation-parity) didn't run locally, as this host has no Ruby 4, and Swift has no toolchain here; CI covers both.

Rejected Alternatives

  • Model the assigned report like #1100's overdue report (a page with no walk). The assigned report has one array beside fields that repeat on every page, which is the wrapped variant SPEC §8 already defines for GetPersonProgress, so callers get every to-do as before. The overdue report's four arrays have no such key, so it stays as #1100 left it.

Further Work

  • GetTimesheetReport sends from, to and person_id, which bc3's Reports::TimesheetsController never reads (it reads start_date, end_date, people_ids[] and bucket_ids[]). basecamp-mcp-server builds the request by hand for that reason. This PR leaves the params as they are.
  • basecamp/basecamp-mcp-server#385 pages the matching tools, pinned to this branch.