From 34e3b1ba83f362c7746bfad34dcb9679e4ad9897 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 14 Apr 2026 17:31:59 +0200 Subject: [PATCH 1/7] fix: correct return signal for if function --- crates/core/src/runtime/functions/control.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core/src/runtime/functions/control.rs b/crates/core/src/runtime/functions/control.rs index a601cf7..41ba2d3 100644 --- a/crates/core/src/runtime/functions/control.rs +++ b/crates/core/src/runtime/functions/control.rs @@ -62,7 +62,7 @@ fn r#if( ctx.push_runtime_trace_label("branch=if".to_string()); run(*if_pointer, ctx) } else { - Signal::Return(Value { + Signal::Success(Value { kind: Some(Kind::NullValue(0)), }) } From c007013e9c88e9d85fc62f16d7159a3271229a75 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 14 Apr 2026 17:32:12 +0200 Subject: [PATCH 2/7] fix: continue if test was successful --- crates/tests/src/main.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/crates/tests/src/main.rs b/crates/tests/src/main.rs index 29ae8c3..61561cf 100644 --- a/crates/tests/src/main.rs +++ b/crates/tests/src/main.rs @@ -51,29 +51,25 @@ impl Testable for Case { "name": err.name, "message": err.message, }); - return CaseResult::Failure(input, json); + if json != input.clone().expected_result { + return CaseResult::Failure(input, json); + } } taurus_core::context::signal::Signal::Success(value) => { let json = to_json_value(value); - if json == input.clone().expected_result { - return CaseResult::Success; - } else { + if json != input.clone().expected_result { return CaseResult::Failure(input, json); } } taurus_core::context::signal::Signal::Return(value) => { let json = to_json_value(value); - if json == input.clone().expected_result { - return CaseResult::Success; - } else { + if json != input.clone().expected_result { return CaseResult::Failure(input, json); } } taurus_core::context::signal::Signal::Respond(value) => { let json = to_json_value(value); - if json == input.clone().expected_result { - return CaseResult::Success; - } else { + if json != input.clone().expected_result { return CaseResult::Failure(input, json); } } From bbb75d8ff5c0c92bdf35d96d5dd5127da36247d3 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 14 Apr 2026 17:32:29 +0200 Subject: [PATCH 3/7] feat: adjusted tests to latest definition parameter names --- flows/01_return_object.json | 2 +- flows/02_return_flow_input.json | 4 ++-- flows/04_example_action.json | 7 ++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/flows/01_return_object.json b/flows/01_return_object.json index 80105fd..c6e8290 100644 --- a/flows/01_return_object.json +++ b/flows/01_return_object.json @@ -5,7 +5,7 @@ { "input": null, "expected_result": { - "status_code": 200, + "http_status_code": 200, "headers": { "Header": "X" }, diff --git a/flows/02_return_flow_input.json b/flows/02_return_flow_input.json index 3074d27..227f692 100644 --- a/flows/02_return_flow_input.json +++ b/flows/02_return_flow_input.json @@ -5,7 +5,7 @@ { "input": null, "expected_result": { - "status_code": 200, + "http_status_code": 200, "headers": { "Authentication": "X" }, @@ -23,7 +23,7 @@ ] }, "expected_result": { - "status_code": 200, + "http_status_code": 200, "headers": { "Authentication": "X" }, diff --git a/flows/04_example_action.json b/flows/04_example_action.json index c0b5c96..07256e8 100644 --- a/flows/04_example_action.json +++ b/flows/04_example_action.json @@ -5,11 +5,8 @@ { "input": null, "expected_result": { - "status_code": 200, - "headers": { - "Header": "X" - }, - "payload": "Hello World" + "message": "Remote runtime not configured", + "name": "RemoteRuntimeNotConfigured" } } ], From 0006e1051034b1c9e76c5d6c1465b2b934178865 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 14 Apr 2026 17:32:37 +0200 Subject: [PATCH 4/7] feat: added if and if-else as test cases --- flows/05_if_control.json | 220 ++++++++++++++++++++++++++++++++++ flows/06_if_else_control.json | 218 +++++++++++++++++++++++++++++++++ 2 files changed, 438 insertions(+) create mode 100644 flows/05_if_control.json create mode 100644 flows/06_if_else_control.json diff --git a/flows/05_if_control.json b/flows/05_if_control.json new file mode 100644 index 0000000..122a344 --- /dev/null +++ b/flows/05_if_control.json @@ -0,0 +1,220 @@ +{ + "name": "05_if_control", + "description": "This flow expects a object as input (from http request) structured payload.test = bool which the flow will return", + "inputs": [ + { + "input": { + "http_method": "GET", + "headers": { + "Content-Type": "text/plain" + }, + "payload": { + "test": 1 + } + }, + "expected_result": { + "message": "Expected a bool value but received [Eval(Value { kind: Some(NumberValue(NumberValue { number: Some(Integer(1)) })) }), Thunk(12)]", + "name": "InvalidArgumentRuntimeError" + } + }, + { + "input": { + "http_method": "GET", + "headers": { + "Content-Type": "text/plain" + }, + "payload": { + "test": false + } + }, + "expected_result": { + "http_status_code": 200, + "headers": {}, + "payload": "Blub" + } + }, + { + "input": { + "http_method": "GET", + "headers": { + "Content-Type": "text/plain" + }, + "payload": { + "test": true + } + }, + "expected_result": { + "http_status_code": 200, + "headers": {}, + "payload": true + } + } + ], + "flow": { + "flowId": "2", + "projectId": "1", + "type": "REST", + "settings": [ + { + "databaseId": "3", + "flowSettingId": "httpURL", + "value": { + "stringValue": "/test2" + } + }, + { + "databaseId": "4", + "flowSettingId": "httpMethod", + "value": { + "stringValue": "GET" + } + } + ], + "startingNodeId": "11", + "nodeFunctions": [ + { + "databaseId": "13", + "runtimeFunctionId": "rest::control::respond", + "parameters": [ + { + "databaseId": "57", + "runtimeParameterId": "http_response", + "value": { + "referenceValue": { + "nodeId": "14" + } + } + } + ] + }, + { + "databaseId": "14", + "runtimeFunctionId": "http::response::create", + "parameters": [ + { + "databaseId": "54", + "runtimeParameterId": "http_status_code", + "value": { + "literalValue": { + "numberValue": { + "integer": "200" + } + } + } + }, + { + "databaseId": "55", + "runtimeParameterId": "headers", + "value": { + "literalValue": { + "structValue": {} + } + } + }, + { + "databaseId": "56", + "runtimeParameterId": "payload", + "value": { + "literalValue": { + "stringValue": "Blub" + } + } + } + ], + "nextNodeId": "13" + }, + { + "databaseId": "11", + "runtimeFunctionId": "std::control::if", + "parameters": [ + { + "databaseId": "49", + "runtimeParameterId": "condition", + "value": { + "referenceValue": { + "paths": [ + { + "path": "payload" + }, + { + "path": "test" + } + ], + "flowInput": {} + } + } + }, + { + "databaseId": "50", + "runtimeParameterId": "runnable", + "value": { + "nodeFunctionId": "12" + } + } + ], + "nextNodeId": "14" + }, + { + "databaseId": "15", + "runtimeFunctionId": "rest::control::respond", + "parameters": [ + { + "databaseId": "58", + "runtimeParameterId": "http_response", + "value": { + "referenceValue": { + "nodeId": "12" + } + } + } + ] + }, + { + "databaseId": "12", + "runtimeFunctionId": "http::response::create", + "parameters": [ + { + "databaseId": "51", + "runtimeParameterId": "http_status_code", + "value": { + "literalValue": { + "numberValue": { + "integer": "200" + } + } + } + }, + { + "databaseId": "52", + "runtimeParameterId": "headers", + "value": { + "literalValue": { + "structValue": {} + } + } + }, + { + "databaseId": "53", + "runtimeParameterId": "payload", + "value": { + "referenceValue": { + "paths": [ + { + "path": "payload" + }, + { + "path": "test" + } + ], + "flowInput": {} + } + } + } + ], + "nextNodeId": "15" + } + ], + "projectSlug": "codezero-project", + "signature": "(httpURL: HTTP_URL, httpMethod: HTTP_METHOD): { payload: { test: BOOLEAN }, headers: { test: TEXT } }" + } +} diff --git a/flows/06_if_else_control.json b/flows/06_if_else_control.json new file mode 100644 index 0000000..a1de557 --- /dev/null +++ b/flows/06_if_else_control.json @@ -0,0 +1,218 @@ +{ + "name": "06_if_else_control", + "description": "This flow expects a object as input (from http request) structured payload.test = bool which the flow will return", + "inputs": [ + { + "input": { + "http_method": "GET", + "headers": { + "Content-Type": "text/plain" + }, + "payload": { + "test": 1 + } + }, + "expected_result": { + "message": "Expected a bool value but received [Eval(Value { kind: Some(NumberValue(NumberValue { number: Some(Integer(1)) })) }), Thunk(19), Thunk(17)]", + "name": "InvalidArgumentRuntimeError" + } + }, + { + "input": { + "http_method": "GET", + "headers": { + "Content-Type": "text/plain" + }, + "payload": { + "test": true + } + }, + "expected_result": { + "http_status_code": 200, + "headers": {}, + "payload": "Blub" + } + }, + { + "input": { + "http_method": "GET", + "headers": { + "Content-Type": "text/plain" + }, + "payload": { + "test": false + } + }, + "expected_result": { + "http_status_code": 200, + "headers": {}, + "payload": "Blob" + } + } + ], + "flow": { + "flowId": "3", + "projectId": "1", + "type": "REST", + "settings": [ + { + "databaseId": "5", + "flowSettingId": "httpURL", + "value": { + "stringValue": "/test3" + } + }, + { + "databaseId": "6", + "flowSettingId": "httpMethod", + "value": { + "stringValue": "GET" + } + } + ], + "startingNodeId": "16", + "nodeFunctions": [ + { + "databaseId": "19", + "runtimeFunctionId": "http::response::create", + "parameters": [ + { + "databaseId": "51", + "runtimeParameterId": "http_status_code", + "value": { + "literalValue": { + "numberValue": { + "integer": "200" + } + } + } + }, + { + "databaseId": "78", + "runtimeParameterId": "headers", + "value": { + "literalValue": { + "structValue": {} + } + } + }, + { + "databaseId": "79", + "runtimeParameterId": "payload", + "value": { + "literalValue": { + "stringValue": "Blub" + } + } + } + ], + "nextNodeId": "20" + }, + { + "databaseId": "20", + "runtimeFunctionId": "rest::control::respond", + "parameters": [ + { + "databaseId": "76", + "runtimeParameterId": "http_response", + "value": { + "referenceValue": { + "nodeId": "19" + } + } + } + ] + }, + { + "databaseId": "16", + "runtimeFunctionId": "std::control::if_else", + "parameters": [ + { + "databaseId": "62", + "runtimeParameterId": "condition", + "value": { + "referenceValue": { + "paths": [ + { + "path": "payload" + }, + { + "path": "test" + } + ], + "flowInput": {} + } + } + }, + { + "databaseId": "63", + "runtimeParameterId": "runnable", + "value": { + "nodeFunctionId": "19" + } + }, + { + "databaseId": "68", + "runtimeParameterId": "else_runnable", + "value": { + "nodeFunctionId": "17" + } + } + ] + }, + { + "databaseId": "17", + "runtimeFunctionId": "http::response::create", + "parameters": [ + { + "databaseId": "72", + "runtimeParameterId": "http_status_code", + "value": { + "literalValue": { + "numberValue": { + "integer": "200" + } + } + } + }, + { + "databaseId": "73", + "runtimeParameterId": "headers", + "value": { + "literalValue": { + "structValue": {} + } + } + }, + { + "databaseId": "75", + "runtimeParameterId": "payload", + "value": { + "literalValue": { + "stringValue": "Blob" + } + } + } + ], + "nextNodeId": "18" + }, + { + "databaseId": "18", + "runtimeFunctionId": "rest::control::respond", + "parameters": [ + { + "databaseId": "64", + "runtimeParameterId": "http_response", + "value": { + "referenceValue": { + "nodeId": "17" + } + } + } + ] + } + ], + "projectSlug": "codezero-project", + "signature": "(httpURL: HTTP_URL, httpMethod: HTTP_METHOD): { payload: { test: BOOLEAN }, headers: { test: TEXT } }" + } +} From f4878a718678f20864c05431ed5fc27711364128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raphael=20G=C3=B6tz?= <52959657+raphael-goetz@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:04:30 +0200 Subject: [PATCH 5/7] Update flows/05_if_control.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com> --- flows/05_if_control.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flows/05_if_control.json b/flows/05_if_control.json index 122a344..5d26fac 100644 --- a/flows/05_if_control.json +++ b/flows/05_if_control.json @@ -1,6 +1,6 @@ { "name": "05_if_control", - "description": "This flow expects a object as input (from http request) structured payload.test = bool which the flow will return", + "description": "This flow expects an object as input (from http request) structured payload.test = bool which the flow will return", "inputs": [ { "input": { From 8e632c3eef0656fe5aa75fb7e0ebc510d9f65a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raphael=20G=C3=B6tz?= <52959657+raphael-goetz@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:04:44 +0200 Subject: [PATCH 6/7] Update flows/06_if_else_control.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com> --- flows/06_if_else_control.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flows/06_if_else_control.json b/flows/06_if_else_control.json index a1de557..04e9d12 100644 --- a/flows/06_if_else_control.json +++ b/flows/06_if_else_control.json @@ -1,6 +1,6 @@ { "name": "06_if_else_control", - "description": "This flow expects a object as input (from http request) structured payload.test = bool which the flow will return", + "description": "This flow expects an object as input (from http request) structured payload.test = bool which the flow will return", "inputs": [ { "input": { From b07e1ccfc62414cba3afe55c6b8185631867de8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raphael=20G=C3=B6tz?= <52959657+raphael-goetz@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:05:29 +0200 Subject: [PATCH 7/7] Update crates/core/src/runtime/functions/control.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com> --- crates/core/src/runtime/functions/control.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/core/src/runtime/functions/control.rs b/crates/core/src/runtime/functions/control.rs index 41ba2d3..6be61e7 100644 --- a/crates/core/src/runtime/functions/control.rs +++ b/crates/core/src/runtime/functions/control.rs @@ -62,6 +62,7 @@ fn r#if( ctx.push_runtime_trace_label("branch=if".to_string()); run(*if_pointer, ctx) } else { + ctx.push_runtime_trace_label("branch=else".to_string()); Signal::Success(Value { kind: Some(Kind::NullValue(0)), })