Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

For Each / Parallel Each were not being validated correctly -- breaking workflow executions.
Also surface serialization errors to the logs correctly.

Type of Change

  • Bug fix

Testing

Manually Tested.

Screen.Recording.2025-09-09.at.5.52.34.PM.mov

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Sep 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 10, 2025 0:58am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 10, 2025 0:58am

@vercel vercel bot temporarily deployed to Preview – docs September 10, 2025 00:54 Inactive
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR fixes critical workflow validation issues affecting For Each loops and Parallel Each blocks that were causing workflow execution failures. The changes implement comprehensive pre-execution validation and improve error handling across three key areas:

Serializer Validation Enhancement: The Serializer class now includes a WorkflowValidationError class and validateSubflowsBeforeExecution method that validates subflow configurations before execution. This validation checks that forEach loops have valid collections and collection-based parallels have valid distributions, supporting multiple data formats (arrays, objects, strings, JSON) and variable references like <start.items>. The validation is triggered when validateRequired=true during serialization.

Dynamic Subflow Generation: The workflow execution hook now generates loop and parallel configurations dynamically from the current workflow state instead of using potentially stale stored configurations. This prevents validation failures when users modify blocks by calling generateLoopBlocks(filteredStates) and generateParallelBlocks(filteredStates) to create fresh runtime configurations, then enabling validation during serialization.

Enhanced Error Logging: The workflow log API now properly handles failed executions by checking result.success === false and calling safeCompleteWithError instead of treating all executions as successful. It also extracts actual user and workspace IDs from the validated workflow instead of using empty strings. Additionally, serialization errors are now surfaced to the console with structured error information including block context for better debugging.

These changes work together to catch validation errors early in the workflow lifecycle, provide better error reporting to users, and ensure that subflow blocks have valid configurations before execution begins.

Confidence score: 4/5

  • This PR addresses critical workflow execution failures with well-structured validation logic and error handling
  • Score reflects solid implementation of validation patterns and proper error propagation throughout the system
  • Pay close attention to the complex validation logic in validateSubflowsBeforeExecution method for edge cases

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@icecrasher321 icecrasher321 merged commit 8841e9b into staging Sep 10, 2025
6 checks passed
Sg312 pushed a commit that referenced this pull request Sep 15, 2025
…serialization errors in the logs correctly (#1299)

* fix(subflow-validation): validate subflow fields correctly + surface serialiazation errors in the logs correctly

* remove comments
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…serialization errors in the logs correctly (simstudioai#1299)

* fix(subflow-validation): validate subflow fields correctly + surface serialiazation errors in the logs correctly

* remove comments
@waleedlatif1 waleedlatif1 deleted the fix/subflow-validation branch October 13, 2025 17:39
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