fix(communities): scope remove_communities to the group_ids being rebuilt#1658
Open
Saltasm wants to merge 1 commit into
Open
fix(communities): scope remove_communities to the group_ids being rebuilt#1658Saltasm wants to merge 1 commit into
Saltasm wants to merge 1 commit into
Conversation
…uilt build_communities(group_ids=[...]) documents 'Create communities only for the listed group_ids', but its clear step called remove_communities with no group filter — deleting EVERY Community node in the database before recreating only the selected groups. A scoped rebuild therefore silently destroyed all other groups' communities. Thread group_ids through remove_communities and all four driver implementations (neo4j, falkordb, kuzu, neptune) plus the GraphOperationsInterface signature: scoped DETACH DELETE with WHERE c.group_id IN $group_ids when group_ids is provided, unchanged full wipe when it is not (blank/None keeps the documented whole-graph behavior). Fixes getzep#1657 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
Fixes #1657.
build_communities(group_ids=[...])documents scoped behavior — "Create communities only for the listed group_ids" — but its clear step deletes every Community node in the database:The rebuild then recreates communities only for the selected groups, so a scoped rebuild silently destroys all other groups' communities. Observed live on a 5-group graph: rebuilding 2 stale groups deleted the other 3 groups' 71 communities with no error or log line. Any multi-tenant deployment refreshing communities per tenant hits this on every call, and recovery costs a full LLM re-summarization across all groups.
Fix
Thread
group_idsthrough the clear step:community_operations.remove_communities(driver, group_ids=None)— scopedDETACH DELETEwithWHERE c.group_id IN $group_idswhengroup_idsis provided; the existing full wipe when it is not (blank/None keeps the documented whole-graph behavior).GraphOperationsInterface.remove_communitiesand all four driver implementations (neo4j, falkordb, kuzu, neptune) — each mirrors thegroup_ids is Nonebranching already used by sibling operations in the same files.build_communitiespasses itsgroup_idsthrough.Tests
tests/utils/maintenance/test_remove_communities.py(mocked driver, no DB):WHERE c.group_id IN $group_idsform with the right paramsgroup_ids=[]behaves like None (no scoping requested, matchingbuild_communities' blank semantics)graph_operations_interfacefast path receivesgroup_ids🤖 Generated with Claude Code