Skip to content

Commit 90dd7cc

Browse files
committed
fix(engine): use safe composition model.
- null represents missing/undefined
1 parent f644b96 commit 90dd7cc

7 files changed

Lines changed: 63 additions & 9 deletions

File tree

src/workflows_mcp/engine/workflow_runner.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,16 @@ def _merge_workflow_inputs(
11631163

11641164
# Override with runtime inputs
11651165
if runtime_inputs:
1166-
merged.update(runtime_inputs)
1166+
for key, value in runtime_inputs.items():
1167+
# Fix: If value is explicitly None (null), check if we have a default
1168+
# If we have a default, we should preserve it instead of overwriting with None
1169+
if (
1170+
value is None
1171+
and key in workflow.inputs
1172+
and workflow.inputs[key].default is not None
1173+
):
1174+
continue
1175+
merged[key] = value
11671176

11681177
# Validate required inputs
11691178
missing = [

tests/snapshots/composition-child-calculator.json

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"outputs": {
3+
"child_stdout": "Workspace is DEFAULT_WORKSPACE"
4+
},
5+
"status": "success"
6+
}

tests/workflows/core/composition/_child-calculator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: composition-child-calculator
22
description: Child workflow for composition testing - performs simple arithmetic
3-
tags: [test, core, composition, child, helper]
3+
44
inputs:
55
number_a:
66
type: num
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: safe-model-child
2+
description: Child workflow with default input
3+
version: "1.0"
4+
5+
inputs:
6+
workspace:
7+
type: str
8+
description: Workspace path
9+
default: "DEFAULT_WORKSPACE"
10+
11+
blocks:
12+
- id: echo_workspace
13+
type: Shell
14+
inputs:
15+
command: echo "Workspace is {{inputs.workspace}}"
16+
working_dir: "{{tmp}}"
17+
18+
outputs:
19+
workspace:
20+
value: "{{blocks.echo_workspace.outputs.stdout}}"
21+
type: str
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: safe-model-parent
2+
description: Parent workflow passing null
3+
version: "1.0"
4+
tags: [test, composition, defaults]
5+
6+
inputs:
7+
workspace:
8+
type: str
9+
description: Workspace path
10+
required: false
11+
12+
blocks:
13+
- id: call_child
14+
type: Workflow
15+
inputs:
16+
workflow: safe-model-child
17+
inputs:
18+
workspace: "{{inputs.workspace}}"
19+
20+
outputs:
21+
child_stdout:
22+
value: "{{blocks.call_child.outputs.workspace}}"
23+
type: str

tests/workflows/templates/short-url-test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ blocks:
1010
inputs:
1111
url: "qtsone/workflows-mcp/pull/123"
1212
dry_run: true
13+
fetch_metadata: false
1314

1415
- id: verify_github_short
1516
type: Shell
@@ -43,6 +44,7 @@ blocks:
4344
inputs:
4445
url: "https://gitlab.com/owner/repo/-/merge_requests/456"
4546
dry_run: true
47+
fetch_metadata: false
4648

4749
- id: verify_gitlab_full
4850
type: Shell

0 commit comments

Comments
 (0)