Skip to content

fix: Automatically set authentication type to SERVICE_ACCOUNT when a service account is provided - #139

Merged
medb merged 9 commits into
mainfrom
sa
Sep 19, 2025
Merged

medb merged 9 commits into
mainfrom
sa

Conversation

@fangyh20

Copy link
Copy Markdown
Member
image

@fangyh20
fangyh20 requested a review from medb September 19, 2025 01:54
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @fangyh20, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the authentication configuration for Dataproc Spark Connect sessions by introducing a more intuitive and robust mechanism. It ensures that when a service account is specified, the system intelligently defaults to SERVICE_ACCOUNT authentication, thereby simplifying setup and preventing potential misconfigurations related to authentication types.

Highlights

  • Authentication Type Precedence: The system now automatically sets the authentication type to SERVICE_ACCOUNT if a service account is explicitly provided, overriding any DATAPROC_SPARK_CONNECT_AUTH_TYPE environment variable setting.
  • Service Account Configuration: The logic for configuring the service account from the DATAPROC_SPARK_CONNECT_SERVICE_ACCOUNT environment variable has been reordered to ensure it's processed before determining the authentication type.
  • New Unit Test: A new unit test, test_service_account_sets_auth_type_automatically, has been added to verify that providing a service account correctly triggers the automatic SERVICE_ACCOUNT authentication type.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly implements logic to automatically set the authentication type to SERVICE_ACCOUNT when a service account is provided. This is a good enhancement that simplifies configuration for users and prevents potential misconfigurations. The new unit test effectively validates this new behavior. I've included a couple of minor suggestions to improve code readability by factoring out long, repeated attribute access chains into local variables.

Comment thread google/cloud/dataproc_spark_connect/session.py
Comment thread tests/unit/test_session.py
@medb
medb merged commit ee1d237 into main Sep 19, 2025
4 checks passed
@medb
medb deleted the sa branch September 19, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants