Skip to content

feat(workflow-engine): Add TypedDicts for WorkflowValidator input format#110692

Open
kcons wants to merge 1 commit intomasterfrom
kcons/typeytime
Open

feat(workflow-engine): Add TypedDicts for WorkflowValidator input format#110692
kcons wants to merge 1 commit intomasterfrom
kcons/typeytime

Conversation

@kcons
Copy link
Member

@kcons kcons commented Mar 13, 2026

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

@kcons kcons requested review from a team as code owners March 13, 2026 22:12
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 13, 2026
@kcons kcons requested a review from ceorourke March 13, 2026 22:17
Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫶 - love the addition of types and stricter checking than before.

"name": data.get("name"),
) -> WorkflowInput:
workflow_payload: WorkflowInput = {
"name": data.get("name", ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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] = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants