feat(workspace-users): exclude removed users by default#138
Merged
Conversation
getWorkspaceUsers now omits removed users unless includeRemoved is true. The Twist API always returns removed users with no override param, so the SDK filters client-side in both the awaited and batch paths — the latter via a new optional transform hook on BatchRequestDescriptor. This lets consumers (twist-cli, MCP) drop their own client-side filtering. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
doistbot
reviewed
May 22, 2026
Member
doistbot
left a comment
There was a problem hiding this comment.
This PR cleanly introduces default client-side filtering for removed workspace users across both awaited and batch execution paths, nicely aligning the SDK's behavior with other clients. The implementation is straightforward and effectively addresses the current backend API limitations. A few refinements were noted around leveraging Zod's built-in transform capabilities to simplify the custom hook logic, optimizing performance by filtering out removed users before paying the schema validation cost, and strengthening the test suite through better mock reuse, consistent apiUrl helper usage, and explicit query parameter assertions on batch requests.
Replace the custom BatchRequestDescriptor transform hook with z.array(WorkspaceUserSchema).transform(filterRemoved), shared by both the awaited and batch paths. Reverts the batch type/builder changes since the schema now carries the filtering. Also tighten batch tests: reuse shared mocks, use the apiUrl helper, and assert no include_removed/with_removed param is serialized. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
doist-release-bot Bot
added a commit
that referenced
this pull request
May 22, 2026
## [2.8.0](v2.7.1...v2.8.0) (2026-05-22) ### Features * **workspace-users:** exclude removed users by default ([#138](#138)) ([6e4b93f](6e4b93f)), closes [twist-cli#245](Doist/twist-cli#245)
5 tasks
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
getWorkspaceUsersnow excludes users withremoved: trueby default; passincludeRemoved: trueto include them./workspace_users/get(server:workspace_users.pyget(id)) callsworkspaces.get_users(ws.id)without the model'swith_removedarg, so it's hardcoded towith_removed=Trueand exposes no override param. Filtering therefore happens client-side in the SDK — matching what twist-web (Redux selectors) and twist-cli already do..then(); the batch path uses a new optionaltransform?: (data: unknown) => Thook onBatchRequestDescriptor, applied after schema parse inbatch-builder.ts. The batch descriptor now also carriesz.array(WorkspaceUserSchema), so batch results are validated too.Prompted by twist-cli#245 review — the default belongs in the SDK so cli/MCP can drop their own filtering.
Test plan
getWorkspaceUsersexcludes removed users by default (awaited + batch)includeRemoved: truereturns all users (awaited + batch)include_removed/with_removedquery param is sent (proves client-side filtering)type-check,oxlint,oxfmtclean🤖 Generated with Claude Code