Skip to content

test: add --block-domains integration tests#1051

Merged
Mossaka merged 2 commits intomainfrom
test/block-domains-tests
Feb 25, 2026
Merged

test: add --block-domains integration tests#1051
Mossaka merged 2 commits intomainfrom
test/block-domains-tests

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 25, 2026

Summary

  • Add blockDomains?: string[] option to AwfRunner test fixture in tests/fixtures/awf-runner.ts
  • Add --block-domains flag handling in both run() and runWithSudo() methods
  • Add 6 integration tests for the --block-domains deny-list feature in tests/integration/blocked-domains.test.ts

Test Coverage

  • Block specific subdomain while allowing parent domain (--allow-domains github.com --block-domains api.github.com)
  • Allow non-blocked subdomains when parent is allowed
  • Block takes precedence over allow (same domain in both lists)
  • Wildcard blocking patterns (--block-domains *.github.com)
  • Multiple blocked domains
  • Debug output shows blocked domains configuration

Test plan

  • TypeScript compiles cleanly
  • npm run lint passes (0 errors)
  • npm run build passes
  • Integration tests verified locally (3/6 passed, 3 failed due to Docker container conflicts from concurrent test runs - not related to test logic)

Closes #1041

🤖 Generated with Claude Code

Add blockDomains option to AwfRunner test fixture and integration tests
for the --block-domains deny-list feature:

- Block specific subdomain while allowing parent domain
- Block takes precedence over allow
- Wildcard blocking patterns (*.github.com)
- Multiple blocked domains
- Debug output verification

Closes #1041

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 25, 2026 20:12
@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.39% 82.54% 📈 +0.15%
Statements 82.32% 82.46% 📈 +0.14%
Functions 82.74% 82.74% ➡️ +0.00%
Branches 74.55% 74.65% 📈 +0.10%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 83.6% → 84.1% (+0.56%) 82.8% → 83.4% (+0.54%)

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

@github-actions
Copy link
Contributor

Go Build Test Results

Project Download Tests Status
color 1/1 PASS
env 1/1 PASS
uuid 1/1 PASS

Overall: ✅ PASS

Generated by Build Test Go for issue #1051

@github-actions
Copy link
Contributor

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS 🎉

All C++ projects configured and built successfully with GCC 13.3.0.

Generated by Build Test C++ for issue #1051

@github-actions
Copy link
Contributor

Smoke Test Results — PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1051

@github-actions
Copy link
Contributor

Bun Build Test Results

Project Install Tests Status
elysia 1/1 PASS
hono 1/1 PASS

Overall: ✅ PASS

Bun version: 1.3.9

Generated by Build Test Bun for issue #1051

@github-actions
Copy link
Contributor

.NET Build Test Results

Project Restore Build Run Status
hello-world PASS
json-parse PASS

Overall: PASS

Run output

hello-world: Hello, World!

json-parse:

{
  "Name": "AWF Test",
  "Version": 1,
  "Success": true
}
Name: AWF Test, Success: True

Generated by Build Test .NET for issue #1051

@github-actions
Copy link
Contributor

Deno Build Test Results

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: ✅ PASS

Generated by Build Test Deno for issue #1051

@github-actions
Copy link
Contributor

🦀 Rust Build Test Results

Project Build Tests Status
fd 1/1 PASS
zoxide 1/1 PASS

Overall: ✅ PASS

Generated by Build Test Rust for issue #1051

@github-actions
Copy link
Contributor

Node.js Build Test Results ✅

Project Install Tests Status
clsx PASS
execa PASS
p-limit PASS

Overall: PASS

Generated by Build Test Node.js for issue #1051

@github-actions
Copy link
Contributor

Smoke Test Results (Copilot engine, run 22414057589)

Test Result
GitHub MCP — last 2 merged PRs #1036 docs: add integration test coverage guide with gap analysis, #1035 feat: group --help flags by category, hide dev-only options
Playwright — github.com title contains "GitHub"
File write /tmp/gh-aw/agent/smoke-test-copilot-22414057589.txt
Bash cat verify

Overall: PASS@Mossaka (no assignees)

📰 BREAKING: Report filed by Smoke Copilot for issue #1051

Copy link
Contributor

Copilot AI left a comment

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 adds comprehensive integration test coverage for the --block-domains CLI flag, which implements a deny-list on top of the existing allow-list functionality. The tests verify that blocked domains take precedence over allowed domains, support wildcard patterns, and work correctly with multiple domains.

Changes:

  • Added blockDomains?: string[] option to AwfOptions interface in test fixture
  • Implemented --block-domains flag handling in both run() and runWithSudo() test helper methods
  • Added 6 integration tests covering blocking behavior, precedence rules, wildcards, and debug output

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/fixtures/awf-runner.ts Added blockDomains option to AwfOptions interface and implemented flag handling in both run() and runWithSudo() methods
tests/integration/blocked-domains.test.ts Added new test suite "Block Domains Deny-List (--block-domains)" with 6 integration tests covering subdomain blocking, precedence, wildcards, multiple domains, and debug output

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

Comment on lines 251 to 263
test('should handle multiple blocked domains', async () => {
const result = await runner.runWithSudo(
'bash -c "curl -f --max-time 10 https://api.github.com/zen 2>&1; echo exit=$?"',
{
allowDomains: ['github.com'],
blockDomains: ['api.github.com', 'raw.githubusercontent.com'],
logLevel: 'debug',
timeout: 60000,
}
);
expect(result.stdout).toContain('exit=');
expect(result.stdout).not.toContain('exit=0');
}, 120000);
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test verifies that multiple blocked domains can be configured, but only tests that one domain (api.github.com) is actually blocked. Consider testing both blocked domains to ensure the configuration works correctly for all entries. For example, you could use a bash command that tries to curl both api.github.com and raw.githubusercontent.com and verifies that both fail.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 85e27f7. Updated the test to curl both api.github.com and raw.githubusercontent.com, and added githubusercontent.com to allowDomains so the blocklist (not the allowlist) is what causes the failures.

@github-actions
Copy link
Contributor

Merged PRs: docs: add integration test coverage guide with gap analysis; feat: group --help flags by category, hide dev-only options

  1. GitHub MCP merged PRs ✅
  2. safeinputs-gh pr list ✅
  3. Playwright title ✅
  4. Tavily search ❌ (tool missing)
  5. File write ✅
  6. Cat verify ✅
  7. Discussion comment ✅
  8. Build ✅
    Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1051

@github-actions
Copy link
Contributor

Java Build Test Results

Project Compile Tests Status
gson 1/1 PASS
caffeine 1/1 PASS

Overall: PASS

Generated by Build Test Java for issue #1051

Address Copilot review: test both api.github.com and
raw.githubusercontent.com are blocked, and add githubusercontent.com
to allowDomains so the blocklist (not the allowlist) is what blocks them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

Deno Build Test Results

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: ✅ PASS

Generated by Build Test Deno for issue #1051

@github-actions
Copy link
Contributor

Go Build Test Results

Project Download Tests Status
color PASS ✅ PASS
env PASS ✅ PASS
uuid PASS ✅ PASS

Overall: ✅ PASS

Generated by Build Test Go for issue #1051

@github-actions
Copy link
Contributor

Build Test: Bun Results

Project Install Tests Status
elysia 1/1 PASS
hono 1/1 PASS

Overall: ✅ PASS

Tested with Bun v1.3.9.

Generated by Build Test Bun for issue #1051

@github-actions
Copy link
Contributor

.NET Build Test Results

Project Restore Build Run Status
hello-world PASS
json-parse PASS

Overall: PASS

Run output

hello-world: Hello, World!

json-parse:

{
  "Name": "AWF Test",
  "Version": 1,
  "Success": true
}
Name: AWF Test, Success: True

Generated by Build Test .NET for issue #1051

@github-actions
Copy link
Contributor

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS

Generated by Build Test C++ for issue #1051

@github-actions
Copy link
Contributor

🦀 Rust Build Test Results

Project Build Tests Status
fd 1/1 PASS
zoxide 1/1 PASS

Overall: ✅ PASS

Generated by Build Test Rust for issue #1051

@github-actions
Copy link
Contributor

Smoke Test Results — claude-sonnet-4-6

Test Result
GitHub MCP (last 2 merged PRs: #1036 "docs: add integration test coverage guide...", #1035 "chore: remove smoke-gemini workflow")
Playwright (github.com title contains "GitHub")
File write (smoke-test-claude-22415859966.txt)
Bash verify (cat file)

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1051

@github-actions
Copy link
Contributor

GitHub MCP (last 2 merged PRs): ✅
docs: add integration test coverage guide with gap analysis
feat: group --help flags by category, hide dev-only options
safeinputs-gh pr list: ✅
Remove --allow-full-filesystem-access flag
feat: add API proxy port 10004 for OpenCode engine
Playwright title check: ✅
Tavily search: ❌ (tool unavailable)
File write + cat: ✅
Discussion comment: ✅
Build (npm ci && npm run build): ✅
Overall status: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1051

@github-actions
Copy link
Contributor

🤖 Smoke test results for PR #1051 (@Mossaka):

✅ GitHub MCP — Last 2 merged PRs: #1036 "docs: add integration test coverage guide with gap analysis", #1035 "feat: group --help flags by category, hide dev-only options"
✅ Playwright — github.com title contains "GitHub"
✅ File write — /tmp/gh-aw/agent/smoke-test-copilot-22415860001.txt created
✅ Bash verify — file read back successfully

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot for issue #1051

@github-actions
Copy link
Contributor

🟢 Node.js Build Test Results

Project Install Tests Status
clsx All passed ✅ PASS
execa All passed ✅ PASS
p-limit All passed ✅ PASS

Overall: ✅ PASS

Generated by Build Test Node.js for issue #1051

@github-actions
Copy link
Contributor

☕ Java Build Test Results

Project Compile Tests Status
gson 1/1 PASS
caffeine 1/1 PASS

Overall: ✅ PASS

All Java projects compiled and passed their tests successfully via Maven with the AWF proxy.

Generated by Build Test Java for issue #1051

@Mossaka Mossaka merged commit 3715802 into main Feb 25, 2026
84 checks passed
@Mossaka Mossaka deleted the test/block-domains-tests branch February 25, 2026 22:45
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.

test: add --block-domains integration tests

2 participants