Skip to content

Workflow conditional branches - #15052

Merged
kriben merged 3 commits into
devfrom
workflow-conditional-branches
Oct 30, 2026
Merged

kriben merged 3 commits into
devfrom
workflow-conditional-branches

Conversation

@kriben

@kriben kriben commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@kriben
kriben force-pushed the workflow-conditional-branches branch 2 times, most recently from e158e77 to 865e071 Compare October 28, 2026 12:10
@kriben kriben self-assigned this Oct 28, 2026
@kriben
kriben requested a review from magnesj October 30, 2026 13:10
@magnesj

magnesj commented Oct 30, 2026

Copy link
Copy Markdown
Member

Automated code review (OCR)

28 files reviewed, 2 medium findings in RimWorkflowDefinitionTools.cpp.

Medium

  • RimWorkflowDefinitionTools.cpp:83-84 [bug]: If ref is an array with fewer than two items (e.g. ref: [task]), the field ends up empty. An empty field counts as a switch-branch guard (isSwitchBranch()), so a malformed field condition is silently read as a switch-branch condition, and the validation message is misleading.
    Recommendation: require exactly two items and report malformed input.

  • RimWorkflowDefinitionTools.cpp:1519 [bug]: Fields that have only enum or const and no type (e.g. a pydantic string Literal) are not treated as string fields. Text like true or 1 is then parsed as a bool or number and does not match the string labels.
    Recommendation: treat the field as a string when every enum/const value is a string.

@kriben

kriben commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

Both findings were valid and are fixed:

  • A ref array without exactly two items is no longer read as a switch-branch guard. It is flagged as malformed and validation reports "A field condition must refer to a task and an output field".
  • A field with only enum/const and all string values is now treated as a string field, so true and 1 stay strings.

Unit tests cover both cases.

Support taskmaestro conditional branches in the workflow editor:
- Read and write `when` guards and `first_of` alternatives in workflow definitions
- Validate guards, switch branch coverage and alternative types
- Draw switch tasks as diamonds, guards as control edges and skipped tasks greyed out
- Edit guards with Run When..., add alternatives when dropping on a connected input
- Report skipped tasks from the run helper
Allow list and dict outputs, including mapped task outputs, to be
collected into list inputs, and dicts to be merged into dict inputs,
matching taskmaestro's collect flattening. Label flattened members in
the graph and document the rules.
@kriben
kriben force-pushed the workflow-conditional-branches branch from dbb33cc to cbd8a0a Compare October 30, 2026 14:35
@kriben
kriben merged commit 5095b2e into dev Oct 30, 2026
23 checks passed
@kriben
kriben deleted the workflow-conditional-branches branch October 30, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants