Skip to content

Conversation

@jumski
Copy link
Contributor

@jumski jumski commented Dec 25, 2025

Asymmetric Handler Signatures for Flow Composition

This PR implements asymmetric handler signatures to simplify flow composition and improve performance:

  • Root steps now receive flow input directly: (flowInput, ctx) => ...
  • Dependent steps receive only dependency outputs: (deps, ctx) => ...
  • Flow input in dependent steps is now accessed via await ctx.flowInput (async/lazy-loaded)
  • Lazy loading prevents data duplication for map steps processing large arrays
  • Only root non-map steps receive flow_input from SQL to reduce data transfer
  • Added FlowInputProvider class to handle caching and lazy loading of flow input
  • Updated examples, tests, and documentation to reflect the new pattern

This change enables functional composition and simplifies types for future subflows by making handler signatures more intuitive and reducing unnecessary data duplication.

@changeset-bot
Copy link

changeset-bot bot commented Dec 25, 2025

⚠️ No Changeset found

Latest commit: 878a4d1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes changesets to release 5 packages
Name Type
@pgflow/core Minor
@pgflow/dsl Minor
@pgflow/client Minor
@pgflow/edge-worker Minor
pgflow Minor

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Dec 25, 2025

View your CI Pipeline Execution ↗ for commit 878a4d1

Command Status Duration Result
nx run edge-worker:test:integration ✅ Succeeded 3m 52s View ↗
nx affected -t verify-exports --base=origin/mai... ✅ Succeeded 3s View ↗
nx affected -t build --configuration=production... ✅ Succeeded 3s View ↗
nx affected -t lint typecheck test --parallel -... ✅ Succeeded 2m 10s View ↗
nx run cli:e2e ✅ Succeeded 4s View ↗
nx run client:e2e ✅ Succeeded 1m 8s View ↗
nx run edge-worker:e2e ✅ Succeeded 48s View ↗
nx run core:pgtap ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-25 21:16:27 UTC

@jumski jumski force-pushed the 12-25-feat_lazy_load_ctx.flowinput_to_prevent_data_duplication_for_map_steps branch from 85f08e5 to 1717e83 Compare December 25, 2025 18:22
@jumski jumski force-pushed the 12-25-feat_lazy_load_ctx.flowinput_to_prevent_data_duplication_for_map_steps branch from 1717e83 to 878a4d1 Compare December 25, 2025 21:09
@github-actions
Copy link
Contributor

🔍 Preview Deployment: Website

Deployment successful!

🔗 Preview URL: https://pr-560.pgflow.pages.dev

📝 Details:

  • Branch: 12-25-feat_lazy_load_ctx.flowinput_to_prevent_data_duplication_for_map_steps
  • Commit: cc1eb824710278a574629de63a90c42f0d6ec461
  • View Logs

_Last updated: _

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