fix(CORE-4563): Fix dispose infinite recursion#4
Merged
Conversation
…recursion during disposal in shared graphs.
…ment and prevent infinite recursion in shared graphs. Added comprehensive tests to validate disposal behavior and memory clearing.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 59670a5. Configure here.
dmmotter
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

While updating DAG to call
disposemore, an infinite recursion bug was uncovered in nools.The problem is that the graph nools builds can have cyclic nodes (A -> B -> ... -> A) so when it traversed the nodes during disposal it would get caught in infinite recursion of going through the same path over and over again. By marking nodes as visited we can signal that that node should not be traversed further because we've already visited it.
I also had cursor whip up some more exhaustive tests
(blocks https://github.com/immuta/bodata/pull/22057)
JIRA Ticket Link: https://immuta.atlassian.net/browse/CORE-4563
Note
Medium Risk
Touches core rete network disposal logic by adding cycle detection and expanding memory clearing across multiple node types; bugs here could cause leaks or incorrect cleanup but is covered by extensive new tests.
Overview
Fixes
session.dispose()traversal to be cycle-safe by threading a sharedvisitedmap throughRootNode/TypeNodeand allNode/BetaNodedispose propagation, preventing infinite recursion on cyclic or shared graphs.Extends disposal to clear additional per-node state (
FromNode/FromNotNodefromMemory,NotNodeleftTupleMemory) and removes redundantdisposeoverrides on adapter nodes. Adds a comprehensive regression test suite validating that beta/tuple memories, agenda state, and working memory are fully cleared and that dispose is idempotent.Modernizes project tooling by migrating CI from Travis to GitHub Actions, adding
miseNode pinning/lock, generatingpackage-lock.json, and bumping the declared Node engine requirement to>= 22(including README badge update).Reviewed by Cursor Bugbot for commit 0b272b7. Bugbot is set up for automated code reviews on this repo. Configure here.