Skip to content

Conversation

@jumski
Copy link
Contributor

@jumski jumski commented Dec 25, 2025

Prevent empty dependsOn arrays in Flow steps

This PR improves type safety by rejecting empty dependsOn: [] arrays at compile time. Empty dependency arrays are semantically meaningless (if a step has no dependencies, it should omit dependsOn entirely) and create a type mismatch between TypeScript and runtime behavior.

The changes:

  1. Modified the Flow DSL type definitions to require at least one dependency in dependsOn arrays using the [Deps, ...Deps[]] syntax
  2. Added type tests to verify that empty dependency arrays are rejected at compile time
  3. Updated documentation to clarify that ctx.flowInput is lazy-loaded and should be awaited
  4. Improved examples in documentation to show the proper pattern of const flowInput = await ctx.flowInput
  5. Enhanced the array processing documentation to explain the performance implications of accessing flow input in map handlers

This change helps prevent a subtle bug where TypeScript would infer an empty object type for dependencies with dependsOn: [], but at runtime the step would receive the flow input instead.

@changeset-bot
Copy link

changeset-bot bot commented Dec 25, 2025

⚠️ No Changeset found

Latest commit: a086d35

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 no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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 a086d35

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

☁️ Nx Cloud last updated this comment at 2025-12-30 12:03:53 UTC

@jumski jumski force-pushed the 12-25-fix_various_pr_commends_from_runkey_stack branch from ce2658e to 3886c6c Compare December 25, 2025 23:04
@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
@jumski jumski force-pushed the 12-25-fix_various_pr_commends_from_runkey_stack branch from 3886c6c to 065c8c7 Compare December 30, 2025 10:26
@github-actions
Copy link
Contributor

🔍 Preview Deployment: Website

Deployment successful!

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

📝 Details:

  • Branch: 12-25-fix_various_pr_commends_from_runkey_stack
  • Commit: 3fe287b272012784978d66d7a10904fc5cfb4ff8
  • 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:02 PM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 30, 12:03 PM UTC: @jumski merged this pull request with Graphite.

@jumski jumski changed the base branch from 12-25-feat_lazy_load_ctx.flowinput_to_prevent_data_duplication_for_map_steps to graphite-base/561 December 30, 2025 12:00
@jumski jumski changed the base branch from graphite-base/561 to main December 30, 2025 12:01
@jumski jumski force-pushed the 12-25-fix_various_pr_commends_from_runkey_stack branch from 065c8c7 to a086d35 Compare December 30, 2025 12:02
@jumski jumski merged commit a990bb4 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: a990bb4a03cfe7bf0ca232d618f704730c672176
  • View Logs

Deployed at: 2025-12-30T13:03:26+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