Skip to content

refactor: split agent-volumes-mounts.test.ts by feature area#5522

Merged
lpcox merged 3 commits into
mainfrom
copilot/refactor-split-agent-volumes-mounts-test
Jun 25, 2026
Merged

refactor: split agent-volumes-mounts.test.ts by feature area#5522
lpcox merged 3 commits into
mainfrom
copilot/refactor-split-agent-volumes-mounts-test

Conversation

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

src/services/agent-volumes-mounts.test.ts had grown to 862 lines with 38 flat it() cases and zero sub-grouping across 6 distinct feature areas, making it hard to scan and slow to pinpoint failures.

Changes

  • Deleted agent-volumes-mounts.test.ts (862 lines)
  • Created 6 focused replacements, each covering one feature area:
File Tests Coverage
agent-volumes-basic.test.ts 8 Default/custom mounts, path prefixing, trailing-slash normalization, selective mounts, malformed mount fallback
agent-volumes-arc-dind-staging.test.ts 6 ARC/DinD binary staging, PATH candidate selection, explicit command path, /etc/passwd+/etc/group non-prefixing, stale dir pruning, path escape guard
agent-volumes-dind-socket.test.ts 7 API-proxy health-check mount, enableDind, DOCKER_HOST forwarding, invalid-socket fallback
agent-volumes-toolchain.test.ts 6 Rust/cargo, npm/nvm, Gemini key dir, runnerToolCachePath, RUNNER_TOOL_CACHE, symlink exclusion
agent-volumes-chroot-hosts.test.ts 8 .copilot bind-mount guards, sessionStateDir, /tmp/host/tmp, /etc lookup files, enableHostAccess, host.docker.internal injection
agent-volumes-dns-preresolution.test.ts 3 Domain pre-resolution, failed-resolution skip, duplicate deduplication

All 38 tests are preserved with identical assertions. Each file follows the existing split-test convention: own jest.mock('execa', …) (required due to Jest hoisting) and shared setup imported from service-test-setup.test-utils.

Copilot AI changed the title [WIP] Refactor agent volumes mounts test by feature area refactor: split agent-volumes-mounts.test.ts by feature area Jun 25, 2026
Copilot AI requested a review from lpcox June 25, 2026 14:54
Copilot finished work on behalf of lpcox June 25, 2026 14:54
@lpcox lpcox marked this pull request as ready for review June 25, 2026 14:56
Copilot AI review requested due to automatic review settings June 25, 2026 14:56

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 refactors the agent volume mount unit tests by splitting a single large agent-volumes-mounts.test.ts file into multiple smaller, feature-focused test files, improving scanability and making failures easier to localize within the AWF service layer.

Changes:

  • Deleted the monolithic src/services/agent-volumes-mounts.test.ts.
  • Added 6 feature-scoped test files covering basic mounts, ARC/DinD staging, DinD sockets, toolchain mounts, chroot/hosts behavior, and DNS pre-resolution.
  • Preserved the existing set of test cases/assertions while reorganizing them into clearer groupings.
Show a summary per file
File Description
src/services/agent-volumes-basic.test.ts Covers default/custom mounts, host path prefixing, trailing-slash normalization, and malformed mount fallback.
src/services/agent-volumes-arc-dind-staging.test.ts Covers ARC/DinD staging behaviors (PATH candidate selection, explicit command path, staging pruning, escape guard).
src/services/agent-volumes-dind-socket.test.ts Covers DinD socket exposure and API-proxy health-check mount behavior.
src/services/agent-volumes-toolchain.test.ts Covers toolchain/cache mounts (Rust, npm/nvm), Gemini mount gating, and runner toolcache mounting rules.
src/services/agent-volumes-chroot-hosts.test.ts Covers .copilot mount guards, session-state overrides, and chroot /etc/hosts behavior.
src/services/agent-volumes-dns-preresolution.test.ts Covers allowlist domain pre-resolution behavior and dedup behavior for domains already present in /etc/hosts.
src/services/agent-volumes-mounts.test.ts Removed (tests split into feature-focused replacements).

Copilot's findings

Tip

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

  • Files reviewed: 7/7 changed files
  • Comments generated: 4

Comment on lines +104 to +109
// Count occurrences of 'localhost' - should only be the original entries, not duplicated
const localhostMatches = content.match(/localhost/g);
// /etc/hosts typically has multiple localhost entries (127.0.0.1 and ::1)
// The key assertion is that getent should NOT have been called for localhost
// since it's already in the hosts file
expect(localhostMatches).toBeDefined();
Comment on lines +13 to +17
function withEnv(envPatch: Record<string, string | undefined>, fn: () => void): void {
const saved: Record<string, string | undefined> = {};

for (const [key, value] of Object.entries(envPatch)) {
saved[key] = process.env[key];
Comment on lines +14 to +18
function withEnv(envPatch: Record<string, string | undefined>, fn: () => void): void {
const saved: Record<string, string | undefined> = {};

for (const [key, value] of Object.entries(envPatch)) {
saved[key] = process.env[key];
Comment on lines +11 to +15
function withEnv(envPatch: Record<string, string | undefined>, fn: () => void): void {
const saved: Record<string, string | undefined> = {};

for (const [key, value] of Object.entries(envPatch)) {
saved[key] = process.env[key];
@lpcox

lpcox commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Done in 3fd170a:

  • withEnv deduplication: Exported a shared withEnv helper from service-test-setup.test-utils and replaced the three local copies in agent-volumes-dind-socket.test.ts, agent-volumes-toolchain.test.ts, and agent-volumes-chroot-hosts.test.ts with an import.

  • DNS dedup test: Replaced the weak expect(localhostMatches).toBeDefined() assertion with a check that mockExecaSync was never called with getent hosts localhost, plus a content.toContain('localhost') check on the file content.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Contribution Check failed. Please review the logs for details.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

Testing safeoutputs

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK ✅ PASS

Tests:

  • ✅ GitHub MCP connectivity (listed recent PRs)
  • ✅ GitHub.com connectivity (HTTP 200)
  • ✅ File write/read test passed
  • ✅ Direct BYOK inference active (agent → api-proxy → api.githubcopilot.com)

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar. All systems operational.

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine

  • API status: ✅ PASS
  • gh check: ✅ PASS
  • File status: ✅ PASS

Overall result: PASS

Generated by Smoke Claude for issue #5522 · 37.2 AIC · ⊞ 3.3K ·

@github-actions

Copy link
Copy Markdown
Contributor

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

Test Result
GitHub MCP connectivity
GitHub.com connectivity (HTTP 200)
File write/read ❓ pre-step data unavailable (template vars not substituted)

Overall: FAIL (unable to confirm all tests — pre-step data missing)

PR: refactor: split agent-volumes-mounts.test.ts by feature area — author @Copilot, assignees @lpcox @Copilot

🔑 PAT report filed by Smoke Copilot PAT

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox Smoke test results:

  • GitHub MCP: ✅
  • GitHub.com HTTP: ✅
  • File I/O: ✅
  • 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
    PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

PR: refactor: split agent-volumes-mounts.test.ts by feature area
Author: @Copilot | Assignees: @lpcox @Copilot

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

Overall: FAIL — pre-computed step outputs were not substituted (template variables literal in prompt).

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor

refactor(api-proxy): extract sliding-window data structure into rate-limiter-window.js ✅
perf: optimize duplicate-code-detector to reduce AIC by ~50% ✅
GitHub reads ✅
Playwright ✅
File write/verify ✅
Build ✅
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

Smoke Test: API Proxy OpenTelemetry Tracing ✅

Scenario Result Notes
1. Module loading ✅ Pass otel.js loads; isEnabled() true; exports 7 public functions + test helpers
2. Test suite ✅ Pass 59 tests passed, 0 failed (2 suites: otel.test.js, otel-fanout.test.js)
3. Env var forwarding ✅ Pass src/services/api-proxy-env-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, OTEL_SERVICE_NAME
4. Token-tracker OTEL hook ✅ Pass onUsage callback in token-tracker-http.js drives setTokenAttributes + setBudgetAttributes on the active span
5. OTEL diagnostics / graceful degradation ✅ Pass No OTLP endpoint configured → FileSpanExporter fallback to /var/log/api-proxy/otel.jsonl; no errors

All 5 scenarios pass. OTEL tracing is fully implemented and working correctly.

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results

  • GitHub MCP Testing: ❌ (Tools not found, api.github.com blocked)
  • GitHub.com Connectivity: ✅ (HTTP 200 via proxy)
  • File Writing Testing: ✅ (Verified)
  • Bash Tool Testing: ✅ (Verified)

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

Chroot Version Comparison Results

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

Overall: ❌ Not all versions match — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Services Connectivity

Check Result
Redis PING ❌ No response
PostgreSQL pg_isready no response
PostgreSQL SELECT 1 ❌ No response

host.docker.internal resolves to 172.17.0.1 but neither Redis (6379) nor PostgreSQL (5432) are reachable from this host.

Overall: FAIL — Service containers are not accessible.

🔌 Service connectivity validated by Smoke Services

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ 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

Notes:

  • Java Maven: Initial ~/.m2/repository creation failed due to directory owned by root. Resolved by configuring a custom local repository path (/tmp/gh-aw/agent/.m2/repository) via -s settings flag.
  • All other ecosystems ran without issues.

Generated by Build Test Suite for issue #5522 · 37.6 AIC · ⊞ 7.8K ·

@github-actions

Copy link
Copy Markdown
Contributor

@Copilot @lpcox

  • refactor: split agent-volumes-mounts.test.ts by feature area: ✅
  • refactor: split writeConfigs into focused setup phases: ✅
  • MCP connectivity via GitHub CLI: ✅
  • HTTP https://github.com: ✅
  • Agent file write/read: ✅
  • Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw): ✅

Overall: PASS

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

@lpcox lpcox merged commit b33df91 into main Jun 25, 2026
87 of 89 checks passed
@lpcox lpcox deleted the copilot/refactor-split-agent-volumes-mounts-test branch June 25, 2026 16:26
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.

3 participants