Skip to content

test: add missing Gemini API target test coverage to fix CI branch coverage regression#1662

Merged
lpcox merged 2 commits intofeat/gemini-api-proxy-supportfrom
copilot/fix-github-actions-workflow-a6630634-59cd-4e93-8792-c601f8fdcf45
Apr 4, 2026
Merged

test: add missing Gemini API target test coverage to fix CI branch coverage regression#1662
lpcox merged 2 commits intofeat/gemini-api-proxy-supportfrom
copilot/fix-github-actions-workflow-a6630634-59cd-4e93-8792-c601f8fdcf45

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

Summary

The Test Coverage Report CI workflow was failing because the Gemini API proxy feature (port 10003) added new branches in src/cli.ts that 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.ts introduced by the Gemini feature had zero test coverage:

  1. Line 391if (geminiTargetWarning) in emitApiProxyTargetWarnings: the truthy case (a warning is emitted when a custom Gemini target is not in the allowed domains list) was never exercised.
  2. Line 535if (options.geminiApiTarget) in resolveApiTargetsToAllowedDomains: the Gemini option flag branch was never tested.
  3. Line 537else if (env['GEMINI_API_TARGET']) in resolveApiTargetsToAllowedDomains: the Gemini env-var fallback branch was never tested.

Changes

Added tests to src/cli.test.ts:

  • Import DEFAULT_GEMINI_API_TARGET and add it to the constants assertion
  • emitApiProxyTargetWarnings:
    • Emits warning for custom Gemini target not in allowed domains
    • Emits no warning when custom Gemini target is in allowed domains
    • Uses default target (no warning) when geminiApiTarget is undefined
    • Emits warnings for all four custom targets (OpenAI, Anthropic, Copilot, Gemini)
  • resolveApiTargetsToAllowedDomains:
    • Adds geminiApiTarget option to allowed domains
    • Falls back to GEMINI_API_TARGET env var when option not set
    • Prefers option flag over env var

Results

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

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions bot mentioned this pull request Apr 4, 2026
@lpcox lpcox marked this pull request as ready for review April 4, 2026 15:17
@lpcox lpcox requested a review from Mossaka as a code owner April 4, 2026 15:17
Copilot AI review requested due to automatic review settings April 4, 2026 15:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 emitApiProxyTargetWarnings tests covering Gemini warning/no-warning/default behavior.
  • Adds resolveApiTargetsToAllowedDomains tests 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
Comment on lines 1783 to 1789
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');
});
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

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').

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Smoke test results (run 23981761197)

Test Result
GitHub MCP (last 2 merged PRs: #1641, #1654)
Playwright (github.com title contains "GitHub")
File write (smoke-test-claude-23981761197.txt)
Bash verify (file contents confirmed)

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1662

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🔬 Smoke Test Results

Test Status
GitHub MCP connectivity
GitHub.com HTTP connectivity ⚠️ pre-step data unavailable
File write/read ⚠️ pre-step data unavailable

PR: "test: add missing Gemini API target test coverage to fix CI branch coverage regression"
Author: @Copilot | Assignees: @lpcox, @Copilot

Overall: PARTIAL — MCP ✅, but smoke-data step outputs were unresolved template variables ($\{\{ steps.smoke-data.outputs.* }}); HTTP and file tests inconclusive.

📰 BREAKING: Report filed by Smoke Copilot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3 ❌ NO
Node.js v24.14.1 v20.20.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ❌ Not all runtimes match — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot for issue #1662

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #1662 ·

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Smoke test results:

  • [docs] docs: sync smoke-claude toolset and max-turns after token optimization
  • test: add tests for Gemini API proxy support to fix coverage regression
  • GitHub MCP Testing: ✅
  • Safe Inputs GH CLI Testing: ❌
  • Playwright Testing: ❌
  • Tavily Web Search Testing: ❌
  • File Writing + Bash cat: ✅
  • Discussion Interaction: ❌
  • Build AWF: ✅
    Overall status: FAIL

🔮 The oracle has spoken through Smoke Codex

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Smoke Test: GitHub Actions Services Connectivity ✅

All checks passed:

Check Result
Redis PING (host.docker.internal:6379) PONG
PostgreSQL pg_isready (host.docker.internal:5432) ✅ accepting connections
PostgreSQL SELECT 1 (db: smoketest, user: postgres) ✅ returned 1

🔌 Service connectivity validated by Smoke Services

@lpcox lpcox merged commit 17d9395 into feat/gemini-api-proxy-support Apr 4, 2026
36 of 37 checks passed
@lpcox lpcox deleted the copilot/fix-github-actions-workflow-a6630634-59cd-4e93-8792-c601f8fdcf45 branch April 4, 2026 15:30
lpcox added a commit that referenced this pull request Apr 4, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants