Repository navigation
Conversation
Prevent a single invalid registrar contact email from wedging Google Groups contact syncing for that registrar and triggering endless scheduled-task HTTP 500 retries and duplicate SEVERE error logs, while rejecting contact emails with invalid or misspelled TLDs up front in Registrar Console. Previously, SyncGroupMembersAction (0ef0c93, 2620097) retried all RuntimeExceptions, aborted a registrar's RegistrarPoc.Type loop on the first failed email, and logged each failure twice at SEVERE, while ContactAction (db1b926) accepted any syntactically valid RFC 5322 email regardless of public suffix. - Add DirectoryGroupsConnection.isRetryableException() and isInvalidMemberException(), plus Retrier.callWithRetry(VoidCallable, Predicate), so deterministic HTTP 4xx errors are never retried while HTTP 5xx, 429, 403 rate-limit overages (rateLimitExceeded, userRateLimitExceeded, quotaExceeded), and network IOExceptions remain retryable. Preserve throwing on 400 in DirectoryGroupsConnection so admin callers (CreateGroupsAction, UpdateUserGroupAction) still fail fast. - Isolate per-group and per-member operations in SyncGroupMembersAction so one failing email or group never blocks remaining contacts or groups. Skip deterministic invalid/missing memberKey errors (400/404) with a single WARNING naming the email, registrarId, and groupKey so valid contacts sync and contactsRequireSyncing clears instead of failing the task with HTTP 500. - Remove duplicate logger.atSevere() in SyncGroupMembersAction.run() since Result.FAILED already logs every error cause once at SEVERE. - Validate public suffixes in ContactAction (and checkContactRequirements) via Guava InternetDomainName and UTS46 IDN canonicalization while guarding empty payloads and null/malformed emails to return HTTP 400 instead of 500, leaving Registrar.checkValidEmail() untouched for synthetic test domains and allowing existing legacy invalid POCs to be deleted or corrected via Console. BUG=http://b/590541612
CydeWeys
force-pushed
the
fix-sync-group-members-4xx
branch
from
November 26, 2026 00:14
8562f7d to
805fb75
Compare
This branch has not been 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.
Prevent a single invalid registrar contact email from wedging Google Groups
contact syncing for that registrar and triggering endless scheduled-task HTTP
500retries and duplicateSEVEREerror logs, while rejecting contact emailswith invalid or misspelled TLDs up front in Registrar Console.
Previously,
SyncGroupMembersAction(0ef0c933d,262009759) wrapped eachregistrar's entire sync in
retrier.callWithRetry(..., RuntimeException.class),aborted the
RegistrarPoc.Typeloop on the first failed email, and logged everyfailure twice at
SEVERE. Combined withContactAction(db1b92638) relyingsolely on
Registrar.checkValidEmail()(RFC 5322 syntax without a public-suffixcheck), a single contact email with a non-public-suffix TLD caused deterministic
Google Workspace Directory API HTTP
400 Invalid Input: memberKeyerrors thatblocked all subsequent contact groups for that registrar and repeatedly failed
with HTTP
500across scheduled sync runs and Cloud Tasks retries.Changes
DirectoryGroupsConnection&Retrier:DirectoryGroupsConnection.isRetryableException(Throwable)(inspecting the full causal chain via
Throwables.getCausalChain) andRetrier.callWithRetry(VoidCallable, Predicate<Throwable>)sodeterministic HTTP
4xxerrors (400,401, non-rate-limit403,wrapped
404 Resource Not Found: memberKey,409) are never retried,while transient HTTP
5xx,429,403rate-limit overages(
rateLimitExceeded,userRateLimitExceeded,quotaExceeded), andnon-HTTP
IOExceptions remain retryable.DirectoryGroupsConnection.isInvalidMemberException(Throwable)toidentify deterministic member-key rejections (
400 Invalid Input: memberKey/Missing required field: memberKeyand404 Resource Not Found: memberKey).SyncGroupMembersAction:getMembersOfGroup,addMemberToGroup, andremoveMemberFromGroupat the per-group and per-member level so onefailing email or group never blocks remaining contacts or groups.
memberKeyerrors (400/404) witha single actionable
WARNINGnaming(email, registrarId, groupKey)sovalid contacts sync and
contactsRequireSyncingclears when no othererrors occur, stopping deterministic member-key errors from repeatedly
failing the task with HTTP
500while keeping non-member/transientfailures returning
500withcontactsRequireSyncing = true.logger.atSevere()inrun()sinceResult.FAILEDalready logs every failure cause once atSEVERE.ContactAction:null/malformed emails beforeRegistrarPoc.Builder.build()so invalid requests return HTTP400instead of
500.updateContactsandcheckContactRequirementsvia UTS46 IDN canonicalization and GuavaInternetDomainName(hasPublicSuffix() && !isPublicSuffix()),rejecting non-public-suffix domains (e.g.
user@example.invalidtld),bare public suffixes (e.g.
user@com,user@co.uk),leading/trailing/consecutive dots, underscores, multiple
@, displaynames, and malformed punycode while accepting uppercase and valid
IDN/punycode domains.
Blast Radius & Compatibility
CreateGroupsAction&UpdateUserGroupAction:DirectoryGroupsConnection.addMemberToGroup()continues to throwGoogleJsonResponseExceptionon HTTP400so admin endpoints fail fast oninvalid operator inputs, while preserving all existing
404/409idempotency behavior.
scoped to
ContactActionrather thanRegistrar.checkValidEmail()sosynthetic
.example/.test/.tldunit test fixtures across unrelatedsuites remain unaffected, and existing legacy invalid contacts remain
deletable and editable (
DELETE/PUT) in Console without lockingregistrars out of unrelated contact updates.
Verification
SyncGroupMembersActionTest(log-count assertions,400/404memberKeyisolation,
403non-retry,429/403rate-limit retries),DirectoryGroupsConnectionTest(isRetryableExceptionandisInvalidMemberExceptionclassification),ContactActionTest(wiredthrough real
ServletInputStream+RequestModule+ConsoleModule.provideContacts), andRetrierTest../gradlew spotlessCheck javaIncrementalFormatCheck runPresubmits :util:check :core:test(0failures) andpr-polisher(0errors,0warnings).
BUG=http://b/590541612
This change is