Skip to content

Conversation

@hesprs
Copy link

@hesprs hesprs commented Feb 5, 2026

… fix traverser loop handling

  • instead of relying on any join strategy for handling loop execution, now it detects all nodes inside a loop and resets all the nodes in that loop as uncompleted to re-execute the loop when a loop is about to start. This can ensure a loop with >= 3 nodes can run and make execution more stable (any can break in-loop logic).
  • use more elegant and intuitive method to define loops: set loop start and end, wire edges inside the loop, then wire incoming and breaking nodes directly to the loop instead of nodes inside the loop. This reduces rewiring overhead and is the similar pattern used by popular workflow products.
  • update tests to reflect new loop usage.
  • add one test that tests whether a loop with >= 3 nodes can run.
  • update docs to reflect new loop usage.
  • fix small flaws in docs.
  • examined @flowcraft/compiler logic, found its tests contains hardcoded personal file paths, thus unable to determine whether it needs updating. Examined it's code, found its for-in and while handler actually assumes the new loop usage. This is confusing since the loop was originally not used like so. Anyway it doesn't need changing (from personal view).
  • this PR partially fixes issue Subflow Type Error & Loops and Cycles Ignore Edges #7.

… fix traverser loop handling

- instead of relying on `any` join strategy for handling loop execution, now it detects all nodes inside a loop and resets all the nodes in that loop as uncompleted to re-execute the loop when a loop is about to start. This can ensure a loop with >= 3 nodes can run and make execution more stable (`any` can break in-loop logic).
- use more elegant and intuitive method to define loops: set loop start and end, wire edges **inside the loop**, then wire incoming and breaking nodes directly to the loop instead of nodes inside the loop. This reduces rewiring overhead and is the similar pattern used by popular workflow products.
- update tests to reflect new loop usage.
- add one test that tests whether a loop with >= 3 nodes can run.
- update docs to reflect new loop usage.
- fix small flaws in docs.
- examined `@flowcraft/compiler` logic, found its tests contains hardcoded personal file paths, thus unable to determine whether it needs updating. Examined it's code, found its `for-in` and `while` handler actually assumes the new loop usage. This is confusing since the loop was originally not used like so. Anyway it doesn't need changing (from personal view).
- remove dead code that prevents any node being the sibling of a loop controller from execution
- enhance traverser loop nodes detection and improve safety
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.

1 participant