Fix update methods silently dropping empty ID arrays#207
Merged
jeremy merged 4 commits intobasecamp:mainfrom Mar 20, 2026
Merged
Fix update methods silently dropping empty ID arrays#207jeremy merged 4 commits intobasecamp:mainfrom
jeremy merged 4 commits intobasecamp:mainfrom
Conversation
The len() > 0 guard on AssigneeIDs/Assignees caused empty slices (meaning "clear all assignees") to be silently omitted from the request body. The API treats an absent field as "no change," so unassigning the last person from a card or step had no effect. Switch to a nil check so nil means "don't change" and an empty non-nil slice means "clear all."
Same len() > 0 bug as the card fix — empty slices for AssigneeIDs and CompletionSubscriberIDs were silently omitted, making it impossible to clear all assignees or completion subscribers from a todo.
Same len() > 0 bug — an empty ParticipantIDs slice was silently omitted, making it impossible to clear all participants from a schedule entry.
There was a problem hiding this comment.
Pull request overview
This PR fixes update semantics across the Go Basecamp SDK so that explicitly empty (but non-nil) ID slices are sent in update request bodies, allowing callers to “clear all” assignees/participants/subscribers rather than silently omitting the field and making no change.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Changes:
- Switch slice guards from
len(slice) > 0toslice != nilin update methods to preservenilvs empty-slice semantics. - Add/extend tests ensuring empty slices are encoded as empty arrays (e.g.,
"assignee_ids":[]) rather than omitted.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| go/pkg/basecamp/todos.go | Sends assignee_ids / completion_subscriber_ids whenever the slice is non-nil (including empty). |
| go/pkg/basecamp/todos_test.go | Adds tests asserting empty slices are present in the update request body for todos. |
| go/pkg/basecamp/schedules.go | Sends participant_ids whenever the slice is non-nil (including empty). |
| go/pkg/basecamp/schedules_test.go | Adds a test asserting empty participant IDs are sent in schedule entry updates. |
| go/pkg/basecamp/cards.go | Sends assignee_ids / assignees whenever the slice is non-nil (including empty). |
| go/pkg/basecamp/cards_test.go | Adds tests asserting empty assignee lists are sent for cards and card steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Other Update methods (Cards, Schedules) already guard against nil requests. Add the same check to Todos to prevent a nil-pointer panic.
robzolkos
added a commit
to basecamp/basecamp-cli
that referenced
this pull request
Mar 20, 2026
Picks up basecamp/basecamp-sdk#207 which fixes update methods silently dropping empty ID slices. Previously, unassigning the last assignee/participant/subscriber had no effect because the SDK omitted the empty array from the request body.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
len(slice) > 0to guard writing assignee/participant/subscriber ID arrays into the request body. This caused empty slices ([]int64{}) — meaning "clear all" — to be silently omitted. The API interprets an absent field as "no change," so clearing the last assignee/participant/subscriber had no effect.len(slice) > 0toslice != nil, preserving the three-way semantics:nil= don't change,[]int64{}= clear all,[]int64{1,2}= set specific IDs.CardsService.Update(AssigneeIDs),CardStepsService.Update(Assignees),TodosService.Update(AssigneeIDs, CompletionSubscriberIDs),SchedulesService.UpdateEntry(ParticipantIDs)Report: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9696883477
Summary by cubic
Fixes update methods that dropped empty ID arrays, so you can clear assignees, participants, and subscribers. Empty slices are now sent to the API; nil means no change.
CardsService.Update(AssigneeIDs),CardStepsService.Update(Assignees),TodosService.Update(AssigneeIDs, CompletionSubscriberIDs), andSchedulesService.UpdateEntry(ParticipantIDs). Added tests to lock this behavior.TodosService.Updateto prevent nil-pointer panics and align with other services.Written for commit b95c1d5. Summary will update on new commits.