Skip to content

add integration test flows - #16

Merged
yilmaztayfun merged 1 commit into
masterfrom
f/sprint24
Apr 28, 2026
Merged

add integration test flows#16
yilmaztayfun merged 1 commit into
masterfrom
f/sprint24

Conversation

@yilmaztayfun

Copy link
Copy Markdown
Contributor

No description provided.

@yilmaztayfun yilmaztayfun self-assigned this Apr 28, 2026
@yilmaztayfun
yilmaztayfun requested review from a team April 28, 2026 06:52

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @yilmaztayfun, your pull request is larger than the review limit of 150000 diff characters

@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 175 files, which is 25 over the limit of 150.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 78211bb7-b774-44ca-aa1c-d2a9f1e28b07

📥 Commits

Reviewing files that changed from the base of the PR and between fc80c95 and 3b0e575.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (175)
  • .gitignore
  • api-tests/error-boundary/error-boundary-test-workflow.http
  • api-tests/error-boundary/postman-error-boundary.json
  • api-tests/extended-tasks/extended-tasks-test-workflow.http
  • api-tests/extended-tasks/postman-extended-tasks.json
  • api-tests/flow-types/flow-types-test.http
  • api-tests/flow-types/postman-flow-types.json
  • api-tests/instance-management/instance-management-test-workflow.http
  • api-tests/instance-management/postman-instance-management.json
  • api-tests/lifecycle-transitions/lifecycle-transitions-test-workflow.http
  • api-tests/lifecycle-transitions/postman-lifecycle-transitions.json
  • api-tests/schema-data/postman-schema-data.json
  • api-tests/schema-data/schema-data-test-workflow.http
  • api-tests/subflow-orchestration/postman-subflow-orchestration.json
  • api-tests/subflow-orchestration/subflow-orchestration.http
  • api-tests/task-execution/postman-task-execution.json
  • api-tests/task-execution/task-execution-test-workflow.http
  • api-tests/version-consistency/postman-version-consistency.json
  • api-tests/version-consistency/version-consistency-test.http
  • api-tests/view-function-extension/postman-view-function-extension.json
  • api-tests/view-function-extension/view-function-extension-test-workflow.http
  • core/Extensions/view-function-extension/global-extension.json
  • core/Extensions/view-function-extension/requested-extension.json
  • core/Extensions/view-function-extension/src/GlobalExtensionMapping.csx
  • core/Extensions/view-function-extension/src/RequestedExtensionMapping.csx
  • core/Functions/view-function-extension/multi-task-function.json
  • core/Functions/view-function-extension/single-task-function.json
  • core/Functions/view-function-extension/src/FunctionMultiTask1Mapping.csx
  • core/Functions/view-function-extension/src/FunctionMultiTask2Mapping.csx
  • core/Functions/view-function-extension/src/FunctionOutputMapping.csx
  • core/Functions/view-function-extension/src/FunctionSingleTaskMapping.csx
  • core/Schemas/schema-data/schema-data-confirm-transition.json
  • core/Schemas/schema-data/schema-data-master.json
  • core/Tasks/error-boundary/error-http-task.json
  • core/Tasks/error-boundary/error-script-task.json
  • core/Tasks/extended-tasks/dapr-binding-task.json
  • core/Tasks/extended-tasks/dapr-http-task.json
  • core/Tasks/extended-tasks/dapr-pubsub-task.json
  • core/Tasks/extended-tasks/dapr-service-task.json
  • core/Tasks/extended-tasks/get-instances-task.json
  • core/Tasks/extended-tasks/human-task.json
  • core/Tasks/extended-tasks/notification-task.json
  • core/Tasks/extended-tasks/subprocess-task.json
  • core/Tasks/extended-tasks/trigger-transition-task.json
  • core/Tasks/flow-types/flow-types-script-task.json
  • core/Tasks/instance-management/instance-mgmt-script-task.json
  • core/Tasks/lifecycle-transitions/script-task.json
  • core/Tasks/schema-data/schema-data-script-task.json
  • core/Tasks/subflow-orchestration/subflow-script-task.json
  • core/Tasks/task-execution/get-instance-data-task.json
  • core/Tasks/task-execution/http-process-task.json
  • core/Tasks/task-execution/start-flow-task.json
  • core/Tasks/task-execution/task-exec-script-task.json
  • core/Tasks/version-consistency/version-consistency-script-task.json
  • core/Tasks/view-function-extension/vfe-http-task.json
  • core/Tasks/view-function-extension/vfe-script-task.json
  • core/Views/view-function-extension/html-view.json
  • core/Views/view-function-extension/json-view.json
  • core/Views/view-function-extension/markdown-view.json
  • core/Workflows/account-opening/account-opening-workflow.json
  • core/Workflows/collection-object-test/collection-object-test-workflow.json
  • core/Workflows/collection-object-test/src/AlwaysTrueRule.csx
  • core/Workflows/error-boundary/error-boundary-test-workflow.json
  • core/Workflows/error-boundary/src/AlwaysTrueRule.csx
  • core/Workflows/error-boundary/src/ErrorHttpMapping.csx
  • core/Workflows/error-boundary/src/IgnoreErrorMapping.csx
  • core/Workflows/error-boundary/src/InitErrorTestMapping.csx
  • core/Workflows/error-boundary/src/LogOnlyMapping.csx
  • core/Workflows/error-boundary/src/NotifyMapping.csx
  • core/Workflows/error-boundary/src/RollbackMapping.csx
  • core/Workflows/error-boundary/src/ThrowErrorMapping.csx
  • core/Workflows/extended-tasks/extended-tasks-test-workflow.json
  • core/Workflows/extended-tasks/src/AlwaysTrueRule.csx
  • core/Workflows/extended-tasks/src/DaprBindingMapping.csx
  • core/Workflows/extended-tasks/src/DaprHttpMapping.csx
  • core/Workflows/extended-tasks/src/DaprPubSubMapping.csx
  • core/Workflows/extended-tasks/src/DaprServiceMapping.csx
  • core/Workflows/extended-tasks/src/GetInstancesMapping.csx
  • core/Workflows/extended-tasks/src/HumanTaskMapping.csx
  • core/Workflows/extended-tasks/src/InitExtendedTaskMapping.csx
  • core/Workflows/extended-tasks/src/NotificationMapping.csx
  • core/Workflows/extended-tasks/src/SubProcessMapping.csx
  • core/Workflows/extended-tasks/src/TriggerTransitionMapping.csx
  • core/Workflows/flow-types/core-flow-test.json
  • core/Workflows/flow-types/src/AlwaysTrueRule.csx
  • core/Workflows/flow-types/src/CoreInitMapping.csx
  • core/Workflows/flow-types/src/SubProcessInitMapping.csx
  • core/Workflows/flow-types/subprocess-flow-test.json
  • core/Workflows/instance-management/instance-management-test-workflow.json
  • core/Workflows/instance-management/src/InitInstanceMgmtMapping.csx
  • core/Workflows/lifecycle-transitions/lifecycle-transitions-test-workflow.json
  • core/Workflows/lifecycle-transitions/src/AlwaysTrueRule.csx
  • core/Workflows/lifecycle-transitions/src/ExitMapping.csx
  • core/Workflows/lifecycle-transitions/src/InitializeDataMapping.csx
  • core/Workflows/lifecycle-transitions/src/ProcessEntryMapping.csx
  • core/Workflows/lifecycle-transitions/src/ProcessExitMapping.csx
  • core/Workflows/lifecycle-transitions/src/ProcessTransitionMapping.csx
  • core/Workflows/lifecycle-transitions/src/ShortTimerMapping.csx
  • core/Workflows/lifecycle-transitions/src/TestPathFailRule.csx
  • core/Workflows/lifecycle-transitions/src/TestPathPassRule.csx
  • core/Workflows/lifecycle-transitions/src/TimerEntryMapping.csx
  • core/Workflows/schema-data/schema-data-test-workflow.json
  • core/Workflows/schema-data/src/ConfirmMapping.csx
  • core/Workflows/schema-data/src/SchemaInitMapping.csx
  • core/Workflows/subflow-orchestration/src/AlwaysTrueRule.csx
  • core/Workflows/subflow-orchestration/src/ChildSharedUpdateMapping.csx
  • core/Workflows/subflow-orchestration/src/ChildStartMapping.csx
  • core/Workflows/subflow-orchestration/src/ChildToGrandchildSubFlowMapping.csx
  • core/Workflows/subflow-orchestration/src/GrandchildCompleteMapping.csx
  • core/Workflows/subflow-orchestration/src/GrandchildStartMapping.csx
  • core/Workflows/subflow-orchestration/src/ParentSharedUpdateMapping.csx
  • core/Workflows/subflow-orchestration/src/ParentStartMapping.csx
  • core/Workflows/subflow-orchestration/src/ParentToChildSubFlowMapping.csx
  • core/Workflows/subflow-orchestration/src/UpdateParentDataMapping.csx
  • core/Workflows/subflow-orchestration/subflow-orchestration-child.json
  • core/Workflows/subflow-orchestration/subflow-orchestration-grandchild.json
  • core/Workflows/subflow-orchestration/subflow-orchestration-parent.json
  • core/Workflows/task-execution/src/AlwaysTrueRule.csx
  • core/Workflows/task-execution/src/CrossWorkflowMapping.csx
  • core/Workflows/task-execution/src/GetInstanceDataMapping.csx
  • core/Workflows/task-execution/src/HttpProcessMapping.csx
  • core/Workflows/task-execution/src/InitTaskTestMapping.csx
  • core/Workflows/task-execution/src/ScriptProcessMapping.csx
  • core/Workflows/task-execution/src/StartFlowMapping.csx
  • core/Workflows/task-execution/task-execution-test-workflow.json
  • core/Workflows/task-execution/task-target-workflow.json
  • core/Workflows/version-consistency/src/AlwaysTrueRule.csx
  • core/Workflows/version-consistency/src/InitVersionMapping.csx
  • core/Workflows/version-consistency/src/ReviewMapping.csx
  • core/Workflows/version-consistency/src/V1CompletedMapping.csx
  • core/Workflows/version-consistency/src/V2CompletedMapping.csx
  • core/Workflows/version-consistency/version-consistency-test-workflow-v2.json
  • core/Workflows/version-consistency/version-consistency-test-workflow.json
  • core/Workflows/view-function-extension/src/AlwaysTrueRule.csx
  • core/Workflows/view-function-extension/src/InitVfeMapping.csx
  • core/Workflows/view-function-extension/src/WebPlatformRule.csx
  • core/Workflows/view-function-extension/view-function-extension-test-workflow.json
  • doc/integration-test-documentation.md
  • docker-compose.yml
  • etc/dapr/components/test-binding.yaml
  • etc/dapr/components/test-pubsub.yaml
  • etc/docker/config/seed/integration-test-collection.json
  • package.json
  • tests/Core/.gitignore
  • tests/Core/.vscode/settings.json
  • tests/Core/Config/appsettings.db-migrator.json
  • tests/Core/Config/appsettings.execution.json
  • tests/Core/Config/appsettings.orchestration.json
  • tests/Core/Core.IntegrationTests.csproj
  • tests/Core/Helpers/TestDataBuilder.cs
  • tests/Core/Infrastructure/DaprComponents/db-migrator/config.yaml
  • tests/Core/Infrastructure/DaprComponents/db-migrator/lock.yaml
  • tests/Core/Infrastructure/DaprComponents/db-migrator/secretstore.yaml
  • tests/Core/Infrastructure/DaprComponents/execution/config.yaml
  • tests/Core/Infrastructure/DaprComponents/execution/lock.yaml
  • tests/Core/Infrastructure/DaprComponents/execution/notification-binding.yaml
  • tests/Core/Infrastructure/DaprComponents/execution/pubsub-broadcast.yaml
  • tests/Core/Infrastructure/DaprComponents/execution/pubsub.yaml
  • tests/Core/Infrastructure/DaprComponents/execution/secretstore.yaml
  • tests/Core/Infrastructure/DaprComponents/execution/state.yaml
  • tests/Core/Infrastructure/DaprComponents/orchestration/config.yaml
  • tests/Core/Infrastructure/DaprComponents/orchestration/definition-component-published-subscription.yaml
  • tests/Core/Infrastructure/DaprComponents/orchestration/invalidate-cache-subscription.yaml
  • tests/Core/Infrastructure/DaprComponents/orchestration/lock.yaml
  • tests/Core/Infrastructure/DaprComponents/orchestration/pubsub-broadcast.yaml
  • tests/Core/Infrastructure/DaprComponents/orchestration/pubsub.yaml
  • tests/Core/Infrastructure/DaprComponents/orchestration/secretstore.yaml
  • tests/Core/Infrastructure/DaprComponents/orchestration/state.yaml
  • tests/Core/Infrastructure/IntegrationTestBase.cs
  • tests/Core/Infrastructure/MocklabSeed/.gitkeep
  • tests/Core/Infrastructure/VNextTestEnvironment.cs
  • tests/Core/Tests/SmokeTests.cs
  • tests/Core/test.runsettings
  • vnext-example.sln
  • vnext.config.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch f/sprint24

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yilmaztayfun
yilmaztayfun merged commit 25c6280 into master Apr 28, 2026
1 of 4 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive suite of integration tests for the core domain, covering lifecycle transitions, subflow orchestration, task execution, error boundaries, schema validation, and version consistency. The changes include new workflow definitions, C# mapping scripts, Dapr component configurations, and Postman collections. I have identified several issues: the Target Framework Moniker in the test project is invalid, there is a redundant block in the .gitignore file, and several request names in the Postman collections are either truncated or duplicated. Additionally, I have suggested refactoring the duplicated property-copying logic in the C# mapping scripts and removing unnecessary async modifiers from methods that do not perform asynchronous operations.

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The TargetFramework is set to net10.0, which is not a valid Target Framework Moniker (TFM). This will prevent the project from building. Please correct it to a valid and supported TFM, such as net8.0.

    <TargetFramework>net8.0</TargetFramework>

Comment thread .gitignore
Comment on lines +281 to +283

# vnext-forge LSP scaffold
.vnext-forge-lsp/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block is a duplicate of lines 279-280. You can remove it to keep the .gitignore file clean and avoid redundancy.

"name": "TEST 4: Instance data endpoint",
"item": [
{
"name": "GET {{baseUrl}}/api/v{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{in",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The name for this Postman request appears to be truncated. This can make it difficult to identify the request's purpose in the Postman UI. Consider providing a full, descriptive name, for example, "Get instance data".

Suggested change
"name": "GET {{baseUrl}}/api/v{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{in",
"name": "Get instance data",

"response": []
},
{
"name": "TEST 3 — Step 6: Final state and merged data",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This request name, "TEST 3 — Step 6: Final state and merged data", is a duplicate of the previous one. To improve clarity in the Postman collection, consider giving it a more specific name, such as "TEST 3 — Step 7: Verify final data", to distinguish it from the state verification request.

Suggested change
"name": "TEST 3 — Step 6: Final state and merged data",
"name": "TEST 3 — Step 7: Verify final data",

},
"mapping": {
"location": "./src/DaprHttpMapping.csx",
"code": "dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRHluYW1pYzsKdXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrczsKdXNpbmcgQkJULldvcmtmbG93LlNjcmlwdGluZzsKdXNpbmcgQkJULldvcmtmbG93LkRlZmluaXRpb25zOwoKc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hdGE7CiAgICAgICAgICAgIGlmIChyZXNwb25zZURhdGEgIT0gbnVsbCAmJiBIYXNQcm9wZXJ0eShyZXNwb25zZURhdGEsICJwcm9jZXNzSWQiKSkKICAgICAgICAgICAgICAgIHJlc3VsdC50YXNrUmVzdWx0cy5kYXBySHR0cC5wcm9jZXNzSWQgPSByZXNwb25zZURhdGEucHJvY2Vzc0lkOwogICAgICAgIH0KCiAgICAgICAgTG9nSW5mb3JtYXRpb24oIkRhcHJIdHRwTWFwcGluZyBjb21wbGV0ZWQiKTsKICAgICAgICByZXR1cm4gVGFzay5Gcm9tUmVzdWx0KG5ldyBTY3JpcHRSZXNwb25zZSB7IERhdGEgPSByZXN1bHQgfSk7CiAgICB9Cn0K"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The C# code in this mapping, and several others in this file (DaprServiceMapping, DaprBindingMapping, etc.), contains duplicated logic for copying properties from data.taskResults to result.taskResults. This makes the code hard to maintain, as adding a new task would require updating many mapping files.

Consider refactoring this into a helper method to copy all properties from the source object to the destination. This would make the code more concise and maintainable.

For example, you could add a helper in ScriptBase:

protected void CopyProperties(dynamic source, dynamic destination)
{
    var sourceDict = (IDictionary<string, object>)source;
    var destDict = (IDictionary<string, object>)destination;
    foreach (var kvp in sourceDict)
    {
        destDict[kvp.Key] = kvp.Value;
    }
}

Then, the OutputHandler can be simplified to copy all existing properties before adding the new one.

],
"rule": {
"location": "./src/TestPathPassRule.csx",
"code": "dXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrczsKdXNpbmcgQkJULldvcmtmbG93LlNjcmlwdGluZzsKCnB1YmxpYyBjbGFzcyBUZXN0UGF0aFBhc3NSdWxlIDogU2NyaXB0QmFzZSwgSUNvbmRpdGlvbk1hcHBpbmcKewogICAgcHVibGljIGFzeW5jIFRhc2s8Ym9vbD4gSGFuZGxlcihTY3JpcHRDb250ZXh0IGNvbnRleHQpCiAgICB7CiAgICAgICAgdmFyIGRhdGEgPSBjb250ZXh0Lkluc3RhbmNlPy5EYXRhOwogICAgICAgIGlmIChkYXRhID09IG51bGwpCiAgICAgICAgewogICAgICAgICAgICBMb2dJbmZvcm1hdGlvbigiVGVzdFBhdGhQYXNzUnVsZTogZGF0YSBpcyBudWxsLCByZXR1cm5pbmcgZmFsc2UiKTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KCiAgICAgICAgaWYgKEhhc1Byb3BlcnR5KGRhdGEsICJ0ZXN0UGF0aCIpKQogICAgICAgIHsKICAgICAgICAgICAgdmFyIHRlc3RQYXRoID0gZGF0YS50ZXN0UGF0aD8uVG9TdHJpbmcoKTsKICAgICAgICAgICAgdmFyIHJlc3VsdCA9IHRlc3RQYXRoID09ICJwYXNzIjsKICAgICAgICAgICAgTG9nSW5mb3JtYXRpb24oJCJUZXN0UGF0aFBhc3NSdWxlOiB0ZXN0UGF0aD17dGVzdFBhdGh9LCByZXN1bHQ9e3Jlc3VsdH0iKTsKICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgICB9CgogICAgICAgIExvZ0luZm9ybWF0aW9uKCJUZXN0UGF0aFBhc3NSdWxlOiB0ZXN0UGF0aCBub3QgZm91bmQsIHJldHVybmluZyBmYWxzZSIpOwogICAgICAgIHJldHVybiBmYWxzZTsKICAgIH0KfQo="

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Handler method in this C# script is marked as async but doesn't use the await keyword. This creates an unnecessary state machine, which can have a minor performance impact. For methods that can return a completed task synchronously, it's more efficient to return Task.FromResult() directly and remove the async keyword.

This pattern appears in several other rule and mapping scripts in this pull request (e.g., TestPathFailRule, ShortTimerMapping, AlwaysTrueRule).

Example:

// Before
public async Task<bool> Handler(ScriptContext context)
{
    return true;
}

// After
public Task<bool> Handler(ScriptContext context)
{
    return Task.FromResult(true);
}

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