Skip to content

CXP-768 Gate account re-parenting on org/OU sync opt-in#139

Open
JavierCarnelli-ConductorOne wants to merge 1 commit into
mainfrom
fix/cxp-768
Open

CXP-768 Gate account re-parenting on org/OU sync opt-in#139
JavierCarnelli-ConductorOne wants to merge 1 commit into
mainfrom
fix/cxp-768

Conversation

@JavierCarnelli-ConductorOne

Copy link
Copy Markdown
Contributor

accountResourceType.List() re-parented every account onto its Organizations Root/OU whenever organizations:ListParents succeeded, regardless of whether the organization/organizational_unit resource types (OptInRequired, off by default) were actually being synced. In the default orgs+sso configuration this left every account with a parent pointing at a resource that was never synced, and c1 silently drops the reference as a dangling MISSING RESOURCE.

Thread cli.ConnectorOpts through New() (previously discarded) to learn whether this sync run will actually emit organization/ organizational_unit, and gate both the ListParents call and the resulting parent attachment on it -- including the resolved parent's specific type, so partial opt-in can't produce a dangling parent either.

accountResourceType.List() re-parented every account onto its
Organizations Root/OU whenever organizations:ListParents succeeded,
regardless of whether the organization/organizational_unit resource
types (OptInRequired, off by default) were actually being synced.
In the default orgs+sso configuration this left every account with a
parent pointing at a resource that was never synced, and c1 silently
drops the reference as a dangling MISSING RESOURCE.

Thread cli.ConnectorOpts through New() (previously discarded) to
learn whether this sync run will actually emit organization/
organizational_unit, and gate both the ListParents call and the
resulting parent attachment on it -- including the resolved parent's
specific type, so partial opt-in can't produce a dangling parent
either.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 23, 2026

Copy link
Copy Markdown

CXP-768

@github-actions

Copy link
Copy Markdown
Contributor

Connector PR Review: CXP-768 Gate account re-parenting on org/OU sync opt-in

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base e6437fc693fc.
Review mode: full
View review run

Review Summary

Scanned the full PR diff for security and correctness. This threads cli.ConnectorOpts through New() and gates account re-parenting in accountResourceType.List on whether the OptInRequired organization/organizational_unit types will actually be synced, avoiding dangling "MISSING RESOURCE" parents. The gate logic is correct and consistent with the SDK: ConnectorOpts.WillSyncResourceType mirrors the syncer's own filter (syncer.go — empty filter syncs all, non-empty syncs only listed), nil ConnectorOpts defaults to true/true matching the SDK default, the resolved parent type is re-checked before attachment (partial opt-in safe), and all five accountBuilder call sites are updated. New regression tests cover both the "neither synced → no ListParents call, stays flat" and "partial opt-in → resolved OU type not synced → stays flat" paths. No new issues found.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking issues found.

Comment thread pkg/connector/account.go
// actually sync the corresponding (OptInRequired) hierarchy resource type. Account
// re-parenting (see List) is gated on these so accounts never point at a Root/OU
// resource that this run never syncs, which would otherwise leave a dangling
// "MISSING RESOURCE" parent. See CXP-768.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

delete CXP-768, because it's public repo

@Bencheng21

Copy link
Copy Markdown

Adjacent edge not addressed: the OU→Root parent edge (organizationalUnitResource → WithParentResourceID) has the same dangling shape if organizational_unit is synced while organization (Root) isn't. In practice the OU crawl is seeded from the Root, so "OU without org" is likely unreachable — but if that invariant changes, the same MISSING RESOURCE could reappear one tier up. Note on the ticket.

Could you confirm with OU without org is unreachable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants