Bump SDK to d15f023f and collapse todos update onto TodosService.Edit
Closes #541. Lineage: #538 → #540 (interim fix) → this PR (Phase 2 collapse), enabled by basecamp/basecamp-sdk#375 (merged as d15f023f).
Commit 1: SDK bump + compatibility
Pins github.com/basecamp/basecamp-sdk/go at v0.7.4-0.20260718061625-d15f023f64dc. The range brings three breaking changes the CLI absorbs here, keeping the commit green standalone:
- OAuth pointer endpoints + issuer binding (SDK #369):
AuthorizationEndpoint/DeviceAuthorizationEndpoint/RegistrationEndpointbecame*string, and discovery now requires anissuerbound code-point-exact to the base URL.Loginasserts authorization-code capability immediately after discovery — before scope handling and DCR — so a device-only server fails cleanly with zero registration requests (new test pins this). Discovery test fixtures gain the requiredissuer. - Credential-origin guard: the SDK refuses to attach credentials to requests targeting a different origin than
BaseURL. Mock-transport tests built clients with an emptyBaseURL(path-only URLs); they now set a test BaseURL. - Merge-safe
Update: sparseUpdateTodoRequestcallers (assign batch, card steps, TUI hub) silently become merge-safe, at the cost of one extra GET per update. Assign fixtures gain the now-requiredcontent; the lazy-resolution test pins the full order (validation GET → person resolution → SDK merge GET → PUT). Subscriber clearing is routed through the interim raw-PUT branch, since merge-safeUpdatecan no longer clear by omission.
Also fixes scripts/bump-sdk.sh reading api.synced_at (the SDK exposes .bc3.date, not .bc3.synced_at).
Commit 2: single-path Edit collapse
todos update drops both #540 branches (raw-PUT clear + typed merge, each fed by a raw flat-route preservation GET) for one TodosService.Edit call: exactly one typed GET and one typed PUT, no post-PUT re-Get. TestTodosUpdateSingleTypedRoundTrip pins the exact wire sequence.
Fail-closed posture split — field presence is now the server/SDK contract (BC3 always serializes completion_subscribers; the SDK model pins nil-vs-empty), so the missing-key guard is consciously deleted. The CLI still refuses to write back preserved subscriber IDs it can't trust: the Edit closure aborts before the PUT on a missing/invalid id.
Accepted wire deltas (clears per the Edit contract; previously omission):
- description clear →
"description": "" - subscriber clear →
"completion_subscriber_ids": [] - date clears remain omission
Behavior improvement: --due/--starts-on are validated with time.Parse before any HTTP — garbage and impossible dates (2026-99-99) previously reached the server; they now fail as usage errors with zero requests. Image uploads for --description move inside the Edit closure, after the GET has confirmed the todo exists, so a missing todo can't orphan uploads.
Verification
bin/cigreen on the final tree.- Live smoke (production profile, via
BASECAMP_TOKEN): all todos-write scenarios pass, including "todos update preserves completion subscribers" and the--no-dueclear leg; all assign/unassign scenarios pass on the merge-safe Update path. 10 unrelated failures are pre-existing smoke↔CLI drift (files update --description,subscriptions add --personnever existed on main; staleattachoutput-shape expectation) and server-side environment issues (message board disabled in QA project, webhook 400, timesheet/group-position 404, visibility 403). - Manual QA against the live QA project via raw
api get:--no-descriptioncleared the description (sent as"") while preserving due date and completion subscribers;--no-notify-on-completioncleared subscribers (sent as[]) while preserving content and due date. QA todo trashed afterward.
Summary by cubic
Upgrades the Basecamp SDK and collapses todos update to a single typed GET+PUT via TodosService.Edit, reducing requests and making clears explicit. Also hardens OAuth discovery with issuer binding, trailing-slash normalization, and an early capability check.
-
Refactors
- Collapse
todos updateontoTodosService.Edit(exactly one typed GET then one PUT; no raw preservation read or re-fetch). - Clear semantics: description sends
"",completion_subscriber_idssends[], date clears remain omission; preserved subscribers are kept only when IDs are valid. - Validate
--due/--starts-onwithtime.Parsebefore any HTTP; move description image uploads inside the Edit closure to avoid orphaned uploads if the todo is missing.
- Collapse
-
Dependencies
- Upgrade
github.com/basecamp/basecamp-sdk/goto a build with merge-safe Update, pointer OAuth endpoints with issuer binding, and a credential-origin guard (tests now setBaseURL). - Normalize
BaseURLbefore OAuth discovery to prevent false Launchpad fallback, and assert an authorization endpoint before scope handling/DCR; fixscripts/bump-sdk.shto read.bc3.datefor API provenance.
- Upgrade