[Test Coverage] branch coverage: log-parser, workdir-setup, network-setup, preflight#5923
Conversation
…p, preflight Cover 30 previously uncovered branches across four source files: - logs/log-parser.ts: extractDomain non-numeric port suffix in CONNECT and Host header; parseAuditJsonlLine missing method/decision fields, non-numeric dest port, invalid ISO timestamp with ts fallback, ts-only legacy format, and missing timestamp - workdir-setup.ts: ensureDirectory and assertRealDirectory symlink and non-directory error paths; createMissingOwnedDirectorySegments file- segment error; prepareLogDirectories mcp-logs already-exists else branch; prepareChrootHomeMounts runnerToolCachePath outside home warn - commands/network-setup.ts: non-Error thrown by parseDnsServers and detectUpstreamProxy/parseProxyUrl; no_proxy env var propagation - commands/preflight.ts: non-Error in validateAllowedDomains; block- domains option and file parsing; non-Error in blockDomainsFile; domain validation failure; deduplication Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a new Jest test suite intended to improve branch coverage for several security-relevant modules (log parsing, workdir setup, network setup, and preflight option validation) without changing production code.
Changes:
- Add targeted branch-coverage unit tests for
parseLogLine/parseAuditJsonlLineedge cases. - Add workdir setup tests covering symlink/non-directory error paths and runner tool-cache “outside home” warning path.
- Add network/preflight tests for non-
Errorthrown values,no_proxypropagation, and blocked-domain parsing/validation/deduping.
Show a summary per file
| File | Description |
|---|---|
| src/coverage-improvements.test.ts | New consolidated test file covering previously-uncovered branches across log parsing, workdir setup, network setup, and preflight validation. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Low
|
|
||
| // ─── workdir-setup.ts ───────────────────────────────────────────────────────── | ||
|
|
||
| // Use real fs (not the mock factory) since we need symlink/non-dir setup. |
|
|
||
| // ─── commands/network-setup.ts ──────────────────────────────────────────────── | ||
|
|
||
| jest.mock('./commands/network-setup', () => jest.requireActual('./commands/network-setup')); |
|
@copilot address review feedback |
Done in the latest commit:
All 30 tests continue to pass. |
|
✅ Copilot review passed with no inline comments. @github-actions[bot] Add the |
|
✅ Smoke Gemini completed. All facets verified. 💎 Gemini smoke test completed. Status: FAIL. Results reported in PR #5923. |
|
✅ Build Test Suite completed successfully! |
|
✅ Contribution Check completed successfully! PR #5923 follows the applicable CONTRIBUTING.md guidelines; no review comment needed. |
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓 |
|
✅ Smoke Claude passed |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
Chroot tests failed Smoke Chroot failed - See logs for details. |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
🚀 Security Guard has started processing this pull request |
|
🔌 Smoke Services — All services reachable! ✅ |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
|
✅ Smoke Test: Copilot BYOK (Direct) Mode - PASS
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) 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: 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 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: Copilot PAT Auth
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.
|
|
Pre-fetched PR data: ${{ steps.smoke-data.outputs.SMOKE_PR_DATA }} ✅ 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.
|
|
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Status: 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: Services Connectivity
Result: 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 result: FAIL (Connectivity issues) 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.
|
|
Reviewed merged PRs:\n- refactor(api-proxy): centralize auth-header construction in shared helpers\n- refactor: split postprocess-smoke-workflows.ts into focused modules\n\nChecks:\n- GitHub query: ✅\n- Playwright: ✅\n- File write: ✅\n- Build: ✅\n\nOverall: PASS 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.
|
🏗️ 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.
|
📡 OTel Tracing Smoke Test Results
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 30 new unit tests targeting previously uncovered branches in four security-relevant source files.
Files covered
src/logs/log-parser.tsextractDomainnon-numeric port suffix (CONNECT and Host header);parseAuditJsonlLinemissing method/decision, non-numeric dest port, invalid ISO timestamp,ts-only format, no timestampsrc/workdir-setup.tsensureDirectory/assertRealDirectorysymlink and non-directory throws;createMissingOwnedDirectorySegmentsfile-segment throw;prepareLogDirectoriesmcp-logs already-exists else branch;prepareChrootHomeMountsrunnerToolCachePath outside home warnsrc/commands/network-setup.tsparseDnsServers,detectUpstreamProxy,parseProxyUrl;no_proxyenv var propagationsrc/commands/preflight.tsvalidateAllowedDomains;blockDomainsoption parsing;blockDomainsFileread failures (Error + non-Error); domain validation failure; deduplicationTest results
All 30 new tests pass. All existing tests (97) continue to pass.
Notes
jest.mockfor all fs/process dependenciesWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.