You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 18, 2026. It is now read-only.
The buildCommand() function in cli/src/internal/executor/command_builder.go and several MCP handler functions lack tests for nil struct inputs, zero-value configurations, and boundary conditions. While callers currently validate inputs before calling these functions, the absence of defensive tests means refactoring could introduce nil-pointer panics.
Impact
Nil pointer dereferences would crash the CLI or MCP server without a clear error message
Boundary conditions (extremely long paths, special characters in shell names) are untested
As the codebase grows, new callers may not replicate existing validation patterns
Specific Gaps
command_builder.go - buildCommand():
No test for nil Config struct
No test for empty shell name combined with failed OS detection
No test for shell path containing spaces or special characters
No test for extremely long script paths
mcp.go - handler functions:
handleExecScript: no test for nil CallToolRequest or nil Arguments
handleExecInline: no test for nil Arguments map
handleGetEnvironment: no test with completely empty environment
executor.go - prepareEnvironment():
No test for environment variable with = in the value (e.g., KEY=val=ue)
No test for environment variable with empty key
No test for duplicate environment variable keys
Recommendation
Add a TestBuildCommandBoundaryConditions table-driven test covering:
Nil/zero-value Config
Shell name with spaces
Very long script path (>260 chars on Windows)
Shell set to nonexistent binary
Add nil-input guards to MCP handler tests:
Nil request object
Request with nil Arguments map
Arguments with unexpected types (number where string expected)
Summary
The buildCommand() function in cli/src/internal/executor/command_builder.go and several MCP handler functions lack tests for nil struct inputs, zero-value configurations, and boundary conditions. While callers currently validate inputs before calling these functions, the absence of defensive tests means refactoring could introduce nil-pointer panics.
Impact
Specific Gaps
command_builder.go - buildCommand():
mcp.go - handler functions:
executor.go - prepareEnvironment():
Recommendation
Add a TestBuildCommandBoundaryConditions table-driven test covering:
Add nil-input guards to MCP handler tests:
Add environment edge case tests: