chore(tasks): add validation tests for shell_execute command params#55064
Open
VojtechBartos wants to merge 2 commits intomasterfrom
Open
chore(tasks): add validation tests for shell_execute command params#55064VojtechBartos wants to merge 2 commits intomasterfrom
VojtechBartos wants to merge 2 commits intomasterfrom
Conversation
Contributor
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 |
Comment on lines
+2437
to
+2444
| ( | ||
| "shell_execute_negative_timeout", | ||
| { | ||
| "jsonrpc": "2.0", | ||
| "method": "shell_execute", | ||
| "params": {"command": "ls", "timeoutMs": -1}, | ||
| }, | ||
| ), |
Contributor
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:
Suggested change
| ( | |
| "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.
Contributor
|
Size Change: 0 B Total Size: 130 MB ℹ️ View Unchanged
|
Contributor
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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