Skip to content

feat(user-management): add directoryManaged to OrganizationMembership#1512

Merged
wzahedi merged 4 commits intomainfrom
wzahedi/add-directory-managed-to-org-membership
Mar 5, 2026
Merged

feat(user-management): add directoryManaged to OrganizationMembership#1512
wzahedi merged 4 commits intomainfrom
wzahedi/add-directory-managed-to-org-membership

Conversation

@wzahedi
Copy link
Contributor

@wzahedi wzahedi commented Mar 5, 2026

Summary

  • Add directoryManaged boolean field to BaseOrganizationMembership interface
  • Add directory_managed to the BaseOrganizationMembershipResponse interface
  • Update both deserializer functions to map the new field
  • Update all test fixtures with directory_managed: false

This field indicates whether an organization membership is managed by a directory sync connection.

Test plan

  • Existing tests pass (31/31 suites, 594 tests)
  • New field is properly deserialized from API responses
  • Actions test updated with new field expectation
    🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wzahedi wzahedi requested a review from a team as a code owner March 5, 2026 16:13
@wzahedi wzahedi requested a review from mattgd March 5, 2026 16:13
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 5, 2026

Greptile Summary

This PR adds a directoryManaged boolean field to BaseOrganizationMembership (and the corresponding directory_managed to BaseOrganizationMembershipResponse) to indicate whether an organization membership is managed by a directory sync connection. The change is straightforward and well-executed, touching the interface, both deserializer functions, all relevant test fixtures, and the actions spec.

Key changes:

  • directoryManaged: boolean added to BaseOrganizationMembership interface and directory_managed: boolean to BaseOrganizationMembershipResponse
  • Both deserializeOrganizationMembership and deserializeAuthorizationOrganizationMembership updated to map the new field
  • All 5 test fixtures updated with "directory_managed": false
  • Actions spec expectation updated to include directoryManaged: false
  • package-lock.json has incidental removal of "peer": true from several lockfile entries (likely a lockfile regeneration artifact)

One consideration: directory_managed is typed as a required boolean in the response interface (not optional), and no ?? false fallback is applied in the serializers. This differs from the treatment of custom_attributes, which is optional in the interface (custom_attributes?: ...) and uses a ?? {} fallback. If older API responses omit this field, directoryManaged will silently be undefined at runtime despite the boolean type annotation.

Confidence Score: 4/5

  • This PR is safe to merge; the change is a clean, additive field addition with full fixture and test coverage.
  • The implementation is consistent, well-tested, and follows existing patterns in the codebase. The only minor concern is that directory_managed is required (non-optional) in the response interface without a nullish-coalescing fallback in the deserializer — unlike custom_attributes which guards against missing values. This could silently produce undefined for older API responses, but is unlikely to be an issue if the API always returns the field.
  • src/user-management/interfaces/organization-membership.interface.ts and src/user-management/serializers/organization-membership.serializer.ts — consider optionality and a ?? false fallback for the new field.

Important Files Changed

Filename Overview
src/user-management/interfaces/organization-membership.interface.ts Adds directoryManaged: boolean to BaseOrganizationMembership and directory_managed: boolean to BaseOrganizationMembershipResponse; field is required (non-optional), which could silently produce undefined at runtime for older API responses missing this field.
src/user-management/serializers/organization-membership.serializer.ts Both deserializer functions correctly map directory_managed to directoryManaged; no nullish-coalescing fallback is applied, unlike the custom_attributes field which uses ?? {}.
src/actions/actions.spec.ts Test expectation updated to include directoryManaged: false, consistent with the new field and fixture.
src/actions/fixtures/authentication-action-context.json Adds directory_managed: false to the organization membership fixture used by the actions test.
src/authorization/fixtures/list-organization-memberships-for-resource.json Adds directory_managed: false to the authorization list fixture; looks correct.
src/user-management/fixtures/deactivate-organization-membership.json Adds directory_managed: false to the deactivate membership fixture; looks correct.
src/user-management/fixtures/list-organization-memberships.json Adds directory_managed: false to the list memberships fixture; looks correct.
src/user-management/fixtures/organization-membership.json Adds directory_managed: false to the single membership fixture; looks correct.
package-lock.json Removes "peer": true metadata from several packages (e.g. jest, typescript, eslint-related); likely an incidental lockfile regeneration artifact with no functional impact.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[API Response\nBaseOrganizationMembershipResponse] -->|directory_managed: boolean| B{Deserializer}
    B -->|deserializeOrganizationMembership| C[OrganizationMembership\ndirectoryManaged: boolean]
    B -->|deserializeAuthorizationOrganizationMembership| D[AuthorizationOrganizationMembership\ndirectoryManaged: boolean]
    C --> E[OrganizationMembership extends BaseOrganizationMembership\n+ organizationName + role]
    D --> F[AuthorizationOrganizationMembership\n= BaseOrganizationMembership]
Loading

Last reviewed commit: 4b92c93

wzahedi and others added 2 commits March 5, 2026 14:49
- Make directory_managed optional in response interface for backward
  compatibility with older API responses
- Add ?? false fallback in both deserializers
- Revert unintentional package-lock.json changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wzahedi wzahedi requested a review from a team as a code owner March 5, 2026 20:54
@wzahedi wzahedi merged commit 4594f4e into main Mar 5, 2026
8 checks passed
@wzahedi wzahedi deleted the wzahedi/add-directory-managed-to-org-membership branch March 5, 2026 21:05
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