[Test Coverage] config-writer, agent-options, host-env branch coverage#5980
Conversation
Cover previously-uncovered code paths: src/config-writer.ts: - validateAndPrepareWorkDir: throws when workDir is not a directory (line 58) - copySeccompProfile: copies from alt path when primary is missing (lines 95-97) - copySeccompProfile: throws when neither path exists - writeAuditArtifacts: throws when auditDir is not a directory (line 162) src/commands/validators/agent-options.ts: - env success path (additionalEnv assignment, line 45) - invalid env var format (branch 39 — process.exit) - missing envFile (branch 50 — process.exit) - valid mount path (lines 67-68) - invalid mount format (branch 62 — process.exit) - enableDlp log path (line 141, branch 140) src/host-env.ts: - stripScheme: catch branch when URL constructor throws (line 81) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds targeted Jest tests to increase branch/line coverage for previously-uncovered paths in security-critical modules (config-writer, validateAgentOptions, and stripScheme) without changing production behavior.
Changes:
- Adds
src/config-writer-new-branches.test.tsto coverconfig-writerguard/fallback branches (non-directory workDir/auditDir, seccomp fallback and missing-profile error). - Adds
src/coverage-new-branches.test.tsto covervalidateAgentOptionsenv/mount/envFile branches andstripSchemecatch-path behavior.
Show a summary per file
| File | Description |
|---|---|
| src/coverage-new-branches.test.ts | Adds branch-coverage tests for stripScheme and validateAgentOptions (env/mount/envFile/DLP branches). |
| src/config-writer-new-branches.test.ts | Adds branch-coverage tests for config-writer workdir hardening, seccomp profile copy fallbacks, and audit-dir guards using a dedicated fs mock. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Low
|
✅ Copilot review passed with no inline comments. @github-actions[bot] Add the |
|
✅ Smoke Claude passed |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
🔌 Smoke Services — All services reachable! ✅ |
|
🚀 Security Guard has started processing this pull request |
|
✅ Contribution Check completed successfully! PR #5980 follows the applicable CONTRIBUTING.md guidelines: it adds tests only, includes clear PR details, and places test files alongside source under src/. No contribution-guidelines comment needed. |
|
Chroot tests failed Smoke Chroot failed - See logs for details. |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
❌ Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed... |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
✅ Build Test Suite completed successfully! |
|
❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed... |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
✅ Smoke Gemini completed. All facets verified. 💎 Smoke test completed with failures. See PR comment for details. |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (3 files)
Coverage comparison generated by |
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 Results
Overall: PASS (core connectivity verified) Author:
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: Copilot PAT Auth — PASS ✅
Auth mode: PAT (COPILOT_GITHUB_TOKEN) 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: Copilot BYOK (Direct) — PASSRunning in direct BYOK mode (
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 Results: Gemini Engine Validation
Overall Status: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"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.
|
📡 Smoke Test: API Proxy OpenTelemetry Tracing
Overall: ✅ All scenarios pass or are expected-pending during development. OTEL tracing integration is functioning correctly. 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
Warning Firewall blocked 2 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"
- "registry.npmjs.org"See Network Configuration for more information.
|
Summary
Adds 19 new tests covering previously-uncovered branches in three security-critical source files.
Files changed
src/config-writer-new-branches.test.ts(new)Covers branches in
src/config-writer.tsusing a standalone fs mock:validateAndPrepareWorkDirnon-dir guardworkDirexists but is not a directorycopySeccompProfilealt-pathcopySeccompProfilemissing both pathswriteAuditArtifactsnon-dir guardauditDirexists but is not a directorysrc/coverage-new-branches.test.ts(new)Covers branches in
src/commands/validators/agent-options.tsandsrc/host-env.ts:validateAgentOptionsenv successadditionalEnvon successful parsevalidateAgentOptionsinvalid envprocess.exit(1)on invalid env var formatvalidateAgentOptionsmissing envFileprocess.exit(1)when--env-filedoes not existvalidateAgentOptionsmount successvolumeMountson successful parsevalidateAgentOptionsinvalid mountprocess.exit(1)on invalid volume mountvalidateAgentOptionsenableDlpstripSchemeURL errorCoverage impact
These tests target the specific uncovered lines/branches reported by the coverage run:
src/config-writer.ts: branches at lines 57, 79, 94, 161src/commands/validators/agent-options.ts: branches at lines 39, 50, 62, 140src/host-env.ts: branch at line 72 (catch path)Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.