Skip to content

Conversation

@awolfden
Copy link
Contributor

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.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@awolfden awolfden requested a review from a team as a code owner October 15, 2025 16:26
@awolfden awolfden requested a review from tribble October 15, 2025 16:26
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

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 in workos/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 None in tests/test_user_management_revoke_session.py:44
  • Change follows existing pattern used by other deletion methods like delete_user and delete_organization_membership
  • Minor cleanup opportunity: unused _mock_session helper 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
Loading

Additional Comments (1)

  1. tests/test_user_management_revoke_session.py, line 9-24 (link)

    style: unused helper function - can be removed

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@awolfden awolfden merged commit a2cfcb5 into main Oct 15, 2025
6 checks passed
@awolfden awolfden deleted the patch-revoke-session-return branch October 15, 2025 17:31
@greptile-apps greptile-apps bot mentioned this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants