Skip to content

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?

@InzGIBA
Copy link
Author

InzGIBA commented Sep 6, 2025

could you please fix CI errors?

Yes, of course. I apologize for the delay in fixing the code, but I only just found the time.

@InzGIBA InzGIBA changed the title Draft: Add circular reference detection to prevent infinite recursion Add circular reference detection to prevent infinite recursion Sep 6, 2025
@codecov
Copy link

codecov bot commented Sep 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.19%. Comparing base (df33dbf) to head (4a0d943).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #199      +/-   ##
==========================================
+ Coverage   91.14%   91.19%   +0.05%     
==========================================
  Files          11       11              
  Lines         700      704       +4     
==========================================
+ Hits          638      642       +4     
  Misses         62       62              
Flag Coverage Δ
unittests 91.19% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fabiocaccamo
Copy link
Owner

@InzGIBA could you please add a test case too?

@InzGIBA
Copy link
Author

InzGIBA commented Sep 8, 2025

Tests added to validate the “__get_nodes_data” function in PR

@fabiocaccamo fabiocaccamo added the bug Something isn't working label Sep 30, 2025
@fabiocaccamo fabiocaccamo moved this to Todo in Open Source Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants