feat(generated): OrganizationMembership (batch e471ddef)#675
feat(generated): OrganizationMembership (batch e471ddef)#675workos-sdk-automation[bot] wants to merge 2 commits into
Conversation
Greptile SummaryThis PR regenerates SDK models and fixtures from the latest spec. The main changes are:
Confidence Score: 1/5The regenerated package import surface is currently broken for common models and organization-domain clients.
src/workos/common/models/init.py, src/workos/common/init.py, src/workos/organization_domains/models/init.py
What T-Rex did
|
| from .auth_method_mismatch_error import ( | ||
| AuthMethodMismatchError as AuthMethodMismatchError, | ||
| ) |
There was a problem hiding this comment.
Missing Generated Model Modules
These new re-exports import modules that are not included in the PR, starting with auth_method_mismatch_error.py and continuing with the new pipes and session models below. Any import of workos.common.models now fails at module load with ModuleNotFoundError, so the SDK and the new round-trip tests cannot load.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/common/models/__init__.py
Line: 209-211
Comment:
**Missing Generated Model Modules**
These new re-exports import modules that are not included in the PR, starting with `auth_method_mismatch_error.py` and continuing with the new pipes and session models below. Any import of `workos.common.models` now fails at module load with `ModuleNotFoundError`, so the SDK and the new round-trip tests cannot load.
How can I resolve this? If you propose a fix, please make it concise.| @@ -459,12 +462,6 @@ | |||
| from .organization_domain_deleted_data import ( | |||
There was a problem hiding this comment.
The standalone organization-domain state and verification-strategy alias modules still exist, but this change removes their public re-exports from workos.common.models and workos.common. Existing SDK users that import OrganizationDomainStandAloneState or OrganizationDomainStandAloneVerificationStrategy from those public package surfaces now get ImportError even though the underlying aliases were not removed.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/common/models/__init__.py
Line: 462
Comment:
**Removed Public Alias Exports**
The standalone organization-domain state and verification-strategy alias modules still exist, but this change removes their public re-exports from `workos.common.models` and `workos.common`. Existing SDK users that import `OrganizationDomainStandAloneState` or `OrganizationDomainStandAloneVerificationStrategy` from those public package surfaces now get `ImportError` even though the underlying aliases were not removed.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
🚩 PR appears to be an incomplete code generation commit
The commit message is "chore(generated): shared regenerated files" which suggests this may be a partial commit of auto-generated output. The .oagen-manifest.json lists test fixture files for the new models but does not list corresponding src/workos/common/models/ source files for auth_method_mismatch_error, session_reauthenticated*, or pipes_connected_account_connection_failed*. This suggests the code generator intentionally did not produce these model files (perhaps they come from a different generation pass), yet the __init__.py re-exports were added prematurely. Similarly, the OrganizationDomainStandAlone re-export was removed from organization_domains/models/__init__.py but the consumer (_resource.py) was not updated — possibly because _resource.py is generated by a separate pass. If this PR is meant to land alongside another PR that provides the missing pieces, they should be coordinated to avoid a broken intermediate state on the main branch.
Was this helpful? React with 👍 or 👎 to provide feedback.
| from .organization_domain_stand_alone import ( | ||
| OrganizationDomainStandAlone as OrganizationDomainStandAlone, | ||
| ) |
There was a problem hiding this comment.
🔴 Removing a model re-export breaks the organization domains feature entirely
The re-export of OrganizationDomainStandAlone is removed from the package init (src/workos/organization_domains/models/__init__.py:9-11), but the resource module still depends on it, so any use of the organization domains API will crash.
Impact: Calling get_organization_domain() or verify_organization_domain() raises an error, making the organization domains feature unusable.
Incomplete removal: re-export deleted but consumers not updated
The PR removes the re-export from src/workos/organization_domains/models/__init__.py (lines 9–11 on the old side), but src/workos/organization_domains/_resource.py:11 still does:
from .models import OrganizationDomainStandAloneThis import resolves against models/__init__.py, which no longer defines or re-exports OrganizationDomainStandAlone. The underlying file organization_domain_stand_alone.py still exists, but Python's from package import name only looks in the package's __init__.py, not in submodules.
The resource module uses OrganizationDomainStandAlone in get_organization_domain (_resource.py:63,84), verify_organization_domain (_resource.py:119,140), and their async counterparts (_resource.py:193,214,249,270).
Additionally, tests/test_organization_domains.py:10 imports it and multiple tests reference it (lines 44, 64, 183, 209).
Prompt for agents
The PR removes the OrganizationDomainStandAlone re-export from src/workos/organization_domains/models/__init__.py, but src/workos/organization_domains/_resource.py still imports OrganizationDomainStandAlone from .models (line 11) and uses it as the return type and model parameter in get_organization_domain and verify_organization_domain (both sync and async variants). Either restore the re-export in __init__.py, or update _resource.py to use OrganizationDomain directly (since OrganizationDomainStandAlone is just a TypeAlias for OrganizationDomain). Also update tests/test_organization_domains.py line 10 and its usages at lines 44, 64, 183, 209.
Was this helpful? React with 👍 or 👎 to provide feedback.
| from .auth_method_mismatch_error import ( | ||
| AuthMethodMismatchError as AuthMethodMismatchError, | ||
| ) |
There was a problem hiding this comment.
🔴 New model classes are imported but their source files are missing, preventing the SDK from loading
Six new model classes are imported in the package init (src/workos/common/models/__init__.py:209-211) but the corresponding source files were never created, so importing the SDK at all will crash.
Impact: Any application that imports the workos package will fail immediately with a module-not-found error.
Missing source files for newly added imports
The PR adds imports in src/workos/common/models/__init__.py for:
AuthMethodMismatchErrorfrom.auth_method_mismatch_error(line 209-211)PipesConnectedAccountConnectionFailedfrom.pipes_connected_account_connection_failed(line 557-559)PipesConnectedAccountConnectionFailedDatafrom.pipes_connected_account_connection_failed_data(line 560-562)SessionReauthenticatedfrom.session_reauthenticated(line 600)SessionReauthenticatedDatafrom.session_reauthenticated_data(line 601-603)SessionReauthenticatedDataImpersonatorfrom.session_reauthenticated_data_impersonator(line 604-606)
None of these .py files exist on disk. The .oagen-manifest.json lists test fixtures for these models but does not list source files under src/workos/common/models/. The test fixtures were created, and src/workos/common/__init__.py also re-exports these classes (lines 123, 367-372, 402-406), compounding the failure.
Since workos.common.models is imported transitively by virtually every part of the SDK, this makes the entire package non-functional.
Prompt for agents
The PR adds imports for 6 new model classes in src/workos/common/models/__init__.py (AuthMethodMismatchError, PipesConnectedAccountConnectionFailed, PipesConnectedAccountConnectionFailedData, SessionReauthenticated, SessionReauthenticatedData, SessionReauthenticatedDataImpersonator), but the corresponding Python source files under src/workos/common/models/ were never created. The code generator (oagen) appears to have generated the __init__.py changes, test fixtures, and manifest entries, but not the actual model source files. These files need to be generated and included in the PR. Each should follow the standard pattern: a @dataclass(slots=True) class with from_dict and to_dict methods, matching the structure shown in the test fixtures.
Was this helpful? React with 👍 or 👎 to provide feedback.
| roles: List["SlimRole"] | ||
| """The list of roles assigned to the user within the organization.""" |
There was a problem hiding this comment.
🚩 New required roles field is a breaking change for existing API consumers
The roles field added to OrganizationMembership at src/workos/organization_membership/models/organization_membership.py:42 is non-optional and has no default value. In from_dict, it uses data["roles"] (line 67) rather than data.get("roles", []), meaning any API response that doesn't include a roles key will raise a KeyError (caught and re-raised as a deserialization error). This is consistent with how other required fields are handled, but it means that if users pin this SDK version while their WorkOS environment still returns the old response format (without roles), deserialization will fail. The existing test fixtures (organization_membership_created_data.json, organization_membership_updated_data.json) already include roles, suggesting the API already returns this field. Worth confirming that the API change is fully rolled out before releasing this SDK version.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Regenerated SDK from spec changes.
Triggered by workos/openapi-spec@75604c7