Refactor duplicated main-action Jest harness into shared test utility - #6607
Conversation
main-action Jest harness into shared test utility
There was a problem hiding this comment.
Pull request overview
Refactors duplicated main-action Jest setup into a shared test utility.
Changes:
- Adds a shared configuration fixture and harness setup.
- Updates both test suites to consume the shared utility.
Show a summary per file
| File | Description |
|---|---|
src/commands/main-action.test-utils.ts |
Defines the shared fixture and harness. |
src/commands/main-action.test.ts |
Replaces duplicated setup with the harness. |
src/commands/main-action-coverage-gaps.test.ts |
Reuses the shared setup and fixture. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Medium
| interface MainActionHarnessDeps { | ||
| mockedPreflight: { applyConfigFilePrecedence: unknown }; | ||
| mockedValidateOptions: { validateOptions: unknown }; | ||
| mockedDockerManager: { setAwfDockerHost: unknown }; | ||
| mockedRedactSecrets: { redactSecrets: unknown }; |
| getOptionValueSource: jest.Mock; | ||
| } | ||
|
|
||
| export function setupMainActionTestHarness(deps: MainActionHarnessDeps): MainActionTestHarness { |
|
⏳ Copilot review left inline comments. @copilot To proceed:
|
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
✨ New Files (1 files)
Coverage comparison generated by |
|
@copilot Fix the code for all comments in this review thread. When a review comment includes a suggested change, apply the suggestion exactly. Do not make changes beyond what is described in the linked review thread. |
Both issues are addressed in commit Comment 1 (unknown types): Comment 2 (fs mocks): |
|
✅ Smoke Claude passed |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
🚀 Security Guard has started processing this pull request |
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅ |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤 |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
Smoke Test: Claude Engine Validation
Overall result: PASS
|
🔥 Smoke Test Results
Overall: PASS
|
|
EGRESS_RESULT allow=pass deny=pass
Overall status: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "example.com"See Network Configuration for more information.
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL —
|
Smoke Test: Copilot BYOK (Direct) Mode ✅ PASS
Running with
|
Chroot Version Comparison Results
Overall: ❌ FAILED — Node.js version mismatch between host (
|
|
✅ Refactor API proxy providers to share OIDC/static auth adapter scaffold Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
|
Smoke Test: FAIL (Connectivity/MCP issues) Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
|
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) Overall Status: PASS
|
🔬 Smoke Test: API Proxy OpenTelemetry Tracing
All 5 scenarios pass. OTEL tracing integration is fully functional with correct GenAI semantic conventions, parent context propagation, and graceful degradation when no endpoint is configured.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
🔥 Smoke Test Results — Docker Sbx
Overall: PARTIAL — MCP connectivity confirmed; pre-computed test data was not injected (template substitution issue in workflow).
|
|
@copilot fix this failing ci check https://github.com/github/gh-aw-firewall/pull/6607/checks?check_run_id=89842387886 |
I investigated the failing check but cannot access the GitHub API from this environment (DNS proxy blocks The most likely cause is the PR title check (
Could you update the PR title? I don't have a tool to edit it directly. All other CI checks should be passing. |
The two
main-actiontest suites carried duplicated harness setup (fs mocks, shared wrapper config fixture, and default dependency wiring inbeforeEach). This change centralizes that setup so both suites consume one source of truth and only keep suite-specific overrides.What changed
/home/runner/work/gh-aw-firewall/gh-aw-firewall/src/commands/main-action.test-utils.tswith:MAIN_ACTION_STUB_CONFIG(shared baselineWrapperConfigfixture)setupMainActionTestHarness(...)(shared default mock/spy wiring)/home/runner/work/gh-aw-firewall/gh-aw-firewall/src/commands/main-action.test.ts/home/runner/work/gh-aw-firewall/gh-aw-firewall/src/commands/main-action-coverage-gaps.test.tsSTUB_CONFIGand duplicatedbeforeEachdefault wiring in both suites.Refactor shape