Stop echoing back step fields the caller never changed
bc3#12521 (4e34dc83eb, on
master) made JSON step and card updates presence-aware. steps#update now
does @recording.recordable.changing(step_update_params) and replaces
assignees only if update_assignees?, so omitting a parameter leaves it
unchanged; an explicit null clears the due date and an explicit [] still
removes everyone. The public docs say the same thing now.
That retires the title workaround at all three call sites. Each re-sent the
step's current title because the old controller rebuilt the recordable from
scratch and rejected an update without one:
cards step updatecarried a dedicatedCardSteps().Getpurely to fetch
a title it would send straight back. That extra read is gone.assign --step/unassign --stepalready fetch the step for its
assignee list, so no request is saved there. What goes away is the CLI
asserting a value the caller never asked to change — which is the actual bug
in #604: a title edited concurrently would be silently reverted by an
unrelated assign.
Tests
TestCardsStepUpdate{Assignees,Due}OnlyCarriesTitle asserted the old
behaviour, so they're inverted rather than supplemented. getCount == 0 is what
proves the extra read is gone — asserting on the request body alone would not.
New coverage pins the no-echo contract for assign/unassign --step, including
that unassigning the last person sends an explicit empty list rather than
omitting the key.
Verified live
Against production (QA sandbox project, card created and trashed afterward):
| step | request sends | result |
|---|---|---|
assign --step | assignee_ids only | title and due_on survived |
cards step update --due | due_on only | title and assignees survived |
unassign --step (last one) | assignee_ids: [] | assignees cleared; title + due_on survived |
Rows 1 and 2 are exactly the two data-loss bugs reported in #604 — both are
fixed server-side, with no client release needed. Row 3 also settles a claim I
made and then withdrew on the record: unassigning the last person does not
silently no-op. The SDK builds body := map[string]any{} and guards on
req.AssigneeIDs != nil, and the CLI's removeID returns a non-nil empty
slice, so assignee_ids: [] does reach the wire.
bin/ci is green.
Not in scope
Explicit due-date clears. The CLI can't express one — cards.go only sets
req.DueOn when --due is non-empty, so --due "" is indistinguishable from
omitting the flag. Separately, SDK v0.12.0 encodes a card's due-date clear by
omitting due_on, which post-#12521 means "leave unchanged"; that's already
fixed upstream in basecamp-sdk#647 and needs an SDK release to reach us.
Refs #604 — closing that issue is a separate step, once this merges.
Summary by cubic
Send only changed fields when updating card steps to avoid clobbering titles or due dates and remove the extra read in cards step update. Also updates SKILL.md to document presence-aware step updates (omit unchanged fields; use null/[] to clear).
- Bug Fixes
assign --stepandunassign --stepnow send onlyassignee_ids(notitle/due_on), preventing silent reverts from concurrent edits (refs #604). Tests inverted to assert no echo and that clearing usesassignee_ids: [].cards step updatestops reading the step to carrytitle; due-only and assignee-only updates send only the changed field. Tests assert zero extra GETs and correct request bodies.