Skip to content

[Test Coverage] Improve test coverage for config-writer and logs-command-helpers#5713

Merged
lpcox merged 2 commits into
mainfrom
test-coverage/config-writer-logs-helpers-58fd29183c110fc3
Jun 30, 2026
Merged

[Test Coverage] Improve test coverage for config-writer and logs-command-helpers#5713
lpcox merged 2 commits into
mainfrom
test-coverage/config-writer-logs-helpers-58fd29183c110fc3

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Covers two security-critical files that were identified as below target coverage.

Changes

src/config-writer-branches.test.ts (modified)

  • Adds the SSL Bump initialization success path test — previously, only the failure paths (OpenSSL unavailable, non-Error rejection) were tested. This new test covers initSslDb being called, and the logger.info/logger.warn messages emitted after a successful CA generation.
  • Also imports initSslDb from the ssl-bump mock to enable assertions.

src/commands/logs-command-helpers.test.ts (new)

Tests for two uncovered branches in logs-command-helpers.ts:

findPolicyManifestForSource:

  • Returns null for a running source (type guard)
  • Returns null when source.path is undefined
  • Returns null when no manifest file exists at any candidate path
  • Reads and parses a manifest found at source.path/policy-manifest.json
  • Adds AWF_AUDIT_DIR/policy-manifest.json to candidates when the env var is set

runLogsCommand — enrichment path:

  • Verifies that loadAllLogs, enrichWithPolicyRules, and computeRuleStats are all called when findPolicyManifestForSource returns a non-null manifest co-located with the log source

Coverage Impact

File Before After
src/config-writer.ts 84.94% stmts 91.39% stmts
src/commands/logs-command-helpers.ts 88.52% stmts 96.72% stmts

Generated by Test Coverage Improver · 304.1 AIC · ⊞ 6K ·

- config-writer.ts: 84.94% → 91.39% statements
  - Add SSL Bump success path test (covers initSslDb call + success log messages)

- logs-command-helpers.ts: 88.52% → 96.72% statements
  - New test file: src/commands/logs-command-helpers.test.ts
  - findPolicyManifestForSource: null for running sources, null for missing path,
    manifest found at source.path, AWF_AUDIT_DIR candidate inclusion
  - runLogsCommand: policy manifest enrichment path (loadAllLogs, enrichWithPolicyRules,
    computeRuleStats all called when manifest is co-located with log source)

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

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

Improves branch/line coverage for two security-critical code paths: SSL Bump initialization in config-writer and policy-manifest–aware enrichment in logs-command-helpers, by adding targeted Jest tests for previously uncovered branches.

Changes:

  • Extend src/config-writer-branches.test.ts to exercise the SSL Bump initialization success path (including initSslDb being invoked).
  • Add src/commands/logs-command-helpers.test.ts to cover findPolicyManifestForSource candidate selection/early returns and the runLogsCommand enrichment path when a manifest is available.
Show a summary per file
File Description
src/config-writer-branches.test.ts Adds a success-path test for SSL Bump initialization and asserts initSslDb is called.
src/commands/logs-command-helpers.test.ts New tests covering policy-manifest discovery fallbacks and verifying the enrichment branch is executed in runLogsCommand.

Review details

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Low

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

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

@github-actions

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

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Claude passed

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Contribution Check completed successfully!

Contribution guidelines check complete for PR #5713: the changes are test-only, include appropriate tests alongside source files, use the expected src/ organization, and have a clear PR description. No comment needed.

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

🔌 Smoke Services — All services reachable! ✅

@github-actions

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

Copy link
Copy Markdown
Contributor Author

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

@github-actions

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

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions

Copy link
Copy Markdown
Contributor Author

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 98.39% 98.68% 📈 +0.29%
Statements 98.32% 98.59% 📈 +0.27%
Functions 99.55% 99.55% ➡️ +0.00%
Branches 94.41% 94.53% 📈 +0.12%
📁 Per-file Coverage Changes (3 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/config-writer.ts 84.9% → 91.4% (+6.45%) 84.9% → 91.4% (+6.45%)
src/commands/logs-command-helpers.ts 88.3% → 100.0% (+11.67%) 88.5% → 100.0% (+11.48%)

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

@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

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

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Copilot BYOK (Direct) Mode ✅

All tests passed at 2026-06-30 13:56:46 UTC

  • ✅ GitHub MCP: PR list verified (2 recent closed PRs)
  • ✅ GitHub.com: HTTP 200
  • ✅ File write/read: Smoke test marker created
  • ✅ BYOK inference: Direct mode via api-proxy → api.githubcopilot.com

Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY) with credential injection via sidecar

Result: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor Author

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

PR: [Test Coverage] Improve test coverage for config-writer and logs-command-helpers (@github-actions[bot])

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

Overall: PASS

🔑 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 Results

Test Result
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read ⚠️ Pre-step data unavailable (unresolved template)

PR: [Test Coverage] Improve test coverage for config-writer and logs-command-helpers
Author: @github-actions[bot]

Overall: PASS (MCP ✅, connectivity ✅, pre-step data not substituted)

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

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke test:

🔮 The oracle has spoken through Smoke Codex
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
1. Module Loading otel.js loads cleanly; exports: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled + test helpers
2. Test Suite 59/59 tests pass across otel.test.js + otel-fanout.test.js
3. 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 to the api-proxy container
4. Token Tracker Integration onUsage callback exists in token-tracker-http.js (finalizeHttpTracking, line 283/324) — confirmed OTEL hook point
5. OTEL Diagnostics File fallback exporter (/var/log/api-proxy/otel.jsonl) active when no OTLP endpoint configured; graceful degradation confirmed by test suite

All 5 scenarios pass. OTEL tracing integration is fully operational.

📡 OTel tracing validated by Smoke OTel Tracing
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.3
Node.js v24.17.0 v22.23.0
Go go1.22.12 go1.22.12

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

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

@github-actions

Copy link
Copy Markdown
Contributor Author

Smoke Test: Services Connectivity

Check Result
Redis PING ❌ Timeout (no response on port 6379)
PostgreSQL pg_isready ❌ No response on port 5432
PostgreSQL SELECT 1 ❌ Not attempted (pg_isready failed)

host.docker.internal resolves to 172.17.0.1 but neither service is reachable at that address.

Overall: FAIL — GitHub Actions service containers appear unreachable from this runner environment.

🔌 Service connectivity validated by Smoke Services
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 passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit 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 #5713 · 52.8 AIC · ⊞ 7.8K ·
Add label ready-for-aw to run again

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

Copy link
Copy Markdown
Contributor Author

Smoke Test Results

  • fix: update test assertions for gh-aw-actions v0.82.0 and github-mcp-server v1.5.0
  • chore: upgrade gh-aw extension to latest pre-release (v0.82.0)
  • GitHub MCP Testing: ✅
  • GitHub.com Connectivity: ✅
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅
    Overall status: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor Author

@github-actions[bot]

  • fix: pass host-gateway IP to iptables-init container for NAT bypass ✅
  • docs: sync schemas and specs with source changes ✅
  • GitHub.com connectivity ✅
  • File I/O test ✅
  • BYOK inference test ✅

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

@github-actions

Copy link
Copy Markdown
Contributor Author

@lpcox

Smoke Test Results:

  • GitHub MCP PR listing: ✅
  • GitHub.com connectivity: ✅
  • File write/read: ✅
  • 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)
Add label ready-for-aw to run again

@lpcox lpcox merged commit 98a5f88 into main Jun 30, 2026
86 of 88 checks passed
@lpcox lpcox deleted the test-coverage/config-writer-logs-helpers-58fd29183c110fc3 branch June 30, 2026 15:05
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