Skip to content

[Test Coverage] mount-policy-validation.test.ts#6418

Merged
lpcox merged 2 commits into
mainfrom
test-coverage/mount-policy-validation-ddae27b4c42cad4f
Jul 20, 2026
Merged

[Test Coverage] mount-policy-validation.test.ts#6418
lpcox merged 2 commits into
mainfrom
test-coverage/mount-policy-validation-ddae27b4c42cad4f

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Adds 39 new unit tests covering all error-handling branches in src/config/mount-policy.ts that were unreachable by the existing test suite.

Problem

The validate() function and helpers (assertAbsolutePathArray, assertHomeSubdirArray, parseCredentials) run once at module-load time with valid JSON, so every error branch was dead code from Jest's perspective. Line coverage was ~80%.

Solution

jest.isolateModules() + jest.mock('./sandbox-mount-policy.json') injects malformed JSON and reloads the module, triggering each validation error in isolation.

Coverage improvements

  • Root validation: null, non-object, missing system.directories, missing home
  • assertAbsolutePathArray: non-array, non-string elements, empty/relative/../duplicate paths
  • assertHomeSubdirArray: non-array, empty/absolute/~-prefixed/nested/../duplicate entries
  • parseCredentials: null credentials, missing entries, non-object entries, invalid/empty/absolute/.. paths, duplicate paths, invalid type, files on file-type, files with empty/slashed/../duplicate filenames, missing reason
  • credentialFilesToHide: dir entries with no files are omitted; files arrays are fully expanded

Tests

39 new tests — all passing. No existing tests modified.

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Test Coverage Improver · 78.3 AIC · ⊞ 5.6K ·

Cover all error-handling paths in the validate() function and its
helpers (assertAbsolutePathArray, assertHomeSubdirArray, parseCredentials)
that were never exercised because module-load runs only with valid JSON.

Uses jest.isolateModules() + jest.mock() to inject malformed JSON and
trigger every error branch in isolation.

39 new tests; brings src/config/mount-policy.ts from ~80% to
near-full line/branch coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review July 20, 2026 13:46
Copilot AI review requested due to automatic review settings July 20, 2026 13:46

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

Adds isolated Jest tests for mount-policy validation and credential hiding behavior.

Changes:

  • Injects malformed policies with jest.isolateModules().
  • Covers validation failures and credential expansion edge cases.
Show a summary per file
File Description
src/config/mount-policy-validation.test.ts Adds mount-policy validation tests.

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: 1
  • Review effort level: Medium

Comment thread src/config/mount-policy-validation.test.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Contribution Check completed successfully!

PR #6418 follows the contribution guidelines: the change is test-only, includes new tests, keeps file placement under src/config, and the description is clear enough for the scope of the update. No review comment needed.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅

@github-actions

Copy link
Copy Markdown
Contributor Author

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jul 20, 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 Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Claude passed

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

Copy link
Copy Markdown
Contributor Author

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 98.45% 98.79% 📈 +0.34%
Statements 98.29% 98.73% 📈 +0.44%
Functions 99.16% 99.28% 📈 +0.12%
Branches 94.30% 95.01% 📈 +0.71%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)
src/config/mount-policy.ts 80.2% → 100.0% (+19.80%) 74.3% → 100.0% (+25.72%)

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

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Copilot BYOK (Direct) Mode

✅ MCP connectivity (prompt received)
✅ BYOK inference working (api-proxy → api.githubcopilot.com)
✅ Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY)

Status: PASS

Agent credentials routed through api-proxy sidecar. Inference path verified.

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@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.13 ✅ YES
Node.js v24.18.0 v24.18.0 ✅ YES
Go go1.22.12 go1.22.12 ✅ YES

All runtimes match between host and chroot environment.

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test Results

Test Status
GitHub MCP connectivity
GitHub.com HTTP ⚠️ pre-step data unavailable
File write/read ⚠️ pre-step data unavailable

Author: @lpcox | Auth mode: PAT (COPILOT_GITHUB_TOKEN)

Overall: PARTIAL — MCP ✅; pre-step template vars were not expanded (literal ${{ }} in prompt).

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🔑 PAT report filed by Smoke Copilot PAT
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Claude Engine Validation

Check Result
API Status ✅ PASS
GH Check ✅ PASS
File Status ✅ PASS

Overall Result: PASS

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Smoke Claude for #6418 · 56.3 AIC · ⊞ 3.3K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke test: Copilot network-isolation egress enforcement

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (api.github.com): allowed=200
✅ Blocked domain (example.com): OK: example.com was blocked

Overall: PASS@lpcox

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • awmgmcpg
  • example.com

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

network:
  allowed:
    - defaults
    - "awmgmcpg"
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions github-actions Bot added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

@lpcox

✅ GitHub MCP connectivity
✅ GitHub.com connectivity
✅ File write/read
✅ 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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Services Connectivity

Check Result
Redis PING host.docker.internal not resolvable
PostgreSQL pg_isready ❌ No route to host
PostgreSQL SELECT 1 ❌ No route to host

Overall: FAIL

Runner executes inside the AWF sandbox (172.30.0.20/24). host.docker.internal does not resolve in this network namespace and there is no route to reach GitHub Actions service containers.

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Result Notes
Module Loading otel.js loaded successfully; exports: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled
Test Suite Run api-proxy OTEL tests step passed
Env Var Forwarding src/services/api-proxy-env-config.ts forwards all OTEL env vars: GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID
Token Tracker Integration onUsage callback exists in token-tracker-http.js (line 343) as the OTEL hook point
OTEL Diagnostics Step was pending at time of check (workflow still running)

Overall: All completed scenarios passed. Diagnostics step pending — expected during active run.

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

Merged PRs:\n- Internalize dead sbx-manager exports\n- Internalize dead secureWipeFile export in SSL key storage\nChecks:\n- PR list: ✅\n- Playwright: ✅\n- Build: ✅\n- Discussion: ✅\nOverall: PASS

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • awmgmcpg
  • registry.npmjs.org

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

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

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Build Test Suite for #6418 · 35.4 AIC · ⊞ 7.1K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

🔥 Smoke Test: Docker Sbx — PASS

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

Overall: PASS

📰 BREAKING: Report filed by Smoke Docker Sbx
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test Results

  • GitHub MCP Testing: ❌ (Access Denied/Filtered)
  • GitHub.com Connectivity: ❌ (DNS Failure, Status 000)
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅

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
Add label ready-for-aw to run again

@lpcox
lpcox merged commit 1b12967 into main Jul 20, 2026
139 of 142 checks passed
@lpcox
lpcox deleted the test-coverage/mount-policy-validation-ddae27b4c42cad4f branch July 20, 2026 16:34
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