-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workflow parameter validation #1028
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to 5ab53f3 in 54 seconds
More details
- Looked at
123
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. skyvern/forge/sdk/workflow/models/parameter.py:141
- Draft comment:
Consider includingworkflow_permanent_id
when raisingInvalidWorkflowParameter
for better traceability. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment suggests an improvement in error handling by including more context in the exception. This is a valid suggestion as it can help in debugging and tracing issues. The comment is actionable and clear, suggesting a specific change to improve code quality.
The comment assumes thatworkflow_permanent_id
is available and relevant in this context. Without seeing the rest of the codebase, it's unclear if this is the case. The suggestion might not be feasible ifworkflow_permanent_id
is not accessible here.
Even ifworkflow_permanent_id
is not directly accessible, the suggestion highlights a potential area for improvement in error handling. It could prompt the author to consider how to include more context in exceptions, which is generally beneficial.
The comment is a valid suggestion for improving error handling by including more context in exceptions. It should be kept as it provides a clear and actionable improvement to the code.
Workflow ID: wflow_nWkvuV8LzmogLIVf
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
return value | ||
lower_case = str(value).lower() | ||
if lower_case in ["true", "false", "1", "0"]: | ||
raise InvalidWorkflowParameter(expected_parameter_type=self, value=str(value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition for raising InvalidWorkflowParameter
is incorrect. It should raise the exception if the value is NOT in ['true', 'false', '1', '0']
.
raise InvalidWorkflowParameter(expected_parameter_type=self, value=str(value)) | |
if lower_case not in ["true", "false", "1", "0"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on a3cbfde in 45 seconds
More details
- Looked at
83
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. skyvern/forge/sdk/workflow/service.py:9
- Draft comment:
InvalidWorkflowParameter
is not imported. Add it to handle validation errors properly. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_EixjYTMyQ1UlNpUu
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Add workflow parameter validation to ensure values match expected types, raising
InvalidWorkflowParameter
on mismatch.InvalidWorkflowParameter
exception inexceptions.py
for invalid parameter types.convert_value
inWorkflowParameterType
inparameter.py
to validate parameter types and raiseInvalidWorkflowParameter
.create_workflow_run_parameter
inservice.py
.WorkflowParameterNotFound
increate_workflow_run_parameter
if parameter ID is not found.value
type toAny
inconvert_value
andcreate_workflow_run_parameter
for flexibility.This description was created by for a3cbfde. It will automatically update as commits are pushed.