Skip to content

[Test Coverage] Add branch coverage for audit-enricher, log-and-limits, docker-host-staging#5152

Merged
lpcox merged 7 commits into
mainfrom
test-coverage-extra-branches-fbd1f737d5efc303
Jun 17, 2026
Merged

[Test Coverage] Add branch coverage for audit-enricher, log-and-limits, docker-host-staging#5152
lpcox merged 7 commits into
mainfrom
test-coverage-extra-branches-fbd1f737d5efc303

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Improves test coverage for three modules that were below the 80% branch threshold.

Changes

src/logs/audit-enricher-extra.test.ts (new)

Extends coverage of audit-enricher.ts with previously uncovered branches:

  • domainMatchesRule: dash (-) and empty domain early-return guards
  • isRegexRule detection via metacharacters in domain patterns (non-regex aclName)
  • Invalid regex catch block — verifies bad patterns are silently skipped
  • HTTP-only protocol rule matching (protocol: 'http' with isHttps: false)
  • Protocol mismatch returning false from protocolMatches
  • The unknown fallback path in enrichWithPolicyRules (no rule matches)
  • Rule action mismatch: domain matches but observed outcome differs → rule skipped
  • Empty domains list on non-all rules → skipped
  • computeRuleStats: url === 'error:transaction-end-before-headers' skip
  • computeRuleStats: unknownHits > 0 appends the unknown summary row

src/commands/validators/log-and-limits.test.ts (new)

First tests for validateLogAndLimits, covering all 13 previously uncovered branches:

  • Valid success paths (log levels, numeric limits, multiplier merging, infoMessage logging)
  • All process.exit(1) error paths: invalid logLevel, non-integer/non-positive
    maxEffectiveTokens, maxAiCredits, effectiveTokenDefaultModelMultiplier,
    maxModelMultiplierCap, maxRuns, maxPermissionDenied, malformed
    maxModelMultiplier, invalid memoryLimit, and missing --build-local for custom image

src/services/agent-volumes/docker-host-staging.test.ts (new)

First tests for docker-host-staging.ts, covering all 8 previously uncovered branches:

  • shouldUseDockerHostStaging: undefined, empty, whitespace, exact /tmp, trailing slash,
    subdirectory, paths outside /tmp, bare tmp without leading slash
  • getDockerHostStageRoot: workDir vs prefix-based root selection
  • stageHostFile: non-existent source, directory source (not a file), successful copy,
    path-traversal (../../etc/passwd) rejection, empty relative path rejection,
    nested directory creation, custom file mode
  • extractCommandBinaryName: simple command, path prefix, empty string, whitespace, unsafe
    basename characters, dots/hyphens allowed, no-argument command

Coverage impact

File Branches before Expected after
src/logs/audit-enricher.ts 74% ~95%+
src/commands/validators/log-and-limits.ts 78% ~95%+
src/services/agent-volumes/docker-host-staging.ts 72% ~90%+

All 69 new tests pass. Existing tests are unmodified.

Generated by Test Coverage Improver ·

Cover previously uncovered branches:

- audit-enricher-extra.test.ts: domain edge cases (dash/empty domain,
  regex metachar detection, invalid-regex catch), HTTP-only protocol
  matching, unknown-fallback path, transaction-end skip in
  computeRuleStats, and unknown-hit counting
- validators/log-and-limits.test.ts: all validation error exit paths
  (logLevel, maxEffectiveTokens, maxAiCredits, multipliers, maxRuns,
  maxPermissionDenied, memoryLimit, agentImage) and success paths
- agent-volumes/docker-host-staging.test.ts: shouldUseDockerHostStaging
  edge cases, stageHostFile directory/traversal rejection, and
  extractCommandBinaryName with empty/unsafe names

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox marked this pull request as ready for review June 17, 2026 14:54
Copilot AI review requested due to automatic review settings June 17, 2026 14:54
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 97.30% 97.61% 📈 +0.31%
Statements 97.16% 97.53% 📈 +0.37%
Functions 98.84% 98.84% ➡️ +0.00%
Branches 91.92% 92.96% 📈 +1.04%
📁 Per-file Coverage Changes (4 files)
File Lines (Before → After) Statements (Before → After)
src/workdir-setup.ts 92.7% → 94.5% (+1.82%) 92.7% → 94.5% (+1.82%)
src/logs/audit-enricher.ts 89.4% → 95.7% (+6.38%) 83.6% → 95.1% (+11.48%)
src/services/agent-volumes/docker-host-staging.ts 87.2% → 95.7% (+8.51%) 87.8% → 95.9% (+8.16%)
src/commands/validators/log-and-limits.ts 90.3% → 100.0% (+9.68%) 90.3% → 100.0% (+9.68%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds new Jest test suites to increase branch coverage for three existing modules (audit-enricher, log-and-limits validator, and docker-host-staging) that were previously below the branch-coverage threshold.

Changes:

  • Add an additional audit-enricher test suite targeting previously uncovered rule-matching and stats branches.
  • Add a dedicated validateLogAndLimits test suite covering success and failure/exit branches.
  • Add a first test suite for docker-host-staging covering staging behavior and command parsing helpers.
Show a summary per file
File Description
src/logs/audit-enricher-extra.test.ts Adds branch-focused tests for rule matching (regex detection/invalid regex/protocol matching) and computeRuleStats “unknown”/skip paths.
src/commands/validators/log-and-limits.test.ts Adds validator tests for log-level, token/credit/multiplier numeric validation, memory-limit handling, and agent-image/build-local validation.
src/services/agent-volumes/docker-host-staging.test.ts Adds tests for /tmp-prefix staging decisions, staged file-copy/path-traversal rejection, and command binary name extraction.

Copilot's findings

Tip

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

  • Files reviewed: 3/3 changed files
  • Comments generated: 6

Comment thread src/logs/audit-enricher-extra.test.ts Outdated
Comment thread src/logs/audit-enricher-extra.test.ts Outdated
Comment thread src/commands/validators/log-and-limits.test.ts
Comment thread src/commands/validators/log-and-limits.test.ts
Comment thread src/commands/validators/log-and-limits.test.ts
Comment thread src/commands/validators/log-and-limits.test.ts
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

✅ Copilot review passed with no inline comments.

@github-actions[bot] Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

lpcox and others added 6 commits June 17, 2026 08:10
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

📡 Smoke OTel Tracing reports failed. OTel tracing regression detected. ⚠️

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

🔌 Smoke Services — Service connectivity failed ⚠️

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Claude failed

@github-actions

Copy link
Copy Markdown
Contributor Author

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Contribution Check failed. Please review the logs for details.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

@github-actions

Copy link
Copy Markdown
Contributor Author

🔍 Smoke Test Results — Auth mode: PAT (COPILOT_GITHUB_TOKEN)

@lpcox (no assignees)

Test Result
✅ GitHub MCP Connected — PR listed successfully
✅ GitHub.com connectivity HTTP 200
❌ File write/read Pre-step data not passed (template vars unresolved)

Overall: FAIL — file test could not be verified (workflow outputs SMOKE_FILE_* were not substituted before agent invocation).

🔑 PAT report filed by Smoke Copilot PAT

@github-actions

Copy link
Copy Markdown
Contributor Author

🔥 Smoke Test Results

PR: [Test Coverage] Add branch coverage for audit-enricher, log-and-limits, docker-host-staging
Author: @github-actions[bot]

Test Result
GitHub MCP connectivity
GitHub.com HTTP connectivity
File write/read

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor Author

✅ feat(api-proxy): forward COPILOT_INTEGRATION_ID from host env
✅ Fix duplicate-code-detector: Add missing GH_TOKEN for gh CLI authentication
✅ [Test Coverage] Add branch coverage for audit-enricher, log-and-limits, docker-host-staging
Overall: PASS

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

Copy link
Copy Markdown
Contributor Author

@lpcox @github/gh-aw-firewall

Smoke Test Results:
• GitHub MCP: ✅
• GitHub.com Connectivity: ✅
• File Write/Read Test: ✅
• Direct BYOK Inference: ✅

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) authenticated via Microsoft Entra

Overall: PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test Results: Gemini

  1. GitHub MCP: ✅
  2. Connectivity: ❌ (SSL error 35)
  3. File Writing: ✅
  4. Bash Tool: ✅

Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini

@github-actions

Copy link
Copy Markdown
Contributor Author

@github-actions[bot]

  1. MCP PR listing: ✅ (chore(deps): Bump @opentelemetry/core from 1.30.1 to 2.8.0; Reduce Pelis Advisor AI credit burn with fixed low-cost model + turn cap)
  2. GitHub connectivity: ✅
  3. File I/O test: ✅
  4. BYOK inference: ✅
    Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
    Status: PASS

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)

@github-actions

Copy link
Copy Markdown
Contributor Author

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3
Node.js v24.16.0 v22.22.3
Go go1.22.12 go1.22.12

Overall: FAILED — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions

Copy link
Copy Markdown
Contributor Author

🏗️ 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 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: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #5152 ·

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Copilot BYOK (Direct) Mode ✅ PASS

Test Results:

  • ✅ GitHub MCP Testing (list_pull_requests verified)
  • ✅ GitHub.com Connectivity (HTTP 200)
  • ✅ File Write/Read Test (created and verified)
  • ✅ BYOK Inference Test (responding via api-proxy → api.githubcopilot.com)

Status: Running in direct BYOK mode with COPILOT_PROVIDER_API_KEY forwarded to api-proxy sidecar. Agent receives placeholder credential. Inference path operational.

/cc @lpcox

🔑 BYOK report filed by Smoke Copilot BYOK

@lpcox lpcox merged commit 0571710 into main Jun 17, 2026
80 of 85 checks passed
@lpcox lpcox deleted the test-coverage-extra-branches-fbd1f737d5efc303 branch June 17, 2026 15:49
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.

2 participants