[test-improver] Improve tests for guard package (WASM alloc/dealloc/call error paths) - #11286
Conversation
…paths Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds targeted WASM guard tests for alloc, dealloc, and function-call error paths.
Changes:
- Tests calls against closed WASM modules.
- Verifies error propagation and panic-free deallocation.
Show a summary per file
| File | Description |
|---|---|
internal/guard/wasm_parse_coverage_test.go |
Adds three WASM error-path tests. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
| // TestWasmDealloc_CallErrorIsLoggedNotPanicked covers the error-logging branch | ||
| // in wasmDealloc (when deallocFn.Call returns an error) and verifies it does | ||
| // not panic. | ||
| func TestWasmDealloc_CallErrorIsLoggedNotPanicked(t *testing.T) { |
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS Notes:
|
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Notes:
Overall: PASS References: §31915927593
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS Full ReportPart B detail: The gateway exposes exactly 22 read-only MCP tools. All 7 write tools ( Part D/E detail: The Note on Part B pass criterion: The refusals are "tool not found" ( Run: §31915927586
|
File analyzed
internal/guard/wasm_parse_coverage_test.go(tests forinternal/guard/wasm_exec.go)Improvements made
Added 3 new table-free unit tests exercising previously-uncovered error branches in the low-level WASM function-calling primitives, all using the existing
setupWasmGuardhelper and testifyrequire/assert:TestWasmAlloc_CallError— covers theallocFn.Callerror branch inwasmAlloc(distinct from the existing null-pointer and no-result branches), triggered by callingallocon an already-closed WASM module.TestWasmDealloc_CallErrorIsLoggedNotPanicked— covers thedeallocFn.Callerror-logging branch inwasmDealloc, verifying it degrades gracefully (logs, does not panic) when the underlying call fails.TestDecodeWasmCallResult_FunctionCallError— covers thefn.Callerror branch indecodeWasmCallResult, distinct from the existing negative-result-code test, by calling a function on a closed module.All new tests reuse the existing
allocGuardWasmtest fixture andsetupWasmGuardhelper already present in the file, so no new WASM binaries were needed.Coverage before/after (
internal/guardpackage)wasmAllocwasmDeallocdecodeWasmCallResultTest output