Skip to content

fix: export missing types and update event tests#631

Merged
gjtorikian merged 3 commits intomainfrom
correct-imports
Apr 23, 2026
Merged

fix: export missing types and update event tests#631
gjtorikian merged 3 commits intomainfrom
correct-imports

Conversation

@gjtorikian
Copy link
Copy Markdown
Contributor

@gjtorikian gjtorikian commented Apr 23, 2026

Summary

  • Export missing types (ResourceTargetById, ResourceTargetByExternalId, ParentResourceById, ParentResourceByExternalId, ParentById, ParentByExternalId) from workos.authorization
  • Export missing types (PasswordPlaintext, PasswordHashed, RoleSingle, RoleMultiple) from workos.user_management
  • Update event tests to use list_event_schema fixture instead of inline JSON with ActionAuthenticationDenied
  • Add empty page test cases for both sync and async event listing

Test plan

  • uv run pytest tests/test_events.py passes
  • Verify new types are importable: from workos.authorization import ResourceTargetById
  • Verify new types are importable: from workos.user_management import PasswordPlaintext
  • uv run pyright passes with no new errors

Open in Devin Review

Types like ResourceTargetById, PasswordPlaintext, and others
were defined in _resource.py but not re-exported from the
package __init__.py, making them inaccessible when importing
from the top-level module.
Tests were using inline JSON and importing
ActionAuthenticationDenied which is no longer needed.
Switch to the list_event_schema fixture and add
empty page test cases for both sync and async clients.
@gjtorikian gjtorikian requested review from a team as code owners April 23, 2026 15:00
@gjtorikian gjtorikian requested a review from mattgd April 23, 2026 15:00
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

This PR fixes missing public exports in workos.authorization and workos.user_management by re-exporting helper types (ResourceTargetById, ParentById, PasswordPlaintext, RoleSingle, etc.) that already existed in the internal _resource.py modules but were absent from the package __init__.py. It also strengthens paginated-list tests across the board (replacing weak isinstance(page.data, list) assertions with concrete length and type checks) and refactors test_events.py to use a proper JSON fixture instead of inline data.

Confidence Score: 5/5

This PR is safe to merge — all exported types are confirmed to exist in source, and test improvements are straightforward.

All type exports are verified against the actual _resource.py definitions. Test changes replace weak isinstance(list) checks with concrete type assertions, strictly improving coverage. No logic changes, no security impact, no breaking changes.

No files require special attention.

Important Files Changed

Filename Overview
src/workos/authorization/init.py Adds six type exports (ResourceTargetById, ResourceTargetByExternalId, ParentResourceById, ParentResourceByExternalId, ParentById, ParentByExternalId) that are confirmed to be defined in _resource.py.
src/workos/user_management/init.py Adds four type exports (PasswordPlaintext, PasswordHashed, RoleSingle, RoleMultiple) that are confirmed to be defined in _resource.py.
tests/test_events.py Replaces inline JSON payload with list_event_schema.json fixture, switches assertion to DsyncUserCreated, and adds empty-page tests for both sync and async paths.
tests/test_authorization.py Strengthens all paginated-list assertions from isinstance(page.data, list) to concrete length + item-type checks; imports UserOrganizationMembershipBaseListData.
tests/test_user_management.py Strengthens all paginated-list assertions and imports AuthorizedConnectApplicationListData and UserSessionsListItem.
.oagen-manifest.json Bumps manifest version to 2, updates timestamp, and registers the two new fixture files.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    namespace workos_authorization {
        class Authorization
        class AsyncAuthorization
        class ResourceTargetById {
            +resource_id: str
        }
        class ResourceTargetByExternalId {
            +external_id: str
        }
        class ParentResourceById {
            +parent_resource_id: str
        }
        class ParentResourceByExternalId {
            +external_id: str
        }
        class ParentById {
            +parent_resource_id: str
        }
        class ParentByExternalId {
            +external_id: str
        }
    }
    namespace workos_user_management {
        class UserManagement
        class AsyncUserManagement
        class PasswordPlaintext {
            +password: str
        }
        class PasswordHashed {
            +password_hash: str
            +hash_type: str
        }
        class RoleSingle {
            +role: str
        }
        class RoleMultiple {
            +roles: list
        }
    }

    Authorization ..> ResourceTargetById : uses
    Authorization ..> ResourceTargetByExternalId : uses
    Authorization ..> ParentById : uses
    Authorization ..> ParentByExternalId : uses
    UserManagement ..> PasswordPlaintext : uses
    UserManagement ..> PasswordHashed : uses
    UserManagement ..> RoleSingle : uses
    UserManagement ..> RoleMultiple : uses
Loading

Reviews (2): Last reviewed commit: "test: strengthen paginated list assertio..." | Re-trigger Greptile

greptile-apps[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

The generated tests only verified `page.data` was a list, which
passes even when deserialization silently returns raw dicts.
Asserting `len` and `isinstance` on the first element catches
type-mapping regressions at the fixture level.
@gjtorikian gjtorikian merged commit 0bd6cf8 into main Apr 23, 2026
10 of 11 checks passed
@gjtorikian gjtorikian deleted the correct-imports branch April 23, 2026 15:32
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.

1 participant