Skip to content

[test] Add tests for testutil.WriteSuccessGuardWasm - #16280

Merged
lpcox merged 1 commit into
mainfrom
test/testutil-success-guard-wasm-15053456b4386204
Nov 10, 2026
Merged

lpcox merged 1 commit into
mainfrom
test/testutil-success-guard-wasm-15053456b4386204

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Coverage Improvement: WriteSuccessGuardWasm

Function Analyzed

  • Package: internal/testutil
  • Function: WriteSuccessGuardWasm
  • Previous Coverage: 0% (package coverage 0%)
  • New Coverage: 75% (remaining 25% is the t.Fatalf error paths, unreachable with a constant embedded hex fixture)
  • Complexity: Low

Why This Function?

Coverage across internal/ is ~97%+. This was the only function at 0% coverage other than a trivial no-op logger. It's a shared fixture used by cmd and proxy tests. A broken fixture would silently break those tests.

Tests Added

  • ✅ File is written as guard.wasm, regular file, mode 0600
  • ✅ Valid WASM magic/version header
  • ✅ Distinct temp dir per call
  • ✅ Module compiles with wazero and exports label_resource, label_response, label_agent, and memory

Test Execution

--- PASS: TestWriteSuccessGuardWasm (0.00s)
coverage: 75.0% of statements

Generated by Test Coverage Improver

Warning

Firewall blocked 4 domains

The following domains were blocked by the firewall during workflow execution:

  • example.com
  • nonexistent.local
  • slow.example.com
  • thishostdoesnotexist12345.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"
    - "nonexistent.local"
    - "slow.example.com"
    - "thishostdoesnotexist12345.com"

See Network Configuration for more information.

Generated by Test Coverage Improver · copilot · auto (Claude Sonnet 5.5) · ~43 AIC · ⊞ 11.5K · ◷

@lpcox
lpcox marked this pull request as ready for review November 10, 2026 16:41
Copilot AI adaptive review requested due to automatic review settings November 10, 2026 16:41

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.

🟢 Approval recommended

No active issues were identified, and the focused tests cover the fixture’s file properties, WASM validity, isolation, and required exports.

No open issues 🎉

What changed in this PR

Adds focused unit tests for internal/testutil.WriteSuccessGuardWasm, validating the shared WASM fixture's file output and module structure.

Changes:

  • Verifies the fixture filename, permissions, regular-file status, and distinct temporary paths.
  • Validates the WASM header, wazero compilation, required guard exports, and memory export.
File Description
internal/​testutil/​success_guard_fixture_test.go Adds tests covering fixture creation, file properties, WASM validity, temporary-directory isolation, and wazero module exports.

Review effort: Lite (auto)

@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads data ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) n/a — tools absent from catalog BLOCKED ⚠️
C CLI reads data ALLOWED ✅
D CLI REST writes n/a — gh unauthenticated BLOCKED ⚠️
E CLI GraphQL mutations n/a — gh unauthenticated BLOCKED ⚠️

Overall: INCONCLUSIVE

Details:

  • Part A/C: all 4 MCP reads (list_issues, list_pull_requests, get_file_contents README.md, list_commits) returned data via the gateway-backed github CLI. 23 tools total in catalog, all read-only (list_/get_/search_*/issue_read/pull_request_read).
  • Part B: none of the targeted write tools (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) are present in the exposed tool catalog at all, so no write was attempted and no gateway-level refusal could be observed on this surface for this run — consistent with gh-aw’s GITHUB_READ_ONLY=1 backend wrapper noted in the task instructions.
  • Part D/E: gh auth status reported “You are not logged into any GitHub hosts” — unauthenticated, so REST/GraphQL write probes could not be attempted; no writes leaked.
  • No write succeeded on any surface in this run.

Full raw notes: /tmp/gh-aw/agent/readonly-stress-42856073507.txt

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox enabled auto-merge November 10, 2026 17:02
@lpcox
lpcox merged commit 201d730 into main Nov 10, 2026
28 checks passed
@lpcox
lpcox deleted the test/testutil-success-guard-wasm-15053456b4386204 branch November 10, 2026 17:04
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