test: add missing Gemini API target test coverage to fix CI branch coverage regression#1662
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Adds missing test coverage for the Gemini API target support in the CLI to prevent CI branch coverage regressions and ensure Gemini-specific branches are exercised.
Changes:
- Extends CLI constant assertions to include
DEFAULT_GEMINI_API_TARGET. - Adds
emitApiProxyTargetWarningstests covering Gemini warning/no-warning/default behavior. - Adds
resolveApiTargetsToAllowedDomainstests covering Gemini flag and env-var fallback behavior.
Show a summary per file
| File | Description |
|---|---|
src/cli.test.ts |
Adds Gemini-specific unit tests to cover previously untested branches in emitApiProxyTargetWarnings and resolveApiTargetsToAllowedDomains. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
src/cli.test.ts
Outdated
| expect(DEFAULT_ANTHROPIC_API_TARGET).toBe('api.anthropic.com'); | ||
| expect(DEFAULT_COPILOT_API_TARGET).toBe('api.githubcopilot.com'); | ||
| expect(DEFAULT_GEMINI_API_TARGET).toBe('generativelanguage.googleapis.com'); | ||
| }); |
There was a problem hiding this comment.
The describe block name is now misleading: it mentions only OpenAI/Anthropic, but the assertions also cover Copilot and Gemini defaults. Consider renaming the describe title to reflect all constants being validated (or a more generic 'DEFAULT_*_API_TARGET').
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Smoke test results (run 23981761197)
Overall: PASS
|
🔬 Smoke Test Results
PR: "test: add missing Gemini API target test coverage to fix CI branch coverage regression" Overall: PARTIAL — MCP ✅, but
|
Chroot Version Comparison Results
Result: ❌ Not all runtimes match — Python and Node.js versions differ between host and chroot environments.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
Smoke test results:
|
Smoke Test: GitHub Actions Services Connectivity ✅All checks passed:
|
* feat: add Google Gemini API proxy support (port 10003) Add full Gemini API proxy support to the AWF api-proxy sidecar, matching the pattern of existing OpenAI, Anthropic, and Copilot providers. This enables Gemini CLI to work inside the AWF sandbox without requiring workarounds in gh-aw. Changes: - Add GEMINI port 10003 to API_PROXY_PORTS - Add geminiApiKey, geminiApiTarget, geminiApiBasePath to WrapperConfig - Add --gemini-api-target and --gemini-api-base-path CLI flags - Add GEMINI_API_KEY to excluded env vars when api-proxy is enabled - Set placeholder GEMINI_API_KEY in agent container (Gemini CLI v0.65.0+ exits 41 without auth when GEMINI_API_BASE_URL is set) - Set GEMINI_API_BASE_URL pointing to sidecar in agent env - Add .gemini to whitelisted home subdirectories (bind mount + chroot) - Add Gemini proxy server in server.js using x-goog-api-key header - Expose port 10003 in Dockerfile Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: add tests for Gemini API proxy support in docker-manager (#1654) Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/03ba1344-8f2e-4d67-890f-46e665522db4 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> * test: add missing Gemini API target test coverage to fix CI branch coverage regression (#1662) * test: add missing Gemini API target test coverage in cli.test.ts Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/0ed05562-3ddb-490f-9b6a-dd5cfa3bb0fc * fix: rename describe block to reflect all API target constants Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Landon Cox <landon.cox@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Summary
The Test Coverage Report CI workflow was failing because the Gemini API proxy feature (port 10003) added new branches in
src/cli.tsthat were not covered by tests, causing branch coverage to drop by -0.04% (from 78.50% to 78.46%), triggering the regression check.Root Cause
Three branches in
src/cli.tsintroduced by the Gemini feature had zero test coverage:if (geminiTargetWarning)inemitApiProxyTargetWarnings: the truthy case (a warning is emitted when a custom Gemini target is not in the allowed domains list) was never exercised.if (options.geminiApiTarget)inresolveApiTargetsToAllowedDomains: the Gemini option flag branch was never tested.else if (env['GEMINI_API_TARGET'])inresolveApiTargetsToAllowedDomains: the Gemini env-var fallback branch was never tested.Changes
Added tests to
src/cli.test.ts:DEFAULT_GEMINI_API_TARGETand add it to the constants assertionemitApiProxyTargetWarnings:geminiApiTargetisundefinedresolveApiTargetsToAllowedDomains:geminiApiTargetoption to allowed domainsGEMINI_API_TARGETenv var when option not setResults
All 1305 tests pass. Branch coverage improved from 78.45% → 78.56%, exceeding the base branch coverage of 78.50%.
Coverage comparison generated by
scripts/ci/compare-coverage.ts