Skip to content

fix(CORE-4563): Fix dispose infinite recursion#4

Merged
iancamp merged 4 commits into
immutafrom
fix-dispose-infinite-recursion
May 7, 2026
Merged

fix(CORE-4563): Fix dispose infinite recursion#4
iancamp merged 4 commits into
immutafrom
fix-dispose-infinite-recursion

Conversation

@iancamp

@iancamp iancamp commented May 6, 2026

Copy link
Copy Markdown

While updating DAG to call dispose more, 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 shared visited map through RootNode/TypeNode and all Node/BetaNode dispose propagation, preventing infinite recursion on cyclic or shared graphs.

Extends disposal to clear additional per-node state (FromNode/FromNotNode fromMemory, NotNode leftTupleMemory) and removes redundant dispose overrides 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 mise Node pinning/lock, generating package-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.

iancamp added 2 commits May 6, 2026 00:47
…ment and prevent infinite recursion in shared graphs. Added comprehensive tests to validate disposal behavior and memory clearing.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 59670a5. Configure here.

Comment thread lib/nodes/adapterNode.js Outdated
@iancamp iancamp changed the title Fix dispose infinite recursion fix(CORE-4563): Fix dispose infinite recursion May 6, 2026
@iancamp iancamp marked this pull request as ready for review May 7, 2026 08:20
@iancamp iancamp requested review from a team and dmmotter and removed request for a team May 7, 2026 08:20
@iancamp iancamp merged commit 8e0101f into immuta May 7, 2026
4 checks passed
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.

2 participants