Repository navigation
Description
Version: graphify 0.9.22 · macOS · repo: ~8.4k code files, 59,748 nodes / 175,324 edges
Summary
graphify export wiki and graphify export html take their community partition from .graphify_analysis.json. That file is written only by extract (cli.py:3396) and cluster-only / label (cli.py:1668) — never by update / the watch rebuild path (grep graphify_analysis watch.py → no matches).
So after any number of graphify update runs, graph.json and GRAPH_REPORT.md advance while the analysis sidecar stays frozen at the last full extract. The exports keep reading the fossil, and the only signal is a dropped N stale node ID(s) line that reads like housekeeping.
In our repo the sidecar was 9 days and one re-partitioning era behind:
| value | |
|---|---|
graph.json |
59,748 nodes · 2,359 communities |
GRAPH_REPORT.md |
2,359 communities (agrees with graph.json) |
.graphify_analysis.json |
6,243 communities · 111,726 node ids · 9 days old |
graph.html emitted |
aggregated: 6243 community nodes ← the fossil partition |
| wiki emitted | 1,940 articles, dropped 56369 stale node ID(s) |
Measured impact: 4,394 of 59,748 nodes (7.4%) were in no community of the sidecar, so they got no wiki article and were absent from the aggregated HTML. wiki.py:244 intersects the sidecar's communities with the live graph — it only ever subtracts, so that set grows with every commit and never recovers.
Nothing warns. The report says 2,359 communities, the HTML says 6,243, and both are written by the same tool in the same session.
The fix is already in the code — gated on presence instead of agreement
cli.py:2192-2211 already reconstructs communities from graph.json's per-node community attribute, and the comment names this exact bug:
# Fallback: graph.json carries the per-node community as a node attribute
# (`to_json` writes it on every node). The analysis sidecar is the
# canonical source — but the post-commit / watch rebuild path doesn't
# regenerate it, ...
if not communities: # <-- fires only when the sidecar is MISSING
reconstructed = ... # a sidecar that EXISTS but is stale winsThat fallback appears to come from #746 (update + export wiki wipes wiki/ when the sidecar is missing) and #1610 (cluster-only not persisting it → export html reports "Single community"). Both are the absent case. The stale case looks identical from the outside — degraded artifacts, no error — but takes the other branch: when the sidecar exists and is wrong, the fresh data sitting in graph.json, already loaded into G two lines above, is ignored.
Suggested fixes
A. Minimal, at cli.py:2201. Both datasets are already in memory, so the comparison is free: reconstruct unconditionally and prefer it (or at least warn) when the sidecar's node-id set disagrees with the graph's. This also repairs every graph already on disk, without a re-cluster.
communities only. cohesion and gods are read from the same sidecar at cli.py:2185-2187, and in the else branch they become {} / []. gods_data self-heals (cli.py:2259-2260 recomputes via _god_nodes(G)), but cohesion does not — it flows into wiki.py:90, which prints cohesion N.NN in each community article's metadata, and into the HTML export at cli.py:2242. So "reconstruct and prefer" would swap one silent degradation for a smaller one unless it also recomputes cohesion; score_all(G, communities) at cli.py:1521 is the same call the normal path already makes.
B. Root cause, at watch.py:1235/1263. watch already computes communities = cluster(G) and writes them into graph.json via to_json(...). Writing .graphify_analysis.json from those same communities costs nothing extra and keeps the sidecar canonical.
Repairing it externally with cluster-only is not a good workaround, for two reasons already tracked here: clustering is not reproducible run-to-run (#1667 — we measured 2,363 vs 2,362 communities over a byte-identical graph.json), and re-clustering churns curated labels (#2298, #1653). In our repair run, 51% of 2,359 curated labels were renamed by hub.
A cheap consistency check is possible even outside the process: GRAPH_REPORT.md states the community count and .graphify_analysis.json holds the partition, so a wrapper can detect the desync without loading the 101 MB graph.json (we now do exactly this in our refresh script). Inside graphify it is cheaper still — zero I/O, since G and communities are both already loaded at cli.py:2201.
Workaround, for anyone hitting this
Deleting .graphify_analysis.json and re-running the exports is enough to get a correct partition: it forces the if not communities: branch, so the partition is rebuilt from graph.json's per-node attribute, labels are preserved and god-nodes are recomputed. The only loss is the cohesion metric in the wiki articles, until the next real cluster-only / extract.
Two things that are not obvious if you try to repair with cluster-only instead:
- The labels'
.sigsidecar is also written only bycluster-only/label, so after awatchrun the saved labels have no matching signature and every community is treated as changed and renamed by its hub. - That degradation is invisible to a placeholder count: the no-LLM path renames by hub (
cli.py:1595-1597), never toCommunity N, soplaceholders == 0throughout. Weighted by nodes rather than by community count, ~110 renames covered 37.9% of the graph — re-clustering perturbs the largest communities most, so 8 of the top 10 lost their prose name.
Activity
sankalpvats commentedon Aug 2, 2026
Hi! I'd love to work on this issue as my first contribution to the project. If it's still available, could you please assign it to me? Thanks!
yashdeore69 commentedon Aug 2, 2026
hii team, i’m new to contributing here, but i’d like to take this on if it’s available.
my current understanding after taking a look is that the first step is making exports detect a stale .graphify_analysis.json and fall back to the community data in graph.json, including recomputing cohesion. i’d add tests for missing, stale, and matching sidecars. would it be okay to assign that part to me?
mattgdrums-cloud commentedon Sep 7, 2026
Additional downstream evidence for this, from a ~10k-node repository graph (graphify 0.9.51):
Measured silent divergence, 2026-09-05, six minutes after a rebuild:
.graphify_analysis.jsonreferenced 34 nodesgraph.jsonno longer contained, and 1,149 of 10,107 shared nodes carried a different community id between the two files. A tool reading both succeeded at 10:47 and raisedKeyErrorat 10:52 — nothing could warn in between, because neither artifact records which clustering run produced it.Writer-set confirmation (matches this issue's analysis): in our workflow the analysis sidecar is written only by
extractandcluster-only/label— never byupdate,watch, or the git hooks — so for watch/update-driven workflows it is stale by construction.The fix may already be shipped in part:
cluster.community_member_sigs(sha256 over each community's sorted member ids) recomputes fromgraph.jsonand reproduced our shipped.graphify_labels.json.sigbyte-identically (426/426 communities, algorithm stable v0.9.40→v0.9.54). Our ask matches this issue's direction: write that existing signature into every derived artifact on every write path (update/watch/hooks included), so downstream readers can verify two artifacts describe the same clustering — or refuse when they don't. We've adopted refuse-on-mismatch downstream; today it can only be done by recomputing against files the sidecar doesn't stamp.safishamsi commentedon Sep 20, 2026
Fixed in v0.9.64 via #3557 — export detects a stale .graphify_analysis.json and reconstructs from graph.json. Thanks @ayushcodes10.