Add Gemini authentication-mode test entrypoint and README docs by Benjamin-Sayaque · Pull Request #83 · scriptit-fr/GenAIApp · GitHub
Skip to content

Add Gemini authentication-mode test entrypoint and README docs#83

Merged
aubrypaul merged 2 commits into
codex/modify-genaiapp-to-use-vertex-ai-advanced-servicefrom
codex/update-test-pipeline-for-authentication-modes
Jun 8, 2026
Merged

Add Gemini authentication-mode test entrypoint and README docs#83
aubrypaul merged 2 commits into
codex/modify-genaiapp-to-use-vertex-ai-advanced-servicefrom
codex/update-test-pipeline-for-authentication-modes

Conversation

@Benjamin-Sayaque

Copy link
Copy Markdown
Contributor

Motivation

  • Provide reproducible smoke tests to validate both Gemini authentication paths (API key and Vertex AI) and document how to run them.

Description

  • Add testConfiguredAuthenticationModes() and helper functions (getAuthTestConfigValue, getAuthTestBoolean, requireAuthTestCredential, skipAuthTest, configureAuthTestSwitches, testApiKeyAuthentication, and testVertexAiAuthentication) to src/testFunctions.gs for configurable authentication-mode testing.
  • Introduce AUTH_TEST_CONFIG_KEYS constants and wire testConfiguredAuthenticationModes() into testAll() so auth-mode checks run with the existing test harness.
  • Update README.md to include a "Testing authentication modes" section describing the entrypoint, boolean switches, required Apps Script Script Properties, and how to run the test entrypoint from the Apps Script editor.
  • Tests are designed to avoid leaking secrets and explicitly clear the opposite auth configuration before each smoke test so each path is exercised independently.

Testing

  • No automated CI tests were executed as part of this PR.

Codex Task

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/testFunctions.gs`:
- Around line 145-146: testConfiguredAuthenticationModes() mutates global Gemini
auth state causing subsequent tests like testSimpleChatInstance() (and
testAll()) to inherit Vertex configuration; add a reset between them: after
testConfiguredAuthenticationModes() invoke a new or existing function
resetGeminiAuthState() (or implement it if absent) that clears any global Gemini
auth flags/variables (e.g., unset auth mode, API key overrides, and any
useVertex boolean) so later tests run with a clean auth state before calling
testSimpleChatInstance().
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 550a9b3c-f84d-4a56-a3d9-e10ab3700310

📥 Commits

Reviewing files that changed from the base of the PR and between 06e64da and 58ea6e3.

📒 Files selected for processing (2)
  • README.md
  • src/testFunctions.gs
📜 Review details
🔇 Additional comments (1)
README.md (1)

36-36: LGTM!

Also applies to: 465-490

Comment thread src/testFunctions.gs
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Fixed 2 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/testFunctions.gs (3)

119-119: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Use empty strings for consistency with resetGeminiAuthState().

Line 119 passes null to setGeminiAuth(), but the JSDoc at src/code.gs:2648 types the parameters as string, and resetGeminiAuthState() resets them to "". While functionally equivalent (both falsy), using "" maintains type consistency.

♻️ Proposed fix
-  GenAIApp.setGeminiAuth(null, null);
+  GenAIApp.setGeminiAuth("", "");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/testFunctions.gs` at line 119, Call GenAIApp.setGeminiAuth with empty
strings instead of null to match the JSDoc string types and the behavior of
resetGeminiAuthState(); replace the current GenAIApp.setGeminiAuth(null, null)
invocation with GenAIApp.setGeminiAuth("", "") so the parameters' types and
reset semantics (as defined in resetGeminiAuthState and the JSDoc at the
setGeminiAuth declaration) remain consistent.

134-134: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Use empty string for consistency with resetGeminiAuthState().

Line 134 passes null to setGeminiAPIKey(), but the JSDoc at src/code.gs:2640 types the parameter as string, and resetGeminiAuthState() resets it to "". Use "" for type consistency.

♻️ Proposed fix
-  GenAIApp.setGeminiAPIKey(null);
+  GenAIApp.setGeminiAPIKey("");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/testFunctions.gs` at line 134, Replace the null literal passed to
GenAIApp.setGeminiAPIKey in the test at line showing
GenAIApp.setGeminiAPIKey(null) with an empty string "" to match the typed
parameter (string) and the behavior of resetGeminiAuthState(); update the call
so it reads GenAIApp.setGeminiAPIKey("").

18-18: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix ReferenceError when process is undefined.

Line 18 checks process !== "undefined" without typeof, which throws a ReferenceError in Apps Script where process is not defined.

🐛 Proposed fix
-  if (typeof process !== "undefined" && process.env && process.env[name] !== undefined) {
+  if (typeof process !== "undefined" && process.env && process.env[name] !== undefined) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/testFunctions.gs` at line 18, Change the faulty runtime check that
references process directly to use typeof before accessing it: replace the
current condition with a guard like if (typeof process !== "undefined" &&
process.env && process.env[name] !== undefined) so you never dereference process
in environments (like Apps Script) where it is not defined; update the
conditional in src/testFunctions.gs around the check that uses process and name
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/testFunctions.gs`:
- Line 119: Call GenAIApp.setGeminiAuth with empty strings instead of null to
match the JSDoc string types and the behavior of resetGeminiAuthState(); replace
the current GenAIApp.setGeminiAuth(null, null) invocation with
GenAIApp.setGeminiAuth("", "") so the parameters' types and reset semantics (as
defined in resetGeminiAuthState and the JSDoc at the setGeminiAuth declaration)
remain consistent.
- Line 134: Replace the null literal passed to GenAIApp.setGeminiAPIKey in the
test at line showing GenAIApp.setGeminiAPIKey(null) with an empty string "" to
match the typed parameter (string) and the behavior of resetGeminiAuthState();
update the call so it reads GenAIApp.setGeminiAPIKey("").
- Line 18: Change the faulty runtime check that references process directly to
use typeof before accessing it: replace the current condition with a guard like
if (typeof process !== "undefined" && process.env && process.env[name] !==
undefined) so you never dereference process in environments (like Apps Script)
where it is not defined; update the conditional in src/testFunctions.gs around
the check that uses process and name accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ac8b8f76-c9a5-4d5c-8510-0ad1fdb38724

📥 Commits

Reviewing files that changed from the base of the PR and between 58ea6e3 and 90e84ed.

📒 Files selected for processing (2)
  • src/code.gs
  • src/testFunctions.gs
📜 Review details
🔇 Additional comments (7)
src/code.gs (1)

2672-2683: LGTM!

src/testFunctions.gs (6)

5-11: LGTM!


53-59: LGTM!


61-67: LGTM!


69-71: LGTM!

Also applies to: 77-82


90-112: LGTM!


144-146: LGTM!

@aubrypaul aubrypaul merged commit bd70807 into codex/modify-genaiapp-to-use-vertex-ai-advanced-service Jun 8, 2026
1 check passed
@aubrypaul aubrypaul deleted the codex/update-test-pipeline-for-authentication-modes branch June 8, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants