conductor-oss / conductor-oss/ruby-sdk

decide() DSL hardcodes value-param evaluator — JavaScript evaluator unreachable

Open Beginner friendly
#24 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Ruby
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Summary

The `decide()` DSL method hardcodes `evaluator_type = 'value-param'` for all SWITCH tasks. Users who need a JavaScript expression evaluator must construct `WorkflowTask` manually — there is no way to express this through the builder.

Tested against: **Conductor OSS 3.32.0-rc.9**

## Root Cause

```ruby
# lib/conductor/workflow/dsl/task_ref.rb:110-111
def apply_switch_fields(wf_task)
wf_task.evaluator_type = 'value-param' # hardcoded — cannot be 'javascript'
...
end
```

`workflow_builder.rb#add_switch_task` passes no `evaluator_type` in options; `apply_switch_fields` ignores any such option and hardcodes `'value-param'`.

The server supports two evaluator types for SWITCH:
- `"value-param"` — compares `inputParameters.switchCaseValue` against case strings
- `"javascript"` — evaluates a full JavaScript expression and matches the result against cases

## Impact

Users who want to branch on a computed value (not a simple reference comparison) cannot use the `decide` DSL. They must construct the task definition raw.

## Fix

Thread `evaluator_type` through from `decide()`:

```ruby
# workflow_builder.rb
def decide(expression, evaluator_type: 'value-param', &block)
builder = SwitchBuilder.new(resolve_value(expression), self)
builder.instance_eval(&block)
add_switch_task(builder, evaluator_type: evaluator_type)
end

def add_switch_task(builder, evaluator_type: 'value-param')
task_ref = TaskRef.new(
...
options: {
expression: builder.expression,
evaluator_type: evaluator_type, # ← pass through
decision_cases: builder.cases,
default_case: builder.default
}
)
...
end

# task_ref.rb
def apply_switch_fields(wf_task)
wf_task.evaluator_type = @options[:evaluator_type] || 'value-param'
...
end
```

Related: JavaScript SDK [#139](https://github.com/conductor-oss/javascript-sdk/issues/139) — same gap.

Contributor guide

Open the contributing guide

Research direction

Read lib/conductor/workflow/dsl/task_ref.rb at apply_switch_fields and workflow_builder.rb at decide and add_switch_task. Trace how switch options reach WorkflowTask, then verify that the default remains value-param and that selecting javascript produces the corresponding evaluator type for the built SWITCH task.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, ruby
Domain
api, backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.