Repository navigation
Description
Summary
graphify benchmark <graph.json> still crashes with KeyError: 'links' on Graphify 0.9.27 when the graph was generated by the documented code-only, no-cluster extraction path.
This appears to be the unresolved mode-specific case behind #1198. That issue was closed on the premise that graph.json always uses links, but graphify extract --code-only --no-cluster currently emits edges.
Environment
- Graphify:
0.9.27 - Python:
3.11.15 - NetworkX:
3.6.1 - OS: Ubuntu 26.04 on WSL2 (
Linux 6.18.33.2-microsoft-standard-WSL2, x86_64) - Target corpus: public
pallets/itsdangerous, commit672971d66a2ef9f85151e53283113f33d642dabd
Minimal reproduction
root="$(mktemp -d)"
git clone https://github.com/pallets/itsdangerous.git "$root/target"
HOME="$root/home" XDG_CACHE_HOME="$root/home/.cache" \
uvx --from graphifyy==0.9.27 graphify extract "$root/target" \
--code-only --no-cluster --out "$root/out" --force
python - <<'PY' "$root/out/graphify-out/graph.json"
import json, sys
print(sorted(json.load(open(sys.argv[1]))))
PY
HOME="$root/home" XDG_CACHE_HOME="$root/home/.cache" \
uvx --from graphifyy==0.9.27 graphify benchmark \
"$root/out/graphify-out/graph.json"Observed result
The extractor succeeds:
wrote .../graph.json — 218 nodes, 577 edges (no clustering)
The graph's top-level keys are:
['edges', 'hyperedges', 'input_tokens', 'nodes', 'output_tokens']
benchmark exits 1:
File "graphify/benchmark.py", line 107, in run_benchmark
G = json_graph.node_link_graph(data, edges="links")
...
KeyError: 'links'
Expected result
benchmark should consume every graph.json format emitted by Graphify itself, including the code-only, no-cluster path.
Likely cause
At v0.9.27, graphify/benchmark.py still does:
G = json_graph.node_link_graph(data, edges="links")The mode used above emits edges. Graphify's affected.py already contains a compatibility normalisation for this exact format split:
if "links" not in raw and "edges" in raw:
raw = dict(raw, links=raw["edges"])Applying the same loader normalisation in benchmark.py, preferably through one shared graph-loading helper, should make the command accept both Graphify-generated representations without changing the writer contract.
Prior issue
- benchmark crashes: KeyError 'links' on networkx 3.x (graph.json uses 'edges' key) #1198 was closed after concluding that Graphify always writes
links. - The current reproduction demonstrates that this is not true for
extract --code-only --no-cluster --out ...in v0.9.27.
Local evidence
- Captured traceback:
/tmp/graphify-v0927-verify/benchmark.log - Traceback SHA-256:
99cf6f5c86f901e0c465d422c40765beb078eeba488b41ad07f06e21d94248cb
Activity
fix: load raw edges-keyed graphs + stop pruning alive files as deleted (
chore: bump to 0.9.28; changelog for #2211/#2213/#2210/#2212/#2215/#2221
safishamsi commentedon Jul 27, 2026
Fixed in v0.9.28. benchmark, the graph merge-driver, and the call-flow HTML export now load a raw --no-cluster graph.json (edges stored under 'edges' rather than 'links') through a shared loader that normalizes the key. https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.28
Merge upstream/v8 (0.9.28) into feat/clusters
fix: load raw edges-keyed graphs + stop pruning alive files as deleted (
chore: bump to 0.9.28; changelog for Graphify-Labs#2211/Graphify-Labs…