feat(simulation): add explicit post-stabilization hook at end of play()#935
feat(simulation): add explicit post-stabilization hook at end of play()#935yashveer-1 wants to merge 2 commits intoCircuitVerse:mainfrom
Conversation
✅ Deploy Preview for circuitverse ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughA new internal hook function 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/simulator/src/engine.js`:
- Around line 452-454: The onSimulationStabilized hook is being invoked even
after contention errors where forceResetNodesSet(true) is called, which
contradicts its JSDoc; update play() so the hook is only called on a clean
stabilization (e.g., guard the call by checking the contention/error state
instead of unconditional invocation) or modify the call to pass a status flag
(e.g., onSimulationStabilized(scope, { error: true })) so consumers can
distinguish error vs. clean stabilization; also fix the indentation of the
onSimulationStabilized(scope) line to match the rest of play()'s 4-space block
formatting.
|
Hey @yashveer-1 can you please add issue number in fixes # |

Fixes #
Describe the changes you have made in this PR
This PR generally focuses on how to know whether the state is stable or not. Before this PR, there was no way to determine at what point exactly the circuit is stabilized, which means there was not any explicit function that determines the stabilization of the state.
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
Explain your implementation approach:
Describe in your own words:
Checklist before requesting a review
Note: Please check Allow edits from maintainers if you would like us to assist in the PR.
Summary by CodeRabbit