Skip to content

Fixing play state conflict#135

Open
HoMinhNhat123 wants to merge 11 commits into
urban-toolkit:mainfrom
HoMinhNhat123:fixingPlayStateConflict
Open

Fixing play state conflict#135
HoMinhNhat123 wants to merge 11 commits into
urban-toolkit:mainfrom
HoMinhNhat123:fixingPlayStateConflict

Conversation

@HoMinhNhat123

@HoMinhNhat123 HoMinhNhat123 commented Jun 15, 2026

Copy link
Copy Markdown

Describe your changes

Fixed a bug in playNodesUpTo in FlowProvider.tsx where calling it while playAllNodes was already running would cause nodes to re-execute mid-run concurrently. This is especially harmful for slow nodes — a user repeatedly clicking a node while it is still loading would keep restarting execution, and the node would never finish. The fix adds a guard at the top of playNodesUpTo:

if (playAllStateRef.current != null) return;

Added unit tests for FlowProvider to document and prove existing bugs in 'playNodesUpTo'. The tests cover:

  • onConnect correctly initializes merge node source slots when connecting multiple nodes
  • applyNewOutput propagates output to correct downstream nodes
  • applyNewOutput handles merge flow nodes with multiple inputs
  • playAllNodes executes nodes in topological order level by level
  • playNodesUpTo correctly guards against running while playAllNodes is in progress (proving the bug where playNodesUpTo had no guard against playAllStateRef, which would cause nodes to re-execute mid-run)

Issue resolved by this PR (if any)

Type of change (Check all that apply)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Other:

Parts of Curio impacted by this PR:

  • Frontend
  • Backend
  • Sandbox

Testing

  • Executed ./scripts/test.sh and it passed all tests.

Backend unit tests, sandbox unit tests, and Jest passed. E2E Playwright tests (06-autark-what-if-shadow-study, 07-autark-gpu-shader) fail locally due to no hardware WebGPU in WSL

Screenshots (if relevant)

Checklist (Check all that apply)

  • I have manually loaded each .json test from the tests/ folder into Curio, ran all the nodes one by one, and checked that they run without errors and give the expected results
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

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