Conversation
natoverse
approved these changes
Mar 2, 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.
This pull request introduces a new utility for filtering out "phantom" or orphaned relationships in graph extraction and update workflows. It ensures that relationships whose source or target entities do not exist are removed, preventing downstream errors caused by hallucinated or broken graph edges. The change is applied in both the graph extraction and incremental update pipelines, and is thoroughly tested with new unit tests.
Graph extraction and update pipeline improvements:
filter_orphan_relationshipsutility function inutils.py, which removes relationships referencing non-existent entities after LLM graph extraction. This prevents phantom edges in the graph and logs warnings when such relationships are dropped.filter_orphan_relationshipsinto the graph extraction workflow (extract_graph.py) and the incremental update workflow (update_entities_relationships.py), ensuring orphan relationships are filtered out in both initial and update passes. [1] [2] [3] [4]Testing and validation:
filter_orphan_relationships,_merge_entities, and_merge_relationshipsintest_extract_graph.py, covering edge cases such as missing sources/targets, empty inputs, and index resetting.test_update_relationships.py, validating that merged relationships with hallucinated endpoints are correctly removed after entity/relationship updates.Release and documentation:
.semversioner/next-release/patch-20260302221432185149.json.