Spun out from closed PR #1282 (3 features bundled — landing them one at a time).
What
Two ergonomic improvements to the existing condition-evaluator.ts used by when: clauses on DAG nodes:
- Shorthand path — accept
$nodeId.field as equivalent to $nodeId.output.field. Today you must write the full .output. segment.
- Unquoted RHS for numbers and booleans — accept
$nodeId.exit_code == 0 and $nodeId.passed == true. Today only single-quoted string literals are accepted on the right-hand side, even for numeric comparisons.
Why
Both reduce friction when authoring when: clauses. Number comparisons especially read awkwardly today: $test.exit_code > '0' quotes a number as a string and relies on the evaluator's coercion path.
Scope boundary
- Atom regex change only — the existing AND/OR splitter, the
resolveOutputRef helper, and the numeric coercion path stay exactly as they are.
- No new operators, no parentheses, no function calls.
- No semantic change for existing expressions — every currently-valid
when: clause must continue to evaluate identically.
Reference implementation
@Dev-Force already implemented this in PR #1282. Suggested regex (lifted from their diff):
const atomPattern =
/^\$([a-zA-Z_][a-zA-Z0-9_-]*)\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z_][a-zA-Z0-9_]*))?\s*(==|!=|<=|>=|<|>)\s*(?:'([^']*)'|(-?\d+(?:\.\d+)?|true|false))$/;
Then in evaluateAtom:
- If
segment1 === 'output', effective field is segment2 (canonical form preserved)
- Else effective field is
segment1 (shorthand path)
- Reject
$nodeId.field.subfield (shorthand can't have a sub-field)
- Quoted RHS takes precedence; unquoted RHS covers numbers + booleans
Acceptance
- Test coverage in
condition-evaluator.test.ts for: shorthand path, sub-field rejection on shorthand, unquoted integer RHS, unquoted decimal RHS, unquoted true/false, mixed quoted+unquoted inside AND/OR compounds.
- No regressions in existing tests.
Suggested PR title
feat(workflows/condition-evaluator): support shorthand path and unquoted numeric/boolean RHS
Spun out from closed PR #1282 (3 features bundled — landing them one at a time).
What
Two ergonomic improvements to the existing
condition-evaluator.tsused bywhen:clauses on DAG nodes:$nodeId.fieldas equivalent to$nodeId.output.field. Today you must write the full.output.segment.$nodeId.exit_code == 0and$nodeId.passed == true. Today only single-quoted string literals are accepted on the right-hand side, even for numeric comparisons.Why
Both reduce friction when authoring
when:clauses. Number comparisons especially read awkwardly today:$test.exit_code > '0'quotes a number as a string and relies on the evaluator's coercion path.Scope boundary
resolveOutputRefhelper, and the numeric coercion path stay exactly as they are.when:clause must continue to evaluate identically.Reference implementation
@Dev-Force already implemented this in PR #1282. Suggested regex (lifted from their diff):
Then in
evaluateAtom:segment1 === 'output', effective field issegment2(canonical form preserved)segment1(shorthand path)$nodeId.field.subfield(shorthand can't have a sub-field)Acceptance
condition-evaluator.test.tsfor: shorthand path, sub-field rejection on shorthand, unquoted integer RHS, unquoted decimal RHS, unquotedtrue/false, mixed quoted+unquoted inside AND/OR compounds.Suggested PR title
feat(workflows/condition-evaluator): support shorthand path and unquoted numeric/boolean RHS