Repository navigation
[test] Add tests for cmd.setupWasmCompilationCache - #17014
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟢 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)
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
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.
|
Function Analyzed
internal/cmdsetupWasmCompilationCacheWhy 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
Coverage Report
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 uncachedserdedependency due the runner's crates.io TLS/SNI certificate boundary.golangci-lintwas 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.comnonexistent.localslow.example.comthishostdoesnotexist12345.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.