Skip to content

refactor(workflow-executor): resolve a decision condition by its source type - #2067

Merged
christophebrun-forest merged 2 commits into
feature/prd-988-use-sub-workflow-end-as-a-decision-condition-inputfrom
feature/prd-2028-executor-resolve-a-sub-workflows-end-as-a
Nov 6, 2026
Merged

christophebrun-forest merged 2 commits into
feature/prd-988-use-sub-workflow-end-as-a-decision-condition-inputfrom
feature/prd-2028-executor-resolve-a-sub-workflows-end-as-a

Conversation

@christophebrun-forest

@christophebrun-forest christophebrun-forest commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Part of PRD-2028 (first of two PRs). No behaviour change.

Why

A deterministic Decision condition can only read a Get Data step today: the source resolution filters on ReadRecord steps. PRD-2028 adds a Sub-workflow's End as a source, and PRD-995 / PRD-996 will add more kinds. This PR makes the resolution take a source kind first, so each kind brings its own resolver.

What

  • DeterministicConditionSchema accepts an optional sourceType, limited to 'get-data' for now. Absent or null parses to 'get-data', which is all an older orchestrator sends, so the parsed type is never optional.
  • ConditionStepExecutor.resolveConditionValue is an exhaustive switch on sourceType: adding a kind to the enum fails to compile until its case exists. The Get Data code moves unchanged into resolveGetDataValue.
  • The "could not be resolved" warning now logs the sourceType, since the reason depends on which resolver ran.

Contract and rollout

  • The orchestrator (PRD-2029) will send sourceType: 'sub-workflow' for an End source. That value and its resolver come in the next PR.
  • An executor from this PR on rejects a sourceType it does not know (InvalidStepDefinitionError). An executor predating this PR does not: zod strips the unknown key, so it would read a Sub-workflow End condition as a Get Data one, find the source not reached, and route to the fallback. The executor-version floor in PRD-2029 is what keeps a new source kind off those executors.

Tests

Existing executor tests pass unchanged in substance; their deterministic steps now go through ConditionStepDefinitionSchema, like a real step does. Added:

  • the schema reads an absent or null sourceType as 'get-data', keeps an explicit one, and rejects an unknown kind;
  • the step-definition mapper turns an unknown kind into an InvalidStepDefinitionError;
  • an explicit 'get-data' resolves like an absent one.

🤖 Generated with Claude Code

Note

Resolve deterministic conditions by sourceType in workflow executor

  • Adds a sourceType field to deterministic conditions, validated against CONDITION_SOURCE_TYPES (only get-data) in step-definition.ts. Missing or null values default to get-data.
  • ConditionStepExecutor.resolveConditionValue now dispatches on sourceType in condition-step-executor.ts; the existing lookup is renamed to resolveGetDataValue.
  • Also adds sourceType to the server condition type in server-types.ts and updates docs and tests.
  • Behavioral Change: an unrecognized sourceType now throws InvalidStepDefinitionError, and schema parsing normalizes absent/null sourceType to get-data, which shows up in parsed-condition assertions.

Macroscope summarized 62740af.

…ce type

A condition carries an optional sourceType, absent meaning get-data, so later
source kinds plug in their own resolver. No behaviour change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 6, 2026

Copy link
Copy Markdown

PRD-2028

@qltysh

qltysh Bot commented Nov 6, 2026

Copy link
Copy Markdown

1 new issue

Tool Category Rule Count
qlty Structure Function with many returns (count = 4): resolveGetDataValue 1

@qltysh

qltysh Bot commented Nov 6, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
New file Coverage rating: A
...ges/workflow-executor/src/executors/condition-step-executor.ts100.0%
New file Coverage rating: A
packages/workflow-executor/src/types/validated/step-definition.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

… schema

A null or absent sourceType parses to get-data, resolution is an exhaustive
switch, and the unresolved-condition warning names the source type.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@christophebrun-forest
christophebrun-forest merged commit faacdaf into feature/prd-988-use-sub-workflow-end-as-a-decision-condition-input Nov 6, 2026
40 checks passed
@christophebrun-forest
christophebrun-forest deleted the feature/prd-2028-executor-resolve-a-sub-workflows-end-as-a branch November 6, 2026 13:50
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.

1 participant