fix(gitlab): sync integration_type on OAuth reconnect and drop self_rotate scope#1168
Closed
fix(gitlab): sync integration_type on OAuth reconnect and drop self_rotate scope#1168
Conversation
…otate scope When a PAT integration was reconnected via OAuth, the callback update path set metadata.auth_type to 'oauth' but left the integration_type column as 'pat'. Also remove the self_rotate scope from project access tokens — rotation already uses the user's token, and the scope breaks on GitLab < 16.6.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by gpt-5.4-20260305 · 778,118 tokens |
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.
Summary
metadata.auth_typeto"oauth"but left theintegration_typecolumn as"pat", causing a data inconsistency. Now the OAuth callback also setsintegration_type: 'oauth'on update.self_rotatescope from project access token creation. Token rotation already uses the user's OAuth/PAT token (not the project token itself), soself_rotateis unnecessary. It also causes"scopes does not have a valid value"errors on self-hosted GitLab instances running versions older than 16.6 (when that scope was introduced).Verification
pnpm typecheck— all packages passprettier --check— all files passeslint— all packages passVisual Changes
N/A
Reviewer Notes
integration_typecolumn is not currently read for GitLab runtime logic (all code readsmetadata.auth_type), so the mismatch didn't cause functional breakage — but it's semantically wrong and could confuse DB queries or admin tools.self_rotatescope removal is safe becauserotateProjectAccessToken()inadapter.tsauthenticates with the user's token (Authorization: Bearer ${accessToken}), not the project access token. The scope was only needed if the project token were rotating itself.