Skip to content

Draft: Add circular reference detection to prevent infinite recursion #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

InzGIBA
Copy link

@InzGIBA InzGIBA commented Aug 3, 2025


name: Pull request
about: Prevent infinite loops by detecting self-referencing nodes
assignees: fabiocaccamo


Describe your changes
Added circular reference detection to prevent infinite recursion when a node references itself as its parent. The validation is implemented in the __get_nodes_data method and checks for cases where pk == tn_parent_id. When a circular reference is detected, a clear ValueError is raised with the message "Circular reference detected."

Related issue
N/A (proactive improvement to prevent a common issue that can cause infinite recursion)

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests for the proposed changes.
  • I have run the tests and there are not errors.

@InzGIBA InzGIBA changed the title Add circular reference detection to prevent infinite recursion Draft: Add circular reference detection to prevent infinite recursion Aug 21, 2025
@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Aug 21, 2025

@InzGIBA could you please fix CI errors?

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