Skip to content

Conversation

@jimsynz
Copy link
Contributor

@jimsynz jimsynz commented Jan 12, 2026

Summary

  • Implements nested_steps/1 callback for Reactor.Step.Switch
  • Adds @impl true annotation to existing run/3 function (was missing)
  • Adds integration tests that reproduce the issue with async execution
  • Adds unit tests for the new nested_steps/1 callback

Root Cause

Step.Switch didn't implement nested_steps/1, so the planner couldn't see nested steps' dependencies. Without proper dependency edges:

  1. The Switch step could run before its nested steps' dependencies completed
  2. When nested steps were emitted at runtime, the planner couldn't find the dependency step
  3. This caused the "step cannot be found" error

The existing test used async?: false which masked the race condition.

Test plan

Closes #273

…esolution

Steps inside a `switch` block couldn't reference external steps via
`result(:step_name)` when running with async execution. This was because
`Step.Switch` didn't implement the `nested_steps/1` callback, so the
planner couldn't see the nested steps' dependencies and create proper
edges in the dependency graph.

Without proper dependency edges, the Switch step could run before its
nested steps' dependencies completed, causing a "step cannot be found"
error when the emitted steps were planned at runtime.

Closes #273
@jimsynz jimsynz merged commit 6f7c937 into main Jan 12, 2026
23 checks passed
@jimsynz jimsynz deleted the fix/switch-nested-steps-dependency-resolution branch January 12, 2026 22:42
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.

Step referenced from within a switch could not be found

2 participants