Skip to content

benchmark still crashes on code-only --no-cluster graph in v0.9.27 (follow-up to #1198) #2212

Closed

Description

@Sarakael78

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, commit 672971d66a2ef9f85151e53283113f33d642dabd

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

Local evidence

  • Captured traceback: /tmp/graphify-v0927-verify/benchmark.log
  • Traceback SHA-256: 99cf6f5c86f901e0c465d422c40765beb078eeba488b41ad07f06e21d94248cb

Activity

  1. safishamsi commented on Jul 27, 2026

    @safishamsi
    Member

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions