Reduce update churn and stabilize community IDs#822
Closed
FatahChan wants to merge 2 commits into
Closed
Conversation
Make `graphify update` idempotent by skipping output rewrites when graph/report content is unchanged, add `update --no-cluster`, and preserve community IDs across runs via overlap-based remapping with deterministic partition inputs. Co-authored-by: Cursor <cursoragent@cursor.com>
Use safe JSON serialization fallbacks for deterministic sort keys in clustering and graph canonicalization, and skip invalid community IDs with a stderr warning instead of raising during update rebuilds. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced May 26, 2026
bgmbgm94
added a commit
to bgmbgm94/graphify
that referenced
this pull request
May 26, 2026
cluster-only re-runs Leiden clustering and then re-applies the existing .graphify_labels.json by raw cid index, which causes labels to attach to clusters whose members are unrelated to the label's original meaning whenever the graph has changed between labeling and re-clustering. Mirror the safety net already present in watch.py:_rebuild_code added in Graphify-Labs#822 for the watch/update paths. Adds a regression test that fails without the fix (label cids become orphaned from graph.json community attributes after re-clustering). Refs: Graphify-Labs#1027 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
safishamsi
pushed a commit
that referenced
this pull request
May 26, 2026
…1028) cluster-only re-runs Leiden clustering and then re-applies the existing .graphify_labels.json by raw cid index, which causes labels to attach to clusters whose members are unrelated to the label's original meaning whenever the graph has changed between labeling and re-clustering. Mirror the safety net already present in watch.py:_rebuild_code added in #822 for the watch/update paths. Adds a regression test that fails without the fix (label cids become orphaned from graph.json community attributes after re-clustering). Refs: #1027 Co-authored-by: Claude Opus 4.7 (1M context) <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.
Summary
graphify update --no-clusterand thread it through the watch rebuild pathgraphify updateidempotent by skippinggraph.json/GRAPH_REPORT.mdrewrites when graph/report content is unchanged (ignoring commit-hash-only report drift)update --no-clusterbehaviorCloses #741
Test plan
uv run --with pytest pytest tests/test_cluster.py tests/test_watch.py tests/test_cli_export.pyuv run python -m graphify update . && uv run python -m graphify update .uv run --with pytest pytest(pre-existing baseline failures unrelated to this change remain)