Reset access source name sync on connection change
Once the source-name worker sets name_synced_at, nothing cleared it, so a source that hit a terminal failure (Brex 403, wrong Sentry org slug) kept its generic name forever — even after the user reconnected with the right scope or picked the correct org, contradicting the Brex guidance to reconnect. Clear name_synced_at whenever the connection changes: on UpdateSource when a connector is (re)set, inside ConfigureAccessReviewSource when the org is (re)selected, and on the OAuth reconnect path via the new ResetSourceNameSyncForConnector service method. The worker then re-claims the row and re-resolves the display name. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -155,6 +155,7 @@ func NewMux(
|
||||
logger,
|
||||
baseURL,
|
||||
proboSvc,
|
||||
accessReviewSvc,
|
||||
connectorRegistry,
|
||||
safeRedirect,
|
||||
),
|
||||
@@ -174,6 +175,7 @@ func handleConnectorComplete(
|
||||
logger *log.Logger,
|
||||
baseURL *baseurl.BaseURL,
|
||||
proboSvc *probo.Service,
|
||||
accessReviewSvc *accessreview.Service,
|
||||
connectorRegistry *connector.ConnectorRegistry,
|
||||
safeRedirect *saferedirect.SafeRedirect,
|
||||
) http.HandlerFunc {
|
||||
@@ -309,6 +311,14 @@ func handleConnectorComplete(
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// The reconnect may carry a different scope/org, changing the
|
||||
// resolvable instance name. Clear the synced-name flag so the
|
||||
// source-name worker re-resolves it. Best-effort: a failure here
|
||||
// must not fail the OAuth callback redirect.
|
||||
if err := accessReviewSvc.ResetSourceNameSyncForConnector(r.Context(), scope, cnnctr.ID); err != nil {
|
||||
logger.WarnCtx(r.Context(), "cannot reset access source name sync after reconnect", log.Error(err))
|
||||
}
|
||||
} else {
|
||||
createReq := probo.CreateConnectorRequest{
|
||||
OrganizationID: organizationID,
|
||||
|
||||
Reference in New Issue
Block a user