Skip to content

Fix Go todo list status filters for completed and lifecycle states#243

Open
robzolkos wants to merge 2 commits intobasecamp:mainfrom
robzolkos:fix-todos-completed-filter
Open

Fix Go todo list status filters for completed and lifecycle states#243
robzolkos wants to merge 2 commits intobasecamp:mainfrom
robzolkos:fix-todos-completed-filter

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

@robzolkos robzolkos commented Apr 2, 2026

Summary

The Go todos wrapper exposed completion filtering through TodoListOptions.Status, but the Basecamp todos endpoint uses completed=true for completed items and status=active|archived|trashed for lifecycle state. This PR keeps the existing Go API intact while translating those filters into the query parameters the API actually expects, so todo listing returns the correct results for completed and lifecycle-filtered requests.

Refs basecamp/basecamp-cli#403

Changes

  • map Status: "completed" to completed=true
  • treat pending and incomplete as the default API behavior by omitting both query params
  • continue passing lifecycle statuses like active, archived, and trashed through status
  • update Go docs and examples to show the supported filtering behavior
  • add Go test coverage for completed, pending/incomplete, and lifecycle filter handling

Summary by cubic

Fixes todo list filtering in the Go client so completed and lifecycle states return correct results. TodoListOptions.Status now maps to the API’s completed and status query params, and docs/examples clarify that todo APIs take todolistID/todoID without projectID.

  • Bug Fixes
    • Map Status: "completed" to completed=true; omit params for pending/incomplete (API default).
    • Pass lifecycle states ("active", "archived", "trashed") via status.
    • Update docs/examples (drop projectID for todos, add completed list example) and add tests for completed, pending/incomplete, and lifecycle filters.

Written for commit 1c86f1e. Summary will update on new commits.

Copilot AI review requested due to automatic review settings April 2, 2026 03:42
@github-actions github-actions bot added go breaking Breaking change to public API labels Apr 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

⚠️ Potential breaking changes detected:

  • Changed the function signature of TodosService.List method by removing the required projectID parameter.
  • Changed the function signature of TodosService.Create method by removing the required projectID parameter.
  • Changed the function signature of TodosService.Complete method by removing the required projectID parameter.
  • Changed the behavior of TodoListOptions.Status: previously, an empty value would include all todos regardless of status. Now, an empty value returns the API default of pending/incomplete todos (implicit behavior change).

Review carefully before merging. Consider a major version bump.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the Go todos wrapper to correctly translate filter values into the query parameters expected by the Basecamp API. The issue was that TodoListOptions.Status exposed completion filtering, but the BC3 API uses two separate query parameters: status=active|archived|trashed for lifecycle states and completed=true for completed items.

Changes:

  • Map Status: "completed" to completed=true query parameter
  • Treat "pending" and "incomplete" as API defaults (omit both query parameters)
  • Pass lifecycle statuses ("active", "archived", "trashed") through the status parameter
  • Update documentation to clarify supported status values
  • Add comprehensive test coverage for the three filtering scenarios
  • Update examples to demonstrate the filtering functionality

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
go/pkg/basecamp/todos.go Updated TodoListOptions struct documentation and refactored List method to properly translate filter values to API parameters
go/pkg/basecamp/todos_test.go Added test cases for lifecycle statuses and three service-level tests verifying the parameter translation logic
go/pkg/basecamp/example_test.go Updated example to demonstrate the "completed" filter
go/pkg/basecamp/doc.go Updated documentation with examples showing both default and filtered todo listing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added the bug Something isn't working label Apr 2, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="go/pkg/basecamp/todos_test.go">

<violation number="1" location="go/pkg/basecamp/todos_test.go:1017">
P3: Use r.URL.Query().Has("status") / Has("completed") to assert absence. Get returns "" for both missing and empty values, so this test can’t reliably detect that the query param was omitted.

(Based on your team's feedback about checking query param absence with Has instead of Get.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@robzolkos
Copy link
Copy Markdown
Collaborator Author

Fixed — updated the todo query omission assertions to use URL.Query().Has for presence checks instead of relying on Get returning an empty string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change to public API bug Something isn't working go

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants