Skip to content

[Test Coverage] container-startup-diagnostics coverage#5474

Merged
lpcox merged 1 commit into
mainfrom
test-coverage/container-startup-diagnostics-ca4da4fddd2a2c1d
Jun 24, 2026
Merged

[Test Coverage] container-startup-diagnostics coverage#5474
lpcox merged 1 commit into
mainfrom
test-coverage/container-startup-diagnostics-ca4da4fddd2a2c1d

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Adds src/container-startup-diagnostics-coverage.test.ts with 27 new tests directly exercising three previously untested functions in container-startup-diagnostics.ts.

Coverage added

didContainerFailStartup

  • Error message shortcut: container name + is unhealthytrue (no inspect call)
  • Error message shortcut: container name + exited (1)true
  • Falls through to docker inspect when string pattern doesn't match
  • Inspect: containerStatus === 'exited'true
  • Inspect: healthStatus === 'unhealthy'true
  • Inspect: running|healthyfalse
  • Inspect exits non-zero (container missing) → false
  • Inspect throws (daemon unreachable) → false (catch path)
  • Malformed/empty inspect output → false

logContainerLogsToStderr

  • Success with stdout/stderr output → emits via logger.error
  • Success with empty combined output → no logger.error call
  • Non-zero exit code from docker logs → emits debug message
  • Exception thrown → silently swallows and emits debug message

handleHealthcheckError

  • is unhealthy keyword + denials in Squid logs → throws blocked-domain error
  • dependency failed keyword + denials → throws blocked-domain error
  • is unhealthy + no denials → rethrows original error
  • No health keyword → rethrows without calling checkSquidLogs
  • proxyLogsDir forwarded correctly to checkSquidLogs

reportBlockedDomains (additional branches)

  • Empty target list → only allowed-domain listing, no fix messages
  • Wildcard allowlist entry (*.github.com) matches subdomain targets
  • else branch: allowed domain + standard port + matching protocol → generic - Blocked: with no annotation
  • HTTPS-only allowlist entry blocking HTTP traffic → protocol mismatch classification
  • Duplicate domain targets → deduplicated in fix suggestion
  • Fix messages scoped: only relevant ones shown (domain/port/protocol independently)
  • Target with undefined port (protocol = both) handled correctly

Testing

All 27 new tests pass. No existing tests modified.

Generated by Test Coverage Improver · 90.4 AIC · ⊞ 5.9K ·

Add container-startup-diagnostics-coverage.test.ts with 27 tests
directly targeting the three previously uncovered functions:

- didContainerFailStartup: all branches (string matching shortcut,
  docker inspect exited/unhealthy/healthy/non-zero exit/thrown error)
- logContainerLogsToStderr: success with output, empty output (no emit),
  non-zero exit code (debug log), thrown exception (silent swallow)
- handleHealthcheckError: blocked-domain path (is unhealthy keyword,
  dependency failed keyword), no-denial rethrow, non-matching rethrow,
  proxyLogsDir forwarding
- reportBlockedDomains: empty target list, wildcard allowlist matching,
  else branch (allowed domain + standard port + matching protocol),
  https-only protocol mismatch, duplicate domain deduplication,
  fix-message scoping (domain/port/protocol shown only when relevant)

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

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 direct unit-test coverage for container startup diagnostic helpers, improving confidence in failure classification and user-facing diagnostics without changing runtime behavior.

Changes:

  • Added a new Jest test suite that directly exercises previously indirect/uncovered branches in container-startup-diagnostics.ts.
  • Expanded branch coverage for didContainerFailStartup, logContainerLogsToStderr, handleHealthcheckError, and reportBlockedDomains (including wildcard/protocol/“else” paths).
Show a summary per file
File Description
src/container-startup-diagnostics-coverage.test.ts Adds comprehensive unit tests covering startup-failure detection, log-dumping behavior, blocked-domain diagnosis, and blocked-target classification branches.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions

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.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Gemini completed. All facets verified. 💎

Testing safeoutputs connectivity

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Claude passed

@github-actions

github-actions Bot commented Jun 24, 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 24, 2026

Copy link
Copy Markdown
Contributor Author

Contribution Check completed successfully!

Contribution check complete: PR #5474 follows the applicable CONTRIBUTING.md guidelines. It adds tests alongside the related source area, includes a clear PR description and testing note, and does not require documentation updates because it only adds test coverage.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

Copy link
Copy Markdown
Contributor Author

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 24, 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 24, 2026

Copy link
Copy Markdown
Contributor Author

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

);
// The else branch emits " - Blocked: github.com:443" with no extra annotation
expect(messages).toContain(' - Blocked: github.com:443');
const blockedMsg = messages.find(m => m.includes('github.com:443'));
@github-actions

Copy link
Copy Markdown
Contributor Author

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 98.06% 98.14% 📈 +0.08%
Statements 98.00% 98.07% 📈 +0.07%
Functions 99.52% 99.52% ➡️ +0.00%
Branches 93.71% 93.81% 📈 +0.10%
📁 Per-file Coverage Changes (2 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/container-startup-diagnostics.ts 95.9% → 98.6% (+2.70%) 96.1% → 98.7% (+2.60%)

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

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Claude Engine

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

Overall result: PASS

Generated by Smoke Claude for issue #5474 · 61 AIC · ⊞ 3.1K ·

@github-actions

Copy link
Copy Markdown
Contributor Author

🤖 Smoke Test Results — PASS

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

PR: [Test Coverage] container-startup-diagnostics coverage
Author: @github-actions[bot]

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Gemini Engine Validation

  • GitHub MCP Testing: ❌ (Attempting to list PRs)
  • GitHub.com Connectivity: ❌ (HTTP 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

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test Results: Copilot BYOK (Direct) Mode

Status: ✅ PASS

Tests:

  • ✅ GitHub MCP connectivity (verified)
  • ✅ File write/read test (artifact present)
  • ✅ Inference via BYOK (processing this response)
  • ✅ GitHub.com accessibility (HTTP 200)

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy → api.githubcopilot.com.

cc: @lpcox @Copilot

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

Copy link
Copy Markdown
Contributor Author

🔥 Smoke Test: Copilot PAT — PASS

Test Result
GitHub MCP connectivity
GitHub.com connectivity
File write/read /tmp/gh-aw/agent/smoke-test-copilot-pat-28108499108.txt

Overall: PASS — Auth mode: PAT (COPILOT_GITHUB_TOKEN)

PR: [Test Coverage] container-startup-diagnostics coverage — author @github-actions[bot]

🔑 PAT report filed by Smoke Copilot PAT

@github-actions

Copy link
Copy Markdown
Contributor Author

🔬 Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Result Detail
S1: Module Loading otel.js loads; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled + test helpers. isEnabled() returns true on init.
S2: Test Suite 59 tests passed, 0 failed across 2 suites (otel.test.js, otel-fanout.test.js). Covers span creation, token attributes, serialization, exporters, parent context, graceful degradation.
S3: Env Var Forwarding 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. Tests in agent-environment-credentials.test.ts.
S4: Token Tracker Integration onUsage callback present in token-tracker-http.js:324. proxy-request.js calls otel.startRequestSpan, otel.setTokenAttributes, otel.endSpan, otel.endSpanError on every proxied request.
S5: OTEL Diagnostics No spans exported (no api-proxy running during smoke test — expected). File fallback path (/var/log/api-proxy/otel.jsonl) confirmed in code.

All 5 scenarios passed. OTEL tracing integration is complete and functional.

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions github-actions Bot mentioned this pull request Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

@github-actions[bot]
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)

  • [Test Coverage] container-startup-diagnostics coverage — ✅
  • docs: sync schemas and specs with source changes — ✅
  • GitHub.com connectivity — ✅
  • File I/O test — ✅
  • BYOK inference — ✅
    Overall: 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 ❌ NO
Node.js v24.17.0 v22.23.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

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

Tested by Smoke Chroot

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke test results: PASS
✅ GitHub PRs: fix(chroot): mount binaries overlay at /host/tmp/awf-runner-bin to avoid read-only /host/usr collision on ARC/DinD; fix: de-flake docker-host staging tests (parallel-worker race on /tmp/gh-aw)
✅ GitHub title verified
✅ File write/read verified
✅ Discussion comment posted
✅ Build npm ci && npm run build

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

🏗️ 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 #5474 · 40.7 AIC · ⊞ 7.7K ·

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Services Connectivity

Check Result
Redis PING ❌ timeout (no response)
PostgreSQL pg_isready ❌ no response
PostgreSQL SELECT 1 ❌ timeout

Overall: FAIL

host.docker.internal resolves to 172.17.0.1 but all service ports (6379, 5432) are unreachable — service containers may not be running or network routing is blocked.

🔌 Service connectivity validated by Smoke Services

@github-actions

Copy link
Copy Markdown
Contributor Author

@github-actions[bot]

✅ GitHub MCP Testing
✅ GitHub.com Connectivity
✅ File Write/Read Test
✅ BYOK Inference Test

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 status: PASS

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

@lpcox
lpcox merged commit f5b7beb into main Jun 24, 2026
88 of 90 checks passed
@lpcox
lpcox deleted the test-coverage/container-startup-diagnostics-ca4da4fddd2a2c1d branch June 24, 2026 16:02
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