chore(tasks): add validation tests for shell_execute command params#55064
chore(tasks): add validation tests for shell_execute command params#55064VojtechBartos wants to merge 2 commits into
Conversation
Prompt To Fix All With AIThis is a comment left during a code review.
Path: products/tasks/backend/tests/test_api.py
Line: 2437-2444
Comment:
**Missing boundary test for `timeoutMs = 0`**
The validator rejects `timeout_ms <= 0`, so zero is an invalid value, but the parameterized suite only tests `-1` (negative) and `600001` (above max). Adding `0` as a case documents that the inclusive lower-bound is rejected:
```suggestion
(
"shell_execute_negative_timeout",
{
"jsonrpc": "2.0",
"method": "shell_execute",
"params": {"command": "ls", "timeoutMs": -1},
},
),
(
"shell_execute_zero_timeout",
{
"jsonrpc": "2.0",
"method": "shell_execute",
"params": {"command": "ls", "timeoutMs": 0},
},
),
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "chore: update OpenAPI generated types" | Re-trigger Greptile |
| ( | ||
| "shell_execute_negative_timeout", | ||
| { | ||
| "jsonrpc": "2.0", | ||
| "method": "shell_execute", | ||
| "params": {"command": "ls", "timeoutMs": -1}, | ||
| }, | ||
| ), |
There was a problem hiding this comment.
Missing boundary test for
timeoutMs = 0
The validator rejects timeout_ms <= 0, so zero is an invalid value, but the parameterized suite only tests -1 (negative) and 600001 (above max). Adding 0 as a case documents that the inclusive lower-bound is rejected:
| ( | |
| "shell_execute_negative_timeout", | |
| { | |
| "jsonrpc": "2.0", | |
| "method": "shell_execute", | |
| "params": {"command": "ls", "timeoutMs": -1}, | |
| }, | |
| ), | |
| ( | |
| "shell_execute_negative_timeout", | |
| { | |
| "jsonrpc": "2.0", | |
| "method": "shell_execute", | |
| "params": {"command": "ls", "timeoutMs": -1}, | |
| }, | |
| ), | |
| ( | |
| "shell_execute_zero_timeout", | |
| { | |
| "jsonrpc": "2.0", | |
| "method": "shell_execute", | |
| "params": {"command": "ls", "timeoutMs": 0}, | |
| }, | |
| ), |
Prompt To Fix With AI
This is a comment left during a code review.
Path: products/tasks/backend/tests/test_api.py
Line: 2437-2444
Comment:
**Missing boundary test for `timeoutMs = 0`**
The validator rejects `timeout_ms <= 0`, so zero is an invalid value, but the parameterized suite only tests `-1` (negative) and `600001` (above max). Adding `0` as a case documents that the inclusive lower-bound is rejected:
```suggestion
(
"shell_execute_negative_timeout",
{
"jsonrpc": "2.0",
"method": "shell_execute",
"params": {"command": "ls", "timeoutMs": -1},
},
),
(
"shell_execute_zero_timeout",
{
"jsonrpc": "2.0",
"method": "shell_execute",
"params": {"command": "ls", "timeoutMs": 0},
},
),
```
How can I resolve this? If you propose a fix, please make it concise.|
Size Change: 0 B Total Size: 129 MB ℹ️ View Unchanged
|
Storybook visual regression tests failedIf your changes intentionally update UI snapshots: add the If you didn't change any UI: this is likely a flaky snapshot — wait for a fix to land on master. |
eb5e553 to
ce694a1
Compare
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
Problem
The
shell_executecommand was added to the task run command proxy but lacked thorough validation test coverage for its parameters (cwd,timeoutMs,executionId).Changes
shell_executecommand validation inTaskRunCommandRequestSerializerforcommand,cwd,timeoutMs, andexecutionIdparamsshell_executeexecutionId, too-long executionId
How did you test this code?
Together with related Posthog Code change
Publish to changelog?
No
Docs update
N/A