Repository navigation
feat(generated): Changes to agents, directory_sync, sso, and 2 more services - #783
workos-sdk-automation[bot] wants to merge 6 commits into
Conversation
…iKeys, AuditLogs, Authorization, ClientApi, Connect, DirectorySync, Events, FeatureFlags, Groups, MultiFactorAuth, OrganizationDomains, OrganizationMembership, Organizations, OrganizationsIssuerTrusts, Pipes, PipesProvider, PlatformTeams, Radar, SSO, UserManagement, Vault, Webhooks, Widgets
[High impact] The SDK adds calls that can change organization access and accepted identity issuers. Fix the agent permission and Radar list conversions before merging. FindingsFix with agent prompt### Issue 1
src/workos/agents/_resource.py:98
Passing an `AgentBlueprintsCreateRequestPermission` in `permissions` raises `TypeError` before the request is sent. `create_blueprint` puts the objects straight into the body, but the JSON encoder cannot convert them. The same problem affects `update_blueprint`, both async methods, and both request models.
Convert permission objects with `to_dict()` while keeping string entries unchanged. Both request models also need to build typed permission objects in `from_dict()`.
### Issue 2
src/workos/common/models/radar_detection_domain_protections_details.py:38
`also_matched_lists` promises `RadarDetectionList` objects, but `from_dict()` leaves its entries as dictionaries. When another list matched, reading `get_detection(...).evidence.details.also_matched_lists[0].name` raises `AttributeError`. In the other direction, `to_dict()` leaves typed entries as model objects rather than dictionaries.
Convert each non-null entry in both directions, preserving null entries for deleted lists. Add a test that checks the entry type; dictionary round trips hide this bug.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryExpands the SDK with scoped agent permissions, issuer trusts, Radar detections, new events, and more endpoint methods.
Reviews (2) · Last reviewed commit: "chore(generated): add release notes frag..." · Reviewed by Greptile |
| name: str, | ||
| description: str | None = None, | ||
| permissions: list[str] | None = None, | ||
| permissions: list[AgentBlueprintsCreateRequestPermission | str] | None = None, |
There was a problem hiding this comment.
create_blueprint and update_blueprint now accept permission models, but put those objects directly into the request body. Passing permissions=[AgentBlueprintsCreateRequestPermission(slug="email:send", instance_types=["delegated"])] raises TypeError before sending a request. Both sync and async clients are affected.
Convert each model entry with to_dict() while preserving strings. Update the request models too: their from_dict() and to_dict() methods also pass permission entries through unchanged.
Knowledge Base Used: Product automation services
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/agents/_resource.py
Line: 98
Comment:
**Scoped permission calls fail**
`create_blueprint` and `update_blueprint` now accept permission models, but put those objects directly into the request body. Passing `permissions=[AgentBlueprintsCreateRequestPermission(slug="email:send", instance_types=["delegated"])]` raises `TypeError` before sending a request. Both sync and async clients are affected.
Convert each model entry with `to_dict()` while preserving strings. Update the request models too: their `from_dict()` and `to_dict()` methods also pass permission entries through unchanged.
**Knowledge Base Used:** [Product automation services](https://app.greptile.com/-/switch-tenant?tenant=workos&next=%2Fcustom-context%2Fknowledge-base%2Fworkos%2Fworkos-python%2F-%2Fdocs%2Fproduct-automation-services.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if (_v_list := data["list"]) is not None | ||
| else None, | ||
| also_matched_list_ids=data.get("also_matched_list_ids"), | ||
| also_matched_lists=data.get("also_matched_lists"), |
There was a problem hiding this comment.
Matched lists lack model fields
from_dict() leaves also_matched_lists entries as dictionaries despite declaring them as RadarDetectionList objects. For domain-protection results from get_detection(), reading an entry's .name or .workos_managed raises AttributeError.
The reverse direction also fails: to_dict() leaves caller-created model objects in its output. Convert each non-null entry in both directions and preserve null entries.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/common/models/radar_detection_domain_protections_details.py
Line: 38
Comment:
**Matched lists lack model fields**
`from_dict()` leaves `also_matched_lists` entries as dictionaries despite declaring them as `RadarDetectionList` objects. For domain-protection results from `get_detection()`, reading an entry's `.name` or `.workos_managed` raises `AttributeError`.
The reverse direction also fails: `to_dict()` leaves caller-created model objects in its output. Convert each non-null entry in both directions and preserve null entries.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| name: str, | ||
| description: str | None = None, | ||
| permissions: list[str] | None = None, | ||
| permissions: list[AgentBlueprintsCreateRequestPermission | str] | None = None, |
There was a problem hiding this comment.
Typed permissions cannot be sent
Passing an AgentBlueprintsCreateRequestPermission in permissions raises TypeError before the request is sent. create_blueprint puts the objects straight into the body, but the JSON encoder cannot convert them. The same problem affects update_blueprint, both async methods, and both request models.
Convert permission objects with to_dict() while keeping string entries unchanged. Both request models also need to build typed permission objects in from_dict().
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/agents/_resource.py
Line: 98
Comment:
**Typed permissions cannot be sent**
Passing an `AgentBlueprintsCreateRequestPermission` in `permissions` raises `TypeError` before the request is sent. `create_blueprint` puts the objects straight into the body, but the JSON encoder cannot convert them. The same problem affects `update_blueprint`, both async methods, and both request models.
Convert permission objects with `to_dict()` while keeping string entries unchanged. Both request models also need to build typed permission objects in `from_dict()`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if (_v_list := data["list"]) is not None | ||
| else None, | ||
| also_matched_list_ids=data.get("also_matched_list_ids"), | ||
| also_matched_lists=data.get("also_matched_lists"), |
There was a problem hiding this comment.
Matched lists have wrong types
also_matched_lists promises RadarDetectionList objects, but from_dict() leaves its entries as dictionaries. When another list matched, reading get_detection(...).evidence.details.also_matched_lists[0].name raises AttributeError. In the other direction, to_dict() leaves typed entries as model objects rather than dictionaries.
Convert each non-null entry in both directions, preserving null entries for deleted lists. Add a test that checks the entry type; dictionary round trips hide this bug.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/common/models/radar_detection_domain_protections_details.py
Line: 38
Comment:
**Matched lists have wrong types**
`also_matched_lists` promises `RadarDetectionList` objects, but `from_dict()` leaves its entries as dictionaries. When another list matched, reading `get_detection(...).evidence.details.also_matched_lists[0].name` raises `AttributeError`. In the other direction, `to_dict()` leaves typed entries as model objects rather than dictionaries.
Convert each non-null entry in both directions, preserving null entries for deleted lists. Add a test that checks the entry type; dictionary round trips hide this bug.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
feat(agents)!: Change agents API surface
feat(directory_sync)!: Change directory sync API surface
feat(sso): Add SSO API surface
ConnectionSAMLCertificateReplaced.ConnectionSAMLCertificateReplacedData.ConnectionSAMLCertificateReplacedDataConnection.ConnectionSAMLCertificateReplacedDataCertificate.ConnectionSAMLCertificateReplacedDataCertificateCertificateType.feat(webhooks): Add webhook API surface
connection.saml_certificate_replacedtoCreateWebhookEndpointEvents.connection.saml_certificate_replacedtoUpdateWebhookEndpointEvents.fix(events): Updated model
EventSchemaEventSchema.Triggered by workos/openapi-spec@ddc0648
BEGIN_COMMIT_OVERRIDE
feat(agents): Change agents API surface (#783)
feat(directory_sync): Change directory sync API surface (#783)
feat(sso): Add SSO API surface (#783)
feat(webhooks): Add webhook API surface (#783)
fix(events): Updated model
EventSchema(#783)END_COMMIT_OVERRIDE