Merged
Conversation
Contributor
There was a problem hiding this comment.
Greptile Overview
Summary
Updated revoke_session methods to return None instead of UserManagementSession, aligning with the actual WorkOS API response behavior.
- Modified both sync (
UserManagement.revoke_session) and async (AsyncUserManagement.revoke_session) implementations inworkos/user_management.py:1440,2142 - Updated protocol definition to reflect new return type in
workos/user_management.py:742 - Updated test expectations to assert
response is Noneintests/test_user_management_revoke_session.py:44 - Change follows existing pattern used by other deletion methods like
delete_useranddelete_organization_membership - Minor cleanup opportunity: unused
_mock_sessionhelper function can be removed from test file
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The changes are straightforward, well-tested, and follow established patterns in the codebase. The implementation correctly aligns with the API's actual behavior and is consistent with similar deletion methods.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| workos/user_management.py | 5/5 | Updated revoke_session methods to return None instead of UserManagementSession, matching API behavior and consistent with other deletion methods like delete_user |
| tests/test_user_management_revoke_session.py | 4/5 | Updated test to expect None response and mock empty response body, but leaves unused _mock_session helper function |
Sequence Diagram
sequenceDiagram
participant Client
participant UserManagement
participant HTTPClient
participant WorkOSAPI
Client->>UserManagement: revoke_session(session_id="session_abc")
UserManagement->>UserManagement: Prepare JSON payload {"session_id": "session_abc"}
UserManagement->>HTTPClient: request(SESSIONS_REVOKE_PATH, POST, json)
HTTPClient->>WorkOSAPI: POST /user_management/sessions/revoke
WorkOSAPI-->>HTTPClient: 200 OK (empty response)
HTTPClient-->>UserManagement: (empty response)
UserManagement-->>Client: None
Additional Comments (1)
-
tests/test_user_management_revoke_session.py, line 9-24 (link)style: unused helper function - can be removed
2 files reviewed, 1 comment
mattgd
approved these changes
Oct 15, 2025
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.
Description
The revoke session endpoint does not return the revokes session. This patch updates the corresponding methods and tests to return none, which aligns with the API response.
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.