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: 3886c6c

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 3886c6c

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

☁️ Nx Cloud last updated this comment at 2025-12-25 23:11:49 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
@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: 9e698cb23667df570627fcd74f103e589294472a
  • 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