After merging #12596, we now have duplicated scope error handling logic in two places:
api/client.go — GenerateScopeErrorForGQL + requiredScopesFromServerMessage (handles all GraphQL calls globally)
pkg/cmd/project/shared/queries/queries.go — handleError + requiredScopesFromServerMessage (handles project queries specifically)
Both parse the same INSUFFICIENT_SCOPES error messages and generate the same gh auth refresh -s suggestion. The existing code already has a TODO noting this: // TODO: this duplicates parts of generateScopesSuggestion.
We should consolidate this into a single implementation in api/client.go and have queries.go call it.
After merging #12596, we now have duplicated scope error handling logic in two places:
api/client.go—GenerateScopeErrorForGQL+requiredScopesFromServerMessage(handles all GraphQL calls globally)pkg/cmd/project/shared/queries/queries.go—handleError+requiredScopesFromServerMessage(handles project queries specifically)Both parse the same
INSUFFICIENT_SCOPESerror messages and generate the samegh auth refresh -ssuggestion. The existing code already has a TODO noting this:// TODO: this duplicates parts of generateScopesSuggestion.We should consolidate this into a single implementation in
api/client.goand havequeries.gocall it.