Repository navigation
feat(connectors)!: AAuth connectors with Cedar policy entities, and member policy attributes - #171
Merged
Merged
Conversation
…ember policy attributes Match the control plane's connector and member API: - ConnectorAuthMode gains `aauth`; an aauth connector names its person_server_url and application_id. - Connectors carry `policy_entities`, typed as PolicyEntity / EntityUid (Cedar's JSON entity format), on read, create and update. - Members carry `policy_attributes` on read, create and update. BREAKING CHANGE: `approval_policy` and `person_server_mode` are removed from Connector, ConnectorCreateRequest and `connectors.create()`, along with the ConnectorApprovalPolicy and ConnectorPersonServerMode enums. The control plane no longer accepts or returns either field; AAuth policy (Cedar entities and member attributes) replaces them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The control plane now lets an owner create a customer member by its external_user_id. `members.create()` takes a BusinessMemberCreate or a CustomerMemberCreate (or a plain dict validated through the same discriminated union, where a missing member_type means business) and always sends member_type, mirroring the Rust SDK's MemberCreateParams. Both variants refuse unknown fields and carry policy_attributes. BREAKING CHANGE: `members.create()` / `AsyncMembers.create()` no longer take keyword arguments; pass a BusinessMemberCreate, a CustomerMemberCreate or a dict. MemberCreateRequest is replaced by BusinessMemberCreate, CustomerMemberCreate and the MemberCreate union. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
What changed
ConnectorAuthMode.AAUTH(aauth). An aauth connector setsperson_server_urlandapplication_id; the server validates both.policy_entitieson read (Connector), create (ConnectorCreateRequest/connectors.create) and update (ConnectorUpdateRequest/connectors.update), sync and async. They are typed asPolicyEntity(uid: EntityUid,attrs: dict[str, Any] = {},parents: list[EntityUid] = []), which is Cedar's JSON entity format. Callers can pass the models or plain dicts.policy_attributes: dict[str, Any] | Noneon read (Member), create and update (MemberUpdateRequest/members.update), sync and async. Values may reference an entity as{"__entity": {"type": ..., "id": ...}}.members.create()takes either aBusinessMemberCreate(emailandnamerequired, plus optionalrole) or aCustomerMemberCreate(external_user_idof the formuser:{id}oranon:{id}, optionalname/email, norole). Customer creates are owner-only. Both carrytags,metadataandpolicy_attributes, and both refuse unknown fields. A plain dict is validated through theMemberCreatediscriminated union, and a dict withoutmember_typeis a business member.member_typeis always sent. This mirrors the Rust SDK'sMemberCreateParams.Why
This brings the SDK in line with the control plane's current API: introspection-cloud #3272 (AAuth connectors, policy entities, member policy attributes) and #3391 (
policy_attributeson member create, pending). It is the Python counterpart of introspection-rust-sdk #115, andPolicyEntity/EntityUidmirror that SDK's types.Breaking change
approval_policyandperson_server_modeare removed fromConnector,ConnectorCreateRequestandconnectors.create(). TheConnectorApprovalPolicyandConnectorPersonServerModeenums are removed as well. The control plane no longer accepts or returns these fields; Cedar entities and member attributes replace them. No backwards-compatibility shim is kept.members.create()andAsyncMembers.create()no longer take keyword arguments. Pass aBusinessMemberCreate, aCustomerMemberCreateor a dict.MemberCreateRequestis replaced byBusinessMemberCreate,CustomerMemberCreateand theMemberCreateunion.Tests
New
responses-style contract tests intests/rest/test_connectors.pyandtests/rest/test_members.py:policy_entitiesexactly, and dict input gets the defaults filled inValidationErrorpolicy_entities, and a connector without them reads asNonepolicy_entities, sync and asyncpolicy_attributes, sync and async, and a 403 is surfacedmember_type: "business"; the customer body is serialized exactly; a dict withoutmember_typeis sent as business; a dict withmember_type: "customer"works tooexternal_user_id, a business member withoutemail, a customer withrole, and an unknownmember_typeResults:
uv run pytest tests/ --cov=introspection_sdk: 761 passed, 93.38% coverage (floor 80%)ruff format,ruff checkandty checkpassty. That hook reports the same 36 diagnostics on untouchedmainfiles (otel, events, run-stream tests), none of them in files this PR changes.🤖 Generated with Claude Code