feat(workflow-engine): Add TypedDicts for WorkflowValidator input format#110692
feat(workflow-engine): Add TypedDicts for WorkflowValidator input format#110692
Conversation
saponifi3d
left a comment
There was a problem hiding this comment.
🫶 - love the addition of types and stricter checking than before.
| "name": data.get("name"), | ||
| ) -> WorkflowInput: | ||
| workflow_payload: WorkflowInput = { | ||
| "name": data.get("name", ""), |
There was a problem hiding this comment.
we might want to have the name error if it's an empty string. i believe there's a unique constraint on the names, so it could get a little 😵
| triggers: dict[str, Any] = {"logicType": "any-short", "conditions": []} | ||
| translated_filter_list = [] | ||
| triggers: DataConditionGroupInput = {"logicType": "any-short", "conditions": []} | ||
| translated_filter_list: list[DataConditionInput] = [] |
There was a problem hiding this comment.
🤔 should we have an DetectorTrigger, ActionFilterInput, WorkflowTriggerInput as detailed types? that way we can enforce stuff like a detectors conditions always must return a valid PriorityLevel? (not sure if there are other things we could enforce more strictly down, i feel like those might be helpful for folks making custom validators like the metric alert validator)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Backend Test FailuresFailures on
|

Allows us to lean on mypy a bit more for correctness.