Skip to content

fix(aci): Validate workflow condition handler groups and boolean results - #129225

Open
sentry-junior[bot] wants to merge 5 commits into
masterfrom
kc/workflow-validate-condition-groups
Open

sentry-junior[bot] wants to merge 5 commits into
masterfrom
kc/workflow-validate-condition-groups

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

The workflow API accepted trigger and action filter conditions that can never evaluate, so the alert saves fine and then silently never fires. Workflow validation now rejects two such cases:

  • Conditions from the wrong handler group, such as detector operator conditions (gt, eq) used as triggers (SENTRY-5YNQ).
  • Non-boolean condition results, such as the string "true" (SENTRY-608Y). "true" and "false" are converted to booleans, and other values are rejected.

via @kcons.

--

View Session [Sentry]

Workflow triggers and action filters accepted any condition type, including
operator conditions such as gt that only make sense in detector condition
groups. At evaluation time those get compared against WorkflowEventData,
raise a TypeError, and the workflow silently never fires.

Require trigger conditions to come from the workflow_trigger handler group
and action filter conditions from the action_filter handler group.

Co-Authored-By: Kyle Consalus <6990351+kcons@users.noreply.github.com>
@sentry-junior
sentry-junior Bot requested a review from a team as a code owner October 29, 2026 18:16
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 29, 2026
Pass the trigger handler group as a field argument instead of a subclass so
the OpenAPI schema does not gain a new WorkflowTriggersValidator component.
@kcons
kcons marked this pull request as draft October 29, 2026 18:32
sentry-junior Bot and others added 2 commits November 17, 2026 20:10
…e-condition-groups

Co-Authored-By: Kyle Consalus <6990351+kcons@users.noreply.github.com>

# Conflicts:
#	src/sentry/workflow_engine/endpoints/validators/base/workflow.py
Workflow trigger and action filter conditions only produce a boolean, but
the API accepted any JSON value for conditionResult. A stored string like
"true" makes DataCondition.get_condition_result() return a ConditionError,
so the condition never matches and the alert silently stops firing.

The validator now turns "true"/"false" into booleans for those handler
groups and rejects any other non-boolean value. Detector conditions are
unchanged.

Fixes SENTRY-608Y

Co-Authored-By: Kyle Consalus <6990351+kcons@users.noreply.github.com>
@sentry-junior sentry-junior Bot changed the title fix(aci): Reject conditions from the wrong handler group in workflow API fix(aci): Validate workflow condition handler groups and boolean results Nov 17, 2026
Every registered condition handler sets group. The getattr fallback only
covered two test mocks that didn't, so give them a group instead.

Co-Authored-By: Kyle Consalus <6990351+kcons@users.noreply.github.com>
@kcons
kcons marked this pull request as ready for review November 19, 2026 01:18
@kcons
kcons requested a review from a team November 19, 2026 01:19

This branch has not been deployed

No deployments
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.

1 participant