Fix DRY_RUN aborting on users that do not exist yet - #350
Open
tdewitt wants to merge 1 commit into
Open
Conversation
dryClient.CreateUser returns the user unchanged, so a user only pretended into existence still has an empty ID. SyncGroups passed that ID straight to IsMemberInGroups, which rejects it: ValidationException: Value '' at 'memberId.userId' failed to satisfy constraint: Member must have length greater than or equal to 1 The sync then died on the first group containing such a user, before evaluating a single membership change. That makes DRY_RUN unusable whenever the Google directory holds anyone Identity Center does not -- the normal state before an initial sync, and precisely when a dry run is worth doing. A user that does not exist cannot be a member of anything, so answer locally instead of calling the API. Additions are still reported, so the dry-run output stays complete.
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.
dryClient.CreateUser returns the user unchanged, so a user only pretended into
existence still has an empty ID. SyncGroups passed that ID straight to
IsMemberInGroups, which rejects it:
The sync then died on the first group containing such a user, before evaluating
a single membership change. That makes DRY_RUN unusable whenever the Google
directory holds anyone Identity Center does not -- the normal state before an
initial sync, and precisely when a dry run is worth doing.
A user that does not exist cannot be a member of anything, so answer locally
instead of calling the API. Additions are still reported, so the dry-run output
stays complete.
Fixes #281.
#313 fixes the same failure more broadly: virtual IDs minted in the dry-run
shims, covering UpdateUser and ListGroupMemberships too, without touching shared
code. This change is deliberately minimal instead: one guard at the call site
that fails. The tradeoff is that it sits in SyncGroups rather than in the
dry-run shims, so it is on the path both sync methods run. Maintainers may
prefer #313's approach; happy to close this in its favour.