Skip to content

Conversation

@joaodaher
Copy link
Contributor

@joaodaher joaodaher commented Sep 27, 2025

Note

Add SubworkflowStep, allow composing workflows as steps with YAML codegen (including mappings and async mode), and track/expose workflow dependencies.

  • Core:
    • Introduce SubworkflowStep for calling other workflows; export via __init__.
    • Enhance Workflow/WorkflowBuilder to accept Workflow in >>, converting to SubworkflowStep and validating IO types.
    • Track dependencies on subworkflows (Workflow.dependencies) and expose get_workflow_dependencies().
  • Codegen:
    • Emit workflows.executeWorkflow calls for SubworkflowStep, with support for input/output mappings and wait (fire-and-forget) behavior.
  • Examples:
    • Add examples/app/flows/order_with_subworkflow.py demonstrating an order flow calling a payment subworkflow.
  • Tests:
    • Add unit and codegen tests for subworkflows, mappings, async mode, composition, and dependency tracking.
  • Docs/Meta:
    • Update README.md to mark "Subworkflows" as completed with brief usage note.
    • Bump package version to 0.0.3 in pyproject.toml.

Written by Cursor Bugbot for commit cada93a. This will update automatically on new commits. Configure here.

- add SubworkflowStep for calling other workflows
- enable direct workflow composition with >> operator
- track workflow dependencies automatically
- support both synchronous and async (fire-and-forget) execution
- add input/output parameter mappings
- emit workflows.executeWorkflow in YAML
- comprehensive tests and examples

enables modular workflow design and reusability
feature #3 is now fully implemented with clean API
improve code readability with proper formatting
Copilot AI review requested due to automatic review settings September 27, 2025 21:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements subworkflow functionality to enable composition of Cloud Workflows, allowing workflows to call other workflows as steps with proper dependency tracking and code generation.

Key changes:

  • Introduces SubworkflowStep class for encapsulating subworkflow calls with input/output mappings and wait/fire-and-forget modes
  • Enhances WorkflowBuilder to accept Workflow objects via >> operator, automatically converting them to SubworkflowStep instances
  • Implements dependency tracking system to maintain relationships between parent and child workflows

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/fastapi_cloudflow/core/subworkflow.py New SubworkflowStep class for workflow composition
src/fastapi_cloudflow/core/workflow.py Enhanced workflow builder with subworkflow support and dependency tracking
src/fastapi_cloudflow/codegen/workflows.py YAML generation logic for subworkflow calls
tests/unit/test_subworkflow.py Comprehensive unit tests for subworkflow functionality
tests/codegen/test_subworkflow_codegen.py Tests for YAML code generation with subworkflows
examples/app/flows/order_with_subworkflow.py Example demonstrating real-world subworkflow usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# Apply input mapping if specified
if node.input_mapping:
mapped_args = {k: _as_yaml_expr(v) for k, v in node.input_mapping.items()}
args["argument"] = f"${mapped_args}"
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The mapped_args dictionary is being formatted as a string with f\"${mapped_args}\", which will produce invalid YAML syntax. This should use proper YAML expression formatting or direct assignment of the mapped arguments dictionary.

Suggested change
args["argument"] = f"${mapped_args}"
args["argument"] = mapped_args

Copilot uses AI. Check for mistakes.
@qltysh
Copy link

qltysh bot commented Sep 27, 2025

❌ 40 blocking issues (42 total)

Tool Category Rule Count
bandit Dependency Alert Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. 40
qlty Structure Function with high complexity (count = 24): _process_single_step 1
qlty Structure Function with many parameters (count = 6): __init__ 1

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on October 25

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

if node.input_mapping:
mapped_args = {k: _as_yaml_expr(v) for k, v in node.input_mapping.items()}
args["argument"] = f"${mapped_args}"

Copy link

Choose a reason for hiding this comment

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

Bug: Cloud Workflows Argument Mapping Error

The input mapping for SubworkflowStep incorrectly formats arguments for Cloud Workflows. It converts the mapped_args dictionary into a string representation wrapped in a YAML expression, which is invalid syntax. This prevents proper argument passing to subworkflows.

Fix in Cursor Fix in Web

@joaodaher joaodaher merged commit dfde083 into main Sep 27, 2025
6 checks passed
@joaodaher joaodaher deleted the feature/subworkflows branch September 27, 2025 22:51
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.

2 participants