Skip to content

feat(workflow-executor): reject unknown condition executionType instead of coercing to Full AI - #1836

Open
Scra3 wants to merge 1 commit into
mainfrom
feature/prd-472-deterministic-decision-step
Open

feat(workflow-executor): reject unknown condition executionType instead of coercing to Full AI#1836
Scra3 wants to merge 1 commit into
mainfrom
feature/prd-472-deterministic-decision-step

Conversation

@Scra3

@Scra3 Scra3 commented Aug 18, 2026

Copy link
Copy Markdown
Member

Why

A condition step whose executionType is outside the schema enum was silently coerced to fully-automated by the schema's .catch — the AI took the decision without any error or log. With the deterministic decision mode coming in PRD-472, an outdated executor receiving 'deterministic' would have silently handed the customer's explicitly-not-AI decision to the AI.

What

  • ConditionStepDefinitionSchema.executionType: dropped .catch(FullyAutomated) (kept .default for missing values) — unknown values now reject loudly, matching the trigger-action/load-related/guidance no-.catch precedent.
  • All step-definition mapper parses are wrapped in InvalidStepDefinitionError: a bare ZodError was only logged by getAvailableRuns and the run silently re-fetched every poll; it is now reported to the orchestrator as a malformed run.
  • Tests: condition schema 3-test template (valid modes / default / rejects unknown incl. 'deterministic'), mapper rejection test, and the mcp missing-mcpServerId assertion tightened to pin the mapTask wrapping.

Part of PRD-472. 'deterministic' is intentionally NOT added to StepExecutionMode: rejection is the correct behaviour until the condition evaluator ships.

Tests

Full workflow-executor suite: 1514 passed / 0 failed. Red-check: with src changes stashed, exactly the new behavioral tests fail.

🤖 Generated with Claude Code

Note

Reject unknown executionType values in condition step definitions instead of coercing to FullyAutomated

  • Removes .catch(FullyAutomated) from ConditionStepDefinitionSchema so that an unrecognized executionType now throws an error rather than silently coercing to FullyAutomated. Missing executionType still defaults to FullyAutomated.
  • Adds a parseStepDefinition helper in step-definition-mapper.ts that wraps schema.safeParse and converts Zod failures into InvalidStepDefinitionError with formatted issue details.
  • Replaces direct .parse() calls across all task and condition handlers with the new helper, so validation errors surface as InvalidStepDefinitionError instead of raw ZodError.
  • Behavioral Change: previously unknown executionType values were silently accepted; they now cause a hard failure.

Macroscope summarized 940a009.

…ad of coercing to Full AI

An out-of-enum executionType on a condition step was silently coerced to
fully-automated by the schema's .catch, handing the decision to the AI —
the exact opposite of the upcoming deterministic mode's intent (PRD-472).
The schema now rejects unknown values, and every mapper parse failure is
wrapped in InvalidStepDefinitionError so the orchestrator reports the run
as malformed instead of logging-and-dropping it on every poll.

Part of PRD-472

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

linear-code Bot commented Aug 18, 2026

Copy link
Copy Markdown

PRD-472

@qltysh

qltysh Bot commented Aug 18, 2026

Copy link
Copy Markdown

1 new issue

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

@qltysh

qltysh Bot commented Aug 18, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/workflow-executor/src/adapters/step-definition-mapper.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.

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