Skip to content

fix: add missing formatItem and program imports in cli.test.ts#1266

Closed
Copilot wants to merge 9 commits intomainfrom
copilot/fix-github-actions-workflow-one-more-time
Closed

fix: add missing formatItem and program imports in cli.test.ts#1266
Copilot wants to merge 9 commits intomainfrom
copilot/fix-github-actions-workflow-one-more-time

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

src/cli.test.ts failed to compile because tests for formatItem and program (added in a recent commit) referenced those names without importing them — both are exported from src/cli.ts but were omitted from the import statement.

Change

Added formatItem and program to the existing import from ./cli:

- import { ..., emitApiProxyTargetWarnings } from './cli';
+ import { ..., emitApiProxyTargetWarnings, formatItem, program } from './cli';

This restores cli.test.ts from a compile-time suite failure (0 tests run) to fully passing (219 tests).

Original prompt

Fix the failing GitHub Actions workflow Test Coverage Report
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 66859678198
Job URL: https://github.com/github/gh-aw-firewall/actions/runs/23021761315/job/66859678198


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Claude AI and others added 8 commits March 12, 2026 18:48
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] [66859678198] Fix the failing GitHub Actions workflow for test coverage fix: add missing formatItem and program imports in cli.test.ts Mar 12, 2026
Copilot AI requested a review from lpcox March 12, 2026 20:23
Base automatically changed from claude/add-copilot-api-target-flag to main March 12, 2026 22:46
@Mossaka Mossaka requested a review from Copilot March 13, 2026 00:18
Copy link
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 GitHub Copilot enterprise (GHEC/GHES) routing support to the api-proxy sidecar, expands CLI warnings around Copilot API targets, and documents enterprise setup.

Changes:

  • Auto-derive Copilot upstream target in api-proxy from GITHUB_SERVER_URL (with explicit override via COPILOT_API_TARGET).
  • Extend CLI API-target allowlist warnings to include Copilot and add corresponding unit tests.
  • Add enterprise configuration documentation and link it from the README.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/docker-manager.test.ts Adds coverage for passing COPILOT_API_TARGET into the api-proxy compose env.
src/cli.ts Introduces DEFAULT_COPILOT_API_TARGET and includes Copilot in API-target allowlist warnings.
src/cli.test.ts Tests default Copilot target constant + new warning behaviors.
README.md Links to the new enterprise configuration guide.
docs/enterprise-configuration.md New guide for GHEC/GHES configuration, allowlists, and troubleshooting.
containers/api-proxy/server.test.js Unit tests for Copilot target derivation behavior.
containers/api-proxy/server.js Implements GHEC/GHES Copilot target derivation and exports it for tests.
containers/api-proxy/logging.js Clarifies logging sanitization behavior in comments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +369 to +374
const copilotTargetWarning = validateApiTargetInAllowedDomains(
config.copilotApiTarget ?? DEFAULT_COPILOT_API_TARGET,
DEFAULT_COPILOT_API_TARGET,
'--copilot-api-target',
allowedDomains
);
Comment on lines +64 to +70
sudo -E awf \
--allow-domains ${{ github.server_url_hostname }},api.${{ github.server_url_hostname }},raw.githubusercontent.com \
--enable-api-proxy \
-- npx @github/copilot@latest --prompt "generate tests"
```

**Note:** Use `${{ github.server_url_hostname }}` to dynamically get your GHEC hostname (e.g., `acme.ghe.com`).
Comment on lines +220 to +227
# View the derived endpoint in startup logs
docker logs awf-api-proxy | grep "Copilot proxy"

# Expected for GHEC:
# Copilot proxy listening on port 10002 (target: api.acme.ghe.com)

# Expected for GHES:
# Copilot proxy listening on port 10002 (target: api.enterprise.githubcopilot.com)
Comment on lines +68 to +71
// Check if this is a GHEC tenant (*.ghe.com)
if (hostname.endsWith('.ghe.com')) {
// Extract subdomain: mycompany.ghe.com → mycompany
const subdomain = hostname.slice(0, -8); // Remove '.ghe.com'
@github-actions
Copy link
Contributor

🏗️ 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 N/A ❌ FAIL
Java caffeine N/A ❌ FAIL
Node.js clsx All passed ✅ PASS
Node.js execa All passed ✅ PASS
Node.js p-limit All passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 7/8 ecosystems passed — ❌ FAIL


❌ Failure Details

Java (gson, caffeine) — Both projects failed at mvn compile due to network unreachability. Maven cannot download dependencies from Maven Central:

[ERROR] Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:3.3.1
        from/to central (https://repo.maven.apache.org/maven2): Network is unreachable

The ~/.m2 directory was owned by root (no write permission for the runner), preventing creation of the local repository. After redirecting the local repo to a writable path (-Dmaven.repo.local), Maven still could not reach Maven Central — the network is unreachable in this environment.

Generated by Build Test Suite for issue #1266 ·

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.

4 participants