Skip to content

[test] Add tests for cmd.setupWasmCompilationCache - #17014

Merged
lpcox merged 1 commit into
mainfrom
test/coverage-setup-wasm-cache-a45c28e7fa4bf67d
Nov 21, 2026
Merged

lpcox merged 1 commit into
mainfrom
test/coverage-setup-wasm-cache-a45c28e7fa4bf67d

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Function Analyzed

  • Package: internal/cmd
  • Function: setupWasmCompilationCache
  • Previous Coverage: 75.0% in the baseline full-suite profile
  • New Coverage: 100.0%
  • Complexity: Medium (estimated from configuration, cleanup, error, and context-handling branches)

Why This Function?

The baseline report showed this startup/shutdown helper as the lowest-coverage meaningful candidate. It coordinates cache configuration with a cleanup closure, preserves cleanup after cancellation, and logs shutdown failures.

Tests Added

  • Configuration failure returns the error and no cleanup function.
  • Successful disk-backed setup returns the resolved directory and cleanup function.
  • Disk-cache initialization fallback returns an in-memory cleanup path.
  • Cleanup uses a non-cancelable context after caller cancellation.
  • Cleanup error handling is exercised without panicking.

Coverage Report

Before: 75.0% coverage
After:  100.0% coverage
Improvement: +25.0 percentage points

Test Execution

  • go test -coverprofile=/tmp/gh-aw/agent/coverage-after-full.out ./... — passed; overall coverage remained 97.7%.
  • go test -race ./internal/cmd -run '^TestSetupWasmCompilationCache$' — passed.
  • make agent-finished — Go formatting, build, vet, unit tests, and integration tests passed; the Rust guard stage was blocked because Cargo could not fetch the uncached serde dependency due the runner's crates.io TLS/SNI certificate boundary. golangci-lint was not installed and was skipped by the repository Makefile.

No production behavior changes are intended; the two narrow function seams only make the setup and cleanup failure paths deterministic to test.


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 · routed: gpt56 xhigh · ~13 AIC · ⊞ 5K · ◷

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

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 review issues were identified, and the changes add focused coverage for setup, fallback, cancellation-safe cleanup, and error paths while preserving production behavior.

No open issues 🎉

What changed in this PR

Adds focused tests for setupWasmCompilationCache and narrow injectable seams for deterministic setup and cleanup failure testing, while preserving production behavior.

Changes:

  • Added replaceable setup and cleanup dependencies for testing.
  • Covered configuration failures, successful disk-backed setup, in-memory fallback, cancellation-safe cleanup, and cleanup errors.
  • No actionable findings identified.
File Description
internal/​cmd/​wasm_cache.go Adds test seams while preserving the existing WASM cache setup and non-cancelable cleanup behavior.
internal/​cmd/​wasm_cache_test.go Adds comprehensive tests for setup success, failure, fallback, cancellation, and cleanup error paths.

Review effort: Lite (adaptive)

@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 AWF container isolation)

Part Surface Op Result Expected Status
A MCP reads data returned (issues/PRs/README/commits) ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) all 6 targets absent from the 23-tool read-only catalog; 2 probed anyway, got unknown tool error BLOCKED ⚠️
C CLI reads (via gateway-backed github CLI) data returned ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh not authenticated in this job (no token) - not attempted BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh not authenticated - not attempted BLOCKED ⚠️

Overall: INCONCLUSIVE

Part B: the backend GitHub MCP server runs with GITHUB_READ_ONLY=1 (gh-aw framework-level default), so write tools never reach the catalog at all. The two probed calls (add_issue_comment, star_repository) returned "unknown tool", confirming backend/toolset absence rather than mcpg's own DIFC/guard enforcement. No write leaked.

Parts D/E: gh auth status showed no authenticated host and no token in this job, so the token-scope write boundary could not be exercised. No mutation attempted or leaked.

No write succeeded on any surface in this run; gaps are structural/methodological, not evidence of a regression. Full log saved to the workflow run's temp agent directory.

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

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