[Test Coverage] Branch coverage for container-stop, config-file, and main-action#5902
Conversation
Cover the following uncovered branches identified in the coverage report: container-stop.ts: - fixSquidLogPermissionsBeforeShutdown: log message when exit code is non-zero with non-empty stderr - fixSquidLogPermissionsBeforeShutdown: '(no stderr)' fallback in the debug message when stderr is empty but exit code is non-zero config-file.ts: - loadAwfFileConfig parse-error catch block: String(error) fallback used when the thrown value is not an Error instance commands/main-action.ts: - redactConfigForLogging: additionalEnv object path (keys replaced with [REDACTED]) - redactConfigForLogging: additionalEnv null/falsy short-circuit branch - redactConfigForLogging: additionalEnv non-object value pass-through - createMainAction: skip probeSplitFilesystem when dockerHostPathPrefix is already configured - createMainAction: auto-apply detected DinD path prefix and log info - createMainAction: log warning when split filesystem detected but no prefix resolved - createMainAction: dnsServers undefined nullish-coalescing fallback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds targeted Jest unit tests to increase branch coverage for key runtime paths in AWF’s container shutdown, config parsing, and main CLI action logic—without changing production behavior.
Changes:
- Added coverage tests for
fixSquidLogPermissionsBeforeShutdownnon-zero exit-code logging branches. - Added a config parsing test covering the
String(error)fallback when non-Errorvalues are thrown during YAML parsing. - Added coverage tests for
main-actionconfig redaction branches and DinD split-filesystem detection/logging branches.
Show a summary per file
| File | Description |
|---|---|
src/container-stop-coverage.test.ts |
Adds tests for fixSquidLogPermissionsBeforeShutdown non-zero exit-code logging (stderr vs (no stderr) fallback). |
src/config-file-branches.test.ts |
Adds a test to force the String(error) fallback in loadAwfFileConfig parse error handling. |
src/commands/main-action-coverage.test.ts |
Adds tests covering redactConfigForLogging(additionalEnv) branches and createMainAction DinD probe/prefix and DNS logging branches. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Low
| /** Minimal WrapperConfig stub reused across tests. */ | ||
| const BASE_STUB_CONFIG = { | ||
| allowedDomains: ['github.com'], | ||
| blockedDomains: undefined, | ||
| agentCommand: 'echo hi', | ||
| logLevel: 'info', | ||
| keepContainers: false, | ||
| workDir: '/tmp/awf-test', | ||
| imageRegistry: 'ghcr.io/github/gh-aw-firewall', | ||
| imageTag: 'latest', | ||
| buildLocal: false, | ||
| dnsServers: ['8.8.8.8'], | ||
| awfDockerHost: undefined, | ||
| proxyLogsDir: undefined, | ||
| auditDir: undefined, | ||
| sessionStateDir: undefined, | ||
| dockerHostPathPrefix: undefined, | ||
| } as unknown as import('../types').WrapperConfig; |
|
@copilot address review feedback |
|
✅ Copilot review passed with no inline comments. @github-actions[bot] Add the |
|
❌ Smoke Gemini reports failed. Facets need polishing... Smoke test completed. Some tests failed. |
|
✅ Build Test Suite completed successfully! |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
|
🔌 Smoke Services — All services reachable! ✅ |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓 |
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
Chroot tests failed Smoke Chroot failed - See logs for details. |
|
✅ Contribution Check completed successfully! PR follows the applicable CONTRIBUTING.md guidelines; no contribution-guidelines comment needed. |
|
🚀 Security Guard has started processing this pull request |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
✅ Smoke Claude passed |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (3 files)
Coverage comparison generated by |
Smoke Test: Copilot BYOK (Direct) Mode✅ GitHub connectivity (HTTP 200) Status: PASS — Direct BYOK mode working via api-proxy sidecar Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
🔬 Smoke Test Results
Overall: PASS (MCP connectivity verified) Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test: Claude Engine Validation
Overall Result: PASS ✅ Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL — Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test: PAT Auth — PASS
Overall: PASS — Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
PR Titles:
Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) Overall: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
🔬 Smoke Test: API Proxy OpenTelemetry Tracing
All 5 scenarios pass. ✅ Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
Recent merged PRs:
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) PASS cc Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Summary
Adds targeted branch-coverage tests for three source files that had identified uncovered branches in the coverage report.
Files covered
src/container-stop.tsfixSquidLogPermissionsBeforeShutdown: non-zero exit code path with non-empty stderrfixSquidLogPermissionsBeforeShutdown:(no stderr)fallback when stderr is empty but exit code is non-zerosrc/config-file.tsloadAwfFileConfigparse-error catch block:String(error)fallback when the thrown value is not anErrorinstancesrc/commands/main-action.tsredactConfigForLogging:additionalEnvobject path — all env key values replaced with[REDACTED]redactConfigForLogging:additionalEnvnull/falsy short-circuit branchredactConfigForLogging:additionalEnvnon-object string pass-throughcreateMainAction: skipprobeSplitFilesystemwhendockerHostPathPrefixis already configuredcreateMainAction: auto-apply detected DinD path prefix and emit info logcreateMainAction: log warning when split filesystem detected but no known prefix resolvedcreateMainAction:config.dnsServersundefined → nullish-coalescing fallbackNew test files
src/container-stop-coverage.test.tssrc/config-file-branches.test.tssrc/commands/main-action-coverage.test.tsAll 10 new tests pass. No existing tests were modified or removed.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.