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: b1954f6

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 b1954f6

Command Status Duration Result
nx test:types:health dsl ✅ Succeeded 11s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-30 12:01:53 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
@jumski jumski force-pushed the 12-24-add-changeset-and-news-for-assymetric-handlers branch from 9ea84a2 to 96b3847 Compare December 30, 2025 10:26
@jumski jumski force-pushed the 12-25-feat_lazy_load_ctx.flowinput_to_prevent_data_duplication_for_map_steps branch from 878a4d1 to 7a1bc97 Compare December 30, 2025 10:26
@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: 060fb474edc8fc43bf3db3bb57fd250c8cc21e87
  • View Logs

_Last updated: _

Copy link
Contributor Author

jumski commented Dec 30, 2025

Merge activity

  • Dec 30, 11:24 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 30, 12:01 PM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 30, 12:01 PM UTC: @jumski merged this pull request with Graphite.

@jumski jumski changed the base branch from 12-24-add-changeset-and-news-for-assymetric-handlers to graphite-base/560 December 30, 2025 11:58
@jumski jumski changed the base branch from graphite-base/560 to main December 30, 2025 11:59
@jumski jumski force-pushed the 12-25-feat_lazy_load_ctx.flowinput_to_prevent_data_duplication_for_map_steps branch from 7a1bc97 to b1954f6 Compare December 30, 2025 12:00
@jumski jumski merged commit 8c77a83 into main Dec 30, 2025
12 checks passed
@github-actions
Copy link
Contributor

🚀 Production Deployment: Website

Successfully deployed to production!

🔗 Production URL: https://pgflow.dev

📝 Details:

  • Commit: 8c77a83d8a45d549976b37f78740cfce8bc2a38e
  • View Logs

Deployed at: 2025-12-30T13:01:24+01:00

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