Add Gemini authentication-mode test entrypoint and README docs#83
Conversation
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
README.mdsrc/testFunctions.gs
📜 Review details
🔇 Additional comments (1)
README.md (1)
36-36: LGTM!Also applies to: 465-490
Fixed 2 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
There was a problem hiding this comment.
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 valueUse empty strings for consistency with
resetGeminiAuthState().Line 119 passes
nulltosetGeminiAuth(), but the JSDoc at src/code.gs:2648 types the parameters asstring, andresetGeminiAuthState()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 valueUse empty string for consistency with
resetGeminiAuthState().Line 134 passes
nulltosetGeminiAPIKey(), but the JSDoc at src/code.gs:2640 types the parameter asstring, andresetGeminiAuthState()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 winFix ReferenceError when
processis undefined.Line 18 checks
process !== "undefined"withouttypeof, which throws a ReferenceError in Apps Script whereprocessis 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
📒 Files selected for processing (2)
src/code.gssrc/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!
bd70807
into
codex/modify-genaiapp-to-use-vertex-ai-advanced-service

Motivation
Description
testConfiguredAuthenticationModes()and helper functions (getAuthTestConfigValue,getAuthTestBoolean,requireAuthTestCredential,skipAuthTest,configureAuthTestSwitches,testApiKeyAuthentication, andtestVertexAiAuthentication) tosrc/testFunctions.gsfor configurable authentication-mode testing.AUTH_TEST_CONFIG_KEYSconstants and wiretestConfiguredAuthenticationModes()intotestAll()so auth-mode checks run with the existing test harness.README.mdto 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.Testing
Codex Task